Skip to content

Commit 5f35f78

Browse files
authored
Rollup merge of #137099 - yotamofek:pr/rustdoc/fix-ignored-test-directives, r=fmease
Fix rustdoc test directives that were accidentally ignored 🧐 Replace "// `@"` with "//@ ", and fix the tests so they actually pass, after directives are checked. ~~Only the first commit is mandatory, other two are small drive-bys.~~
2 parents 2c6fa32 + 2c1f489 commit 5f35f78

4 files changed

+17
-17
lines changed

tests/rustdoc/anchor-id-duplicate-method-name-25001.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ impl Foo<u32> {
2424
}
2525

2626
impl<T> Bar for Foo<T> {
27-
// @has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' 'type Item = T'
27+
//@ has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' 'type Item = T'
2828
type Item=T;
2929

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

3737
//@ has - '//*[@id="method.quux-1"]//h4[@class="code-header"]' 'fn quux(self)'
Original file line numberDiff line numberDiff line change
@@ -1 +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>
1+
<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>

tests/rustdoc/extremely_long_typename.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
// the item table has it line wrapped.
44
// There should be some reasonably-placed `<wbr>` tags in the snapshot file.
55

6-
// @snapshot extremely_long_typename "extremely_long_typename/index.html" '//ul[@class="item-table"]/li'
6+
//@ snapshot extremely_long_typename "extremely_long_typename/index.html" '//dl[@class="item-table"]/dt'
77
pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer;

tests/rustdoc/unsafe-extern-blocks.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@
22

33
#![crate_name = "foo"]
44

5-
// @has 'foo/index.html'
5+
//@ has 'foo/index.html'
66

77
// First we check that both the static and the function have a "sup" element
88
// to tell they're unsafe.
99

10-
// @count - '//ul[@class="item-table"]//sup[@title="unsafe static"]' 1
11-
// @has - '//ul[@class="item-table"]//sup[@title="unsafe static"]' '⚠'
12-
// @count - '//ul[@class="item-table"]//sup[@title="unsafe function"]' 1
13-
// @has - '//ul[@class="item-table"]//sup[@title="unsafe function"]' '⚠'
10+
//@ count - '//dl[@class="item-table"]//sup[@title="unsafe static"]' 1
11+
//@ has - '//dl[@class="item-table"]//sup[@title="unsafe static"]' '⚠'
12+
//@ count - '//dl[@class="item-table"]//sup[@title="unsafe function"]' 1
13+
//@ has - '//dl[@class="item-table"]//sup[@title="unsafe function"]' '⚠'
1414

1515
unsafe extern "C" {
16-
// @has 'foo/static.FOO.html'
17-
// @has - '//pre[@class="rust item-decl"]' 'pub static FOO: i32'
16+
//@ has 'foo/static.FOO.html'
17+
//@ has - '//pre[@class="rust item-decl"]' 'pub static FOO: i32'
1818
pub safe static FOO: i32;
19-
// @has 'foo/static.BAR.html'
20-
// @has - '//pre[@class="rust item-decl"]' 'pub unsafe static BAR: i32'
19+
//@ has 'foo/static.BAR.html'
20+
//@ has - '//pre[@class="rust item-decl"]' 'pub unsafe static BAR: i32'
2121
pub static BAR: i32;
2222

23-
// @has 'foo/fn.foo.html'
24-
// @has - '//pre[@class="rust item-decl"]' 'pub extern "C" fn foo()'
23+
//@ has 'foo/fn.foo.html'
24+
//@ has - '//pre[@class="rust item-decl"]' 'pub extern "C" fn foo()'
2525
pub safe fn foo();
26-
// @has 'foo/fn.bar.html'
27-
// @has - '//pre[@class="rust item-decl"]' 'pub unsafe extern "C" fn bar()'
26+
//@ has 'foo/fn.bar.html'
27+
//@ has - '//pre[@class="rust item-decl"]' 'pub unsafe extern "C" fn bar()'
2828
pub fn bar();
2929
}

0 commit comments

Comments
 (0)