Elephants for breakfast
bitfieldconsulting.com·23w·
Discuss: Hacker News

If you have a tough question that you can’t answer, first tackle a simpler question that you can’t answer. —Max Tegmark, “Our Mathematical Universe”

Everyone knows how to eat an elephant (but please don’t: they’re quite endangered). The point is that apparently intimidating tasks can always be dealt with by breaking them up into more tractable sub-tasks, and the same applies to testing.

For example, in Here comes the sun, we did the bare minimum to create a simple weather client program in Rust, and now we’re interested in testing the get_weather function that we wrote. Here’s our first attempt at a test:

#[cfg(test)]
mod tests {
use std::env;

use super::*;

#[test]
fn get_weather_fn_re...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help