|
| 1 | +// This test ensures that using `auto_cfg(show(key))` works correctly. |
| 2 | + |
| 3 | +#![feature(doc_cfg)] |
| 4 | +#![crate_name = "foo"] |
| 5 | + |
| 6 | +#![doc(auto_cfg(hide(meow)))] |
| 7 | +#![doc(auto_cfg(hide(meow, values("lol"))))] |
| 8 | + |
| 9 | +//@ has foo/fn.foo.html |
| 10 | +//@ has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-blob' |
| 11 | +//@ !has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-meow' |
| 12 | +#[cfg(not(meow))] |
| 13 | +#[cfg(not(blob))] |
| 14 | +pub fn foo() {} |
| 15 | + |
| 16 | +//@ has foo/fn.bar.html |
| 17 | +//@ has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-blob=lol' |
| 18 | +//@ !has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-meow=lol' |
| 19 | +#[cfg(not(meow = "lol"))] |
| 20 | +#[cfg(not(blob = "lol"))] |
| 21 | +pub fn bar() {} |
| 22 | + |
| 23 | +//@ has foo/fn.babar.html |
| 24 | +//@ has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-blob=lola' |
| 25 | +//@ has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-meow=lola' |
| 26 | +#[cfg(not(meow = "lola"))] |
| 27 | +#[cfg(not(blob = "lola"))] |
| 28 | +pub fn babar() {} |
| 29 | + |
| 30 | +pub mod sub { |
| 31 | + // We show again `meow`, however `meow="lol"` should still be hidden. |
| 32 | + #![doc(auto_cfg(show(meow)))] |
| 33 | + |
| 34 | + //@ has foo/sub/fn.foo.html |
| 35 | + //@ has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-blob' |
| 36 | + //@ has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-meow' |
| 37 | + #[cfg(not(meow))] |
| 38 | + #[cfg(not(blob))] |
| 39 | + pub fn foo() {} |
| 40 | + |
| 41 | + //@ has foo/sub/fn.bar.html |
| 42 | + //@ has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-blob=lol' |
| 43 | + //@ !has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-meow=lol' |
| 44 | + #[cfg(not(meow = "lol"))] |
| 45 | + #[cfg(not(blob = "lol"))] |
| 46 | + pub fn bar() {} |
| 47 | + |
| 48 | + //@ has foo/sub/fn.babar.html |
| 49 | + //@ has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-blob=lola' |
| 50 | + //@ has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-meow=lola' |
| 51 | + #[cfg(not(meow = "lola"))] |
| 52 | + #[cfg(not(blob = "lola"))] |
| 53 | + pub fn babar() {} |
| 54 | +} |
| 55 | + |
| 56 | +pub mod sub2 { |
| 57 | + // We show again `meow = "lol`, however `meow` should still be hidden. |
| 58 | + #![doc(auto_cfg(show(meow, values("lol"))))] |
| 59 | + |
| 60 | + //@ has foo/sub2/fn.foo.html |
| 61 | + //@ has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-blob' |
| 62 | + //@ !has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-meow' |
| 63 | + #[cfg(not(meow))] |
| 64 | + #[cfg(not(blob))] |
| 65 | + pub fn foo() {} |
| 66 | + |
| 67 | + //@ has foo/sub2/fn.bar.html |
| 68 | + //@ has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-blob=lol' |
| 69 | + //@ has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-meow=lol' |
| 70 | + #[cfg(not(meow = "lol"))] |
| 71 | + #[cfg(not(blob = "lol"))] |
| 72 | + pub fn bar() {} |
| 73 | + |
| 74 | + //@ has foo/sub2/fn.babar.html |
| 75 | + //@ has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-blob=lola' |
| 76 | + //@ has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-meow=lola' |
| 77 | + #[cfg(not(meow = "lola"))] |
| 78 | + #[cfg(not(blob = "lola"))] |
| 79 | + pub fn babar() {} |
| 80 | +} |
| 81 | + |
| 82 | +pub mod sub3 { |
| 83 | + // We show again `meow = "lol`, but by using `any()` this time. |
| 84 | + #![doc(auto_cfg(show(meow, values(any()))))] |
| 85 | + |
| 86 | + //@ has foo/sub3/fn.foo.html |
| 87 | + //@ has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-blob' |
| 88 | + //@ !has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-meow' |
| 89 | + #[cfg(not(meow))] |
| 90 | + #[cfg(not(blob))] |
| 91 | + pub fn foo() {} |
| 92 | + |
| 93 | + //@ has foo/sub3/fn.bar.html |
| 94 | + //@ has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-blob=lol' |
| 95 | + //@ has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-meow=lol' |
| 96 | + #[cfg(not(meow = "lol"))] |
| 97 | + #[cfg(not(blob = "lol"))] |
| 98 | + pub fn bar() {} |
| 99 | + |
| 100 | + //@ has foo/sub3/fn.babar.html |
| 101 | + //@ has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-blob=lola' |
| 102 | + //@ has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-meow=lola' |
| 103 | + #[cfg(not(meow = "lola"))] |
| 104 | + #[cfg(not(blob = "lola"))] |
| 105 | + pub fn babar() {} |
| 106 | +} |
0 commit comments