fix rustdoc test directives that were accidentally ignored

replace "// @" with "//@ ", and fix the tests so they actually pass, after directives are checked
This commit is contained in:
Yotam Ofek 2025-02-15 21:12:58 +00:00
parent a3d4bd382a
commit 2c1f48970c
4 changed files with 17 additions and 17 deletions

View file

@ -24,14 +24,14 @@ impl Foo<u32> {
}
impl<T> Bar for Foo<T> {
// @has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' 'type Item = T'
//@ has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' 'type Item = T'
type Item=T;
//@ has - '//*[@id="method.quux"]//h4[@class="code-header"]' 'fn quux(self)'
fn quux(self) {}
}
impl<'a, T> Bar for &'a Foo<T> {
// @has - '//*[@id="associatedtype.Item-1"]//h4[@class="code-header"]' "type Item = &'a T"
//@ has - '//*[@id="associatedtype.Item-1"]//h4[@class="code-header"]' "type Item = &'a T"
type Item=&'a T;
//@ has - '//*[@id="method.quux-1"]//h4[@class="code-header"]' 'fn quux(self)'

View file

@ -1 +1 @@
<li><div class="item-name"><a class="struct" href="struct.CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer.html" title="struct extremely_long_typename::CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer">Create<wbr />Subscription<wbr />Payment<wbr />Settings<wbr />Payment<wbr />Method<wbr />Options<wbr />Customer<wbr />Balance<wbr />Bank<wbr />Transfer<wbr />EuBank<wbr />Transfer</a></div></li>
<dt><a class="struct" href="struct.CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer.html" title="struct extremely_long_typename::CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer">Create<wbr />Subscription<wbr />Payment<wbr />Settings<wbr />Payment<wbr />Method<wbr />Options<wbr />Customer<wbr />Balance<wbr />Bank<wbr />Transfer<wbr />EuBank<wbr />Transfer</a></dt>

View file

@ -3,5 +3,5 @@
// the item table has it line wrapped.
// There should be some reasonably-placed `<wbr>` tags in the snapshot file.
// @snapshot extremely_long_typename "extremely_long_typename/index.html" '//ul[@class="item-table"]/li'
//@ snapshot extremely_long_typename "extremely_long_typename/index.html" '//dl[@class="item-table"]/dt'
pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer;

View file

@ -2,28 +2,28 @@
#![crate_name = "foo"]
// @has 'foo/index.html'
//@ has 'foo/index.html'
// First we check that both the static and the function have a "sup" element
// to tell they're unsafe.
// @count - '//ul[@class="item-table"]//sup[@title="unsafe static"]' 1
// @has - '//ul[@class="item-table"]//sup[@title="unsafe static"]' '⚠'
// @count - '//ul[@class="item-table"]//sup[@title="unsafe function"]' 1
// @has - '//ul[@class="item-table"]//sup[@title="unsafe function"]' '⚠'
//@ count - '//dl[@class="item-table"]//sup[@title="unsafe static"]' 1
//@ has - '//dl[@class="item-table"]//sup[@title="unsafe static"]' '⚠'
//@ count - '//dl[@class="item-table"]//sup[@title="unsafe function"]' 1
//@ has - '//dl[@class="item-table"]//sup[@title="unsafe function"]' '⚠'
unsafe extern "C" {
// @has 'foo/static.FOO.html'
// @has - '//pre[@class="rust item-decl"]' 'pub static FOO: i32'
//@ has 'foo/static.FOO.html'
//@ has - '//pre[@class="rust item-decl"]' 'pub static FOO: i32'
pub safe static FOO: i32;
// @has 'foo/static.BAR.html'
// @has - '//pre[@class="rust item-decl"]' 'pub unsafe static BAR: i32'
//@ has 'foo/static.BAR.html'
//@ has - '//pre[@class="rust item-decl"]' 'pub unsafe static BAR: i32'
pub static BAR: i32;
// @has 'foo/fn.foo.html'
// @has - '//pre[@class="rust item-decl"]' 'pub extern "C" fn foo()'
//@ has 'foo/fn.foo.html'
//@ has - '//pre[@class="rust item-decl"]' 'pub extern "C" fn foo()'
pub safe fn foo();
// @has 'foo/fn.bar.html'
// @has - '//pre[@class="rust item-decl"]' 'pub unsafe extern "C" fn bar()'
//@ has 'foo/fn.bar.html'
//@ has - '//pre[@class="rust item-decl"]' 'pub unsafe extern "C" fn bar()'
pub fn bar();
}