rustdoc will run the Rust doctests. Those latters use rutie-test
which defines the test_ruby! macro. This macro runs the code of the
doctest inside the Ruby VM.
rustdoc will generate in HTML a code block that only contains:
true
but it will generate a test that will contain:
fn main() {
rutie_test::test_ruby!("true");
}
And this Ruby code (here, true), will be evaluated inside the Ruby
VM.
It's a very naive solution. The path to rutie is hardcoded for
example, and RbConfig is not found, so I had to hardcode it
myself. It's very likely to break in the future, but for the moment,
it works and it allows us to deliver a correct documentation with
correct examples to our users.
rustdoc
will run the Rust doctests. Those latters userutie-test
which defines thetest_ruby!
macro. This macro runs the code of the doctest inside the Ruby VM.So for example, when one writes:
rustdoc
will generate in HTML a code block that only contains:but it will generate a test that will contain:
And this Ruby code (here,
true
), will be evaluated inside the Ruby VM.It's a very naive solution. The path to
rutie
is hardcoded for example, andRbConfig
is not found, so I had to hardcode it myself. It's very likely to break in the future, but for the moment, it works and it allows us to deliver a correct documentation with correct examples to our users.