Rain 🚱 is a user on cybre.space. You can follow them or interact with them if you have an account anywhere in the fediverse.
Rain 🚱 @grainloom

idea:
your examples should be part of your automated !

there is nothing more irritating then eg. finding a cool rust crate and not being able to run the examples :blobsad:

...ok, maybe mosquitoes are worse

but other than that!!!! nothing!!!! **literally** nothing!!

· brutaldon · 7 · 7

@grainloom afaik Rust actually builds and runs the examples when you make it test, I've had to disable a test on something to make Travis pass once

@noiob
I think the example I tried was in the readme?
So, set up git hooks to rebuild the readme when examples change!!!

@grainloom Heh, but real talk, people not testing all their stuff is a problem. Back when I made my Twitter bots use Masto, too, the only Masto crate just simply didn't work, and it took me a while to convince the dev that it wasn't my fault

@grainloom I thought it was neat that this is specifically the intended use case for github.com/sol/markdown-unlit: keep runnable code examples in the project's README.md and automatically extract and run them as a test suite. (this isn't how I used it on Corrode, but I thought it was neat anyway.)

they document doing it with Haskell, but it could be called from a Rust `build.rs` so Cargo re-runs it when your readme changes.

@jamey @grainloom Similarly, the doctest python module vastly improved both our documentation and testing when we adopted it: docs.python.org/3/library/doct

@grainloom and ticks. i got lyme disease from a tick once. ticks are worse too. f$%< ticks.

(seriously, yes a thousand times to the op!!!)

(also til rust packages are called crates? rusty crates? that's adorable ^w^++)

@codepuppy
ticks are bad because they wanna eat our pets and i hate them

@grainloom Related: Always makes me wonder why programming books don't show how their examples work by adding tests...