Skip to content

[SOLVED] Documentation & Testing Tools #44

Answered by zicklag
zicklag asked this question in Q&A
Discussion options

You must be logged in to vote

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-tests and 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:

cargo build --features all -p raui
for file in $(find site/content/ -name '*.md'); do \
    echo "Testing: 

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@PsichiX
Comment options

Comment options

You must be logged in to vote
1 reply
@PsichiX
Comment options

Answer selected by zicklag
Comment options

You must be logged in to vote
1 reply
@zicklag
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants