Repository navigation
|
Just opening this thread to share different documentation and testing tools that might be useful or worth discussing. |
Replies: 4 comments 3 replies
|
Just found this which helps you test markdown files similar to Rustdoc: https://github.com/budziq/rust-skeptic. Might not be needed after using Cargo readme, but good to keep in mind. |
|
Whoa, I just found another really nifty trick: https://doc.rust-lang.org/rustdoc/documentation-tests.html#include-items-only-when-collecting-doctests. |
|
Hey, I just managed to find a way to test all of the Rust snippets in the website in a way that doesn't require all snippets to come from a full-blown cargo project. Now in the site source we write: {% rustdoc_test() %}
```rust
# extern crate raui;
# use raui::prelude::*;
let tree = widget! {
(content_box)
};
{% end %}And then we can run It turns out it simple to get rustdoc to test any markdown file you want: cargo build --features all -p raui
for file in $(find site/content/ -name '*.md'); do \
echo "Testing: $file"; \
rustdoc --crate-name docs-test $file --test -L target/debug/deps; \
done |
|
hmm, i think you've solved all aspects of the problem with CI docs testing :D is there a way to somehow mark this discussion as closed? (by that i mean it won't pop out on top of the discussion board) 🤔 for now i think of adding |

Hey, I just managed to find a way to test all of the Rust snippets in the website in a way that doesn't require all snippets to come from a full-blown cargo project.
Now in the site source we write:
{% rustdoc_test() %} ```rust # extern crate raui; # use raui::prelude::*; let tree = widget! { (content_box) }; {% end %}And then we can run
just website-doc-testsand it will go and test all of the code snippets in the site! The update will be comming in a PR with the next section of the guide once I finish it.It turns out it simple to get rustdoc to test any markdown file you want: