2 ms·
Doesn’t Rust have something like this? Where you can write code in comments and the code is actually tested?
by Waterluvian 3y ago
Doesn’t Rust have something like this? Where you can write code in comments and the code is actually tested?
- nrub 3y agoYup
- andrewjf 3y agoYes, they’re called documentation tests. https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html https://doc.rust-lang.org/rustdoc/write-documentation/docume...
- jerf 3y agoGo's contribution here is not so much inventing the idea... Python's had it since the 20th century, for instance... but accidentally hiding them in the docs so that so many people, even long-time Go programmers, don't realize Go has it too.
- the_gipsy 3y agoLightyears ahead.