diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2025-02-13 16:42:09 +0100 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2025-04-02 08:44:37 -0700 |
| commit | bf8d4927238a40dc0dca584e91988f456a970bbb (patch) | |
| tree | 742a1e206d52a8c542208a2b706e4f5e6d300e20 /docs/markdown/Rust-module.md | |
| parent | 00dc6fa4dfee880a3c3c17f658e6d0b98a93bab6 (diff) | |
| download | meson-bf8d4927238a40dc0dca584e91988f456a970bbb.tar.gz | |
rust: add rust.doctest
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'docs/markdown/Rust-module.md')
| -rw-r--r-- | docs/markdown/Rust-module.md | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/docs/markdown/Rust-module.md b/docs/markdown/Rust-module.md index ee095e9d6..6e8202a6f 100644 --- a/docs/markdown/Rust-module.md +++ b/docs/markdown/Rust-module.md @@ -24,6 +24,8 @@ like Meson, rather than Meson work more like rust. rustmod.test(name, target, ...) ``` +*Since 1.8.0* + This function creates a new rust unittest target from an existing rust based target, which may be a library or executable. It does this by copying the sources and arguments passed to the original target and @@ -41,6 +43,31 @@ It also takes the following keyword arguments: This function also accepts all of the keyword arguments accepted by the [[test]] function except `protocol`, it will set that automatically. +### doctest() + +```meson +rustmod.doctest(name, target, ...) +``` + +This function creates a new `test()` target from an existing rust +based library target. The test will use `rustdoc` to extract and run +the doctests that are included in `target`'s sources. + +This function takes two positional arguments, the first is the name of the +test and the second is the library or executable that is the rust based target. +It also takes the following keyword arguments: + +- `dependencies`: a list of test-only Dependencies +- `link_with`: a list of additional build Targets to link with +- `rust_args`: a list of extra arguments passed to the Rust compiler + +The target is linked automatically into the doctests. + +This function also accepts all of the keyword arguments accepted by the +[[test]] function except `protocol`, it will set that automatically. +However, arguments are limited to strings that do not contain spaces +due to limitations of `rustdoc`. + ### bindgen() This function wraps bindgen to simplify creating rust bindings around C |
