diff options
| author | Dan Gohman <dev@sunfishcode.online> | 2021-02-28 14:07:05 -0800 |
|---|---|---|
| committer | Dan Gohman <dev@sunfishcode.online> | 2021-02-28 14:07:05 -0800 |
| commit | e27eba339772fd9081ed3f20ec18a7e8ab79fefd (patch) | |
| tree | a83c57c090b692999921a37160b3699020787f71 | |
| parent | b89e828c0427f40b2c093c1dc80ee1184a8fd46f (diff) | |
| download | rust-e27eba339772fd9081ed3f20ec18a7e8ab79fefd.tar.gz rust-e27eba339772fd9081ed3f20ec18a7e8ab79fefd.zip | |
Add a test in src/test/rustdoc/doc-cfg.rs
| -rw-r--r-- | src/test/rustdoc/doc-cfg.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/rustdoc/doc-cfg.rs b/src/test/rustdoc/doc-cfg.rs index 51a58378299..89a61a289fd 100644 --- a/src/test/rustdoc/doc-cfg.rs +++ b/src/test/rustdoc/doc-cfg.rs @@ -5,6 +5,8 @@ // @!has - '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' '' // @has - '//*[@id="method.unix_and_arm_only_function"]' 'fn unix_and_arm_only_function()' // @has - '//*[@class="stab portability"]' 'This is supported on Unix and ARM only.' +// @has - '//*[@id="method.wasi_and_wasm32_only_function"]' 'fn wasi_and_wasm32_only_function()' +// @has - '//*[@class="stab portability"]' 'This is supported on WASI and WebAssembly only.' pub struct Portable; // @has doc_cfg/unix_only/index.html \ @@ -37,6 +39,36 @@ pub mod unix_only { } } +// @has doc_cfg/wasi_only/index.html \ +// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \ +// 'This is supported on WASI only.' +// @matches - '//*[@class="module-item"]//*[@class="stab portability"]' '\AWebAssembly\Z' +// @count - '//*[@class="stab portability"]' 2 +#[doc(cfg(target_os = "wasi"))] +pub mod wasi_only { + // @has doc_cfg/wasi_only/fn.wasi_only_function.html \ + // '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \ + // 'This is supported on WASI only.' + // @count - '//*[@class="stab portability"]' 1 + pub fn wasi_only_function() { + content::should::be::irrelevant(); + } + + // @has doc_cfg/wasi_only/trait.Wasm32Only.html \ + // '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \ + // 'This is supported on WASI and WebAssembly only.' + // @count - '//*[@class="stab portability"]' 1 + #[doc(cfg(target_arch = "wasm32"))] + pub trait Wasm32Only { + fn wasi_and_wasm32_only_function(); + } + + #[doc(cfg(target_arch = "wasm32"))] + impl Wasm32Only for super::Portable { + fn wasi_and_wasm32_only_function() {} + } +} + // tagging a function with `#[target_feature]` creates a doc(cfg(target_feature)) node for that // item as well |
