Skip to content

Commit 1b67035

Browse files
Update tests/rustdoc to new test syntax
1 parent d3ec92e commit 1b67035

File tree

627 files changed

+4378
-4378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

627 files changed

+4378
-4378
lines changed

tests/rustdoc/alias-reexport.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77

88
extern crate alias_reexport2;
99

10-
// @has 'foo/reexport/fn.foo.html'
11-
// @has - '//*[@class="rust item-decl"]' 'pub fn foo() -> Reexported'
12-
// @has 'foo/reexport/fn.foo2.html'
13-
// @has - '//*[@class="rust item-decl"]' 'pub fn foo2() -> Result<Reexported, ()>'
14-
// @has 'foo/reexport/type.Reexported.html'
15-
// @has - '//*[@class="rust item-decl"]' 'pub type Reexported = u8;'
10+
//@ has 'foo/reexport/fn.foo.html'
11+
//@ has - '//*[@class="rust item-decl"]' 'pub fn foo() -> Reexported'
12+
//@ has 'foo/reexport/fn.foo2.html'
13+
//@ has - '//*[@class="rust item-decl"]' 'pub fn foo2() -> Result<Reexported, ()>'
14+
//@ has 'foo/reexport/type.Reexported.html'
15+
//@ has - '//*[@class="rust item-decl"]' 'pub type Reexported = u8;'
1616
#[doc(inline)]
1717
pub use alias_reexport2 as reexport;

tests/rustdoc/alias-reexport2.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ extern crate alias_reexport;
99

1010
use alias_reexport::Reexported;
1111

12-
// @has 'foo/fn.foo.html'
13-
// @has - '//*[@class="rust item-decl"]' 'pub fn foo() -> Reexported'
12+
//@ has 'foo/fn.foo.html'
13+
//@ has - '//*[@class="rust item-decl"]' 'pub fn foo() -> Reexported'
1414
pub fn foo() -> Reexported { 0 }
15-
// @has 'foo/fn.foo2.html'
16-
// @has - '//*[@class="rust item-decl"]' 'pub fn foo2() -> Result<Reexported, ()>'
15+
//@ has 'foo/fn.foo2.html'
16+
//@ has - '//*[@class="rust item-decl"]' 'pub fn foo2() -> Result<Reexported, ()>'
1717
pub fn foo2() -> Result<Reexported, ()> { Ok(0) }

tests/rustdoc/all.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#![crate_name = "foo"]
22

3-
// @has foo/all.html '//a[@href="struct.Struct.html"]' 'Struct'
4-
// @has foo/all.html '//a[@href="enum.Enum.html"]' 'Enum'
5-
// @has foo/all.html '//a[@href="union.Union.html"]' 'Union'
6-
// @has foo/all.html '//a[@href="constant.CONST.html"]' 'CONST'
7-
// @has foo/all.html '//a[@href="static.STATIC.html"]' 'STATIC'
8-
// @has foo/all.html '//a[@href="fn.function.html"]' 'function'
3+
//@ has foo/all.html '//a[@href="struct.Struct.html"]' 'Struct'
4+
//@ has foo/all.html '//a[@href="enum.Enum.html"]' 'Enum'
5+
//@ has foo/all.html '//a[@href="union.Union.html"]' 'Union'
6+
//@ has foo/all.html '//a[@href="constant.CONST.html"]' 'CONST'
7+
//@ has foo/all.html '//a[@href="static.STATIC.html"]' 'STATIC'
8+
//@ has foo/all.html '//a[@href="fn.function.html"]' 'function'
99

1010
pub struct Struct;
1111
pub enum Enum {
@@ -23,6 +23,6 @@ mod private_module {
2323
pub struct ReexportedStruct;
2424
}
2525

26-
// @has foo/all.html '//a[@href="struct.ReexportedStruct.html"]' 'ReexportedStruct'
27-
// @!hasraw foo/all.html 'private_module'
26+
//@ has foo/all.html '//a[@href="struct.ReexportedStruct.html"]' 'ReexportedStruct'
27+
//@ !hasraw foo/all.html 'private_module'
2828
pub use private_module::ReexportedStruct;
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// https://github.com/rust-lang/rust/issues/25001
22
#![crate_name="issue_25001"]
33

4-
// @has issue_25001/struct.Foo.html
4+
//@ has issue_25001/struct.Foo.html
55
pub struct Foo<T>(T);
66

77
pub trait Bar {
@@ -11,36 +11,36 @@ pub trait Bar {
1111
}
1212

1313
impl Foo<u8> {
14-
// @has - '//*[@id="method.pass"]//h4[@class="code-header"]' 'fn pass()'
14+
//@ has - '//*[@id="method.pass"]//h4[@class="code-header"]' 'fn pass()'
1515
pub fn pass() {}
1616
}
1717
impl Foo<u16> {
18-
// @has - '//*[@id="method.pass-1"]//h4[@class="code-header"]' 'fn pass() -> usize'
18+
//@ has - '//*[@id="method.pass-1"]//h4[@class="code-header"]' 'fn pass() -> usize'
1919
pub fn pass() -> usize { 42 }
2020
}
2121
impl Foo<u32> {
22-
// @has - '//*[@id="method.pass-2"]//h4[@class="code-header"]' 'fn pass() -> isize'
22+
//@ has - '//*[@id="method.pass-2"]//h4[@class="code-header"]' 'fn pass() -> isize'
2323
pub fn pass() -> isize { 42 }
2424
}
2525

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

30-
// @has - '//*[@id="method.quux"]//h4[@class="code-header"]' 'fn quux(self)'
30+
//@ 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"]//h4[@class="code-header"]' "type Item = &'a T"
34+
//@ has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' "type Item = &'a T"
3535
type Item=&'a T;
3636

37-
// @has - '//*[@id="method.quux-1"]//h4[@class="code-header"]' 'fn quux(self)'
37+
//@ has - '//*[@id="method.quux-1"]//h4[@class="code-header"]' 'fn quux(self)'
3838
fn quux(self) {}
3939
}
4040
impl<'a, T> Bar for &'a mut Foo<T> {
41-
// @has - '//*[@id="associatedtype.Item-2"]//h4[@class="code-header"]' "type Item = &'a mut T"
41+
//@ has - '//*[@id="associatedtype.Item-2"]//h4[@class="code-header"]' "type Item = &'a mut T"
4242
type Item=&'a mut T;
4343

44-
// @has - '//*[@id="method.quux-2"]//h4[@class="code-header"]' 'fn quux(self)'
44+
//@ has - '//*[@id="method.quux-2"]//h4[@class="code-header"]' 'fn quux(self)'
4545
fn quux(self) {}
4646
}

tests/rustdoc/anchor-id-trait-method-15169.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @has issue_15169/struct.Foo.html '//*[@id="method.eq"]' 'fn eq'
1+
//@ has issue_15169/struct.Foo.html '//*[@id="method.eq"]' 'fn eq'
22

33
// https://github.com/rust-lang/rust/issues/15169
44
#![crate_name="issue_15169"]

tests/rustdoc/anchor-id-trait-tymethod-28478.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,32 @@
33

44
#![feature(associated_type_defaults)]
55

6-
// @has issue_28478/trait.Bar.html
6+
//@ has issue_28478/trait.Bar.html
77
pub trait Bar {
8-
// @has - '//*[@id="associatedtype.Bar"]' 'type Bar = ()'
9-
// @has - '//*[@href="#associatedtype.Bar"]' 'Bar'
8+
//@ has - '//*[@id="associatedtype.Bar"]' 'type Bar = ()'
9+
//@ has - '//*[@href="#associatedtype.Bar"]' 'Bar'
1010
type Bar = ();
11-
// @has - '//*[@id="associatedconstant.Baz"]' 'const Baz: usize'
12-
// @has - '//*[@href="#associatedconstant.Baz"]' 'Baz'
11+
//@ has - '//*[@id="associatedconstant.Baz"]' 'const Baz: usize'
12+
//@ has - '//*[@href="#associatedconstant.Baz"]' 'Baz'
1313
const Baz: usize = 7;
14-
// @has - '//*[@id="tymethod.bar"]' 'fn bar'
14+
//@ has - '//*[@id="tymethod.bar"]' 'fn bar'
1515
fn bar();
16-
// @has - '//*[@id="method.baz"]' 'fn baz'
16+
//@ has - '//*[@id="method.baz"]' 'fn baz'
1717
fn baz() { }
1818
}
1919

20-
// @has issue_28478/struct.Foo.html
20+
//@ has issue_28478/struct.Foo.html
2121
pub struct Foo;
2222

2323
impl Foo {
24-
// @has - '//*[@href="#method.foo"]' 'foo'
24+
//@ has - '//*[@href="#method.foo"]' 'foo'
2525
pub fn foo() {}
2626
}
2727

2828
impl Bar for Foo {
29-
// @has - '//*[@href="trait.Bar.html#associatedtype.Bar"]' 'Bar'
30-
// @has - '//*[@href="trait.Bar.html#associatedconstant.Baz"]' 'Baz'
31-
// @has - '//*[@href="trait.Bar.html#tymethod.bar"]' 'bar'
29+
//@ has - '//*[@href="trait.Bar.html#associatedtype.Bar"]' 'Bar'
30+
//@ has - '//*[@href="trait.Bar.html#associatedconstant.Baz"]' 'Baz'
31+
//@ has - '//*[@href="trait.Bar.html#tymethod.bar"]' 'bar'
3232
fn bar() {}
33-
// @has - '//*[@href="trait.Bar.html#method.baz"]' 'baz'
33+
//@ has - '//*[@href="trait.Bar.html#method.baz"]' 'baz'
3434
}

tests/rustdoc/anchors.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,44 @@
66

77
pub struct Foo;
88

9-
// @has 'foo/trait.Bar.html'
9+
//@ has 'foo/trait.Bar.html'
1010
pub trait Bar {
1111
// There should be no anchors here.
12-
// @snapshot no_type_anchor - '//*[@id="associatedtype.T"]'
12+
//@ snapshot no_type_anchor - '//*[@id="associatedtype.T"]'
1313
type T;
1414
// There should be no anchors here.
15-
// @snapshot no_const_anchor - '//*[@id="associatedconstant.YOLO"]'
15+
//@ snapshot no_const_anchor - '//*[@id="associatedconstant.YOLO"]'
1616
const YOLO: u32;
1717

1818
// There should be no anchors here.
19-
// @snapshot no_tymethod_anchor - '//*[@id="tymethod.foo"]'
19+
//@ snapshot no_tymethod_anchor - '//*[@id="tymethod.foo"]'
2020
fn foo();
2121
// There should be no anchors here.
22-
// @snapshot no_trait_method_anchor - '//*[@id="method.bar"]'
22+
//@ snapshot no_trait_method_anchor - '//*[@id="method.bar"]'
2323
fn bar() {}
2424
}
2525

26-
// @has 'foo/struct.Foo.html'
26+
//@ has 'foo/struct.Foo.html'
2727
impl Bar for Foo {
28-
// @has - '//*[@id="associatedtype.T"]/a[@class="anchor"]' ''
28+
//@ has - '//*[@id="associatedtype.T"]/a[@class="anchor"]' ''
2929
type T = u32;
30-
// @has - '//*[@id="associatedconstant.YOLO"]/a[@class="anchor"]' ''
30+
//@ has - '//*[@id="associatedconstant.YOLO"]/a[@class="anchor"]' ''
3131
const YOLO: u32 = 0;
3232

33-
// @has - '//*[@id="method.foo"]/a[@class="anchor"]' ''
33+
//@ has - '//*[@id="method.foo"]/a[@class="anchor"]' ''
3434
fn foo() {}
3535
// Same check for provided "bar" method.
36-
// @has - '//*[@id="method.bar"]/a[@class="anchor"]' ''
36+
//@ has - '//*[@id="method.bar"]/a[@class="anchor"]' ''
3737
}
3838

3939
impl Foo {
40-
// @snapshot no_const_anchor2 - '//*[@id="associatedconstant.X"]'
40+
//@ snapshot no_const_anchor2 - '//*[@id="associatedconstant.X"]'
4141
// There should be no anchors here.
4242
pub const X: i32 = 0;
43-
// @snapshot no_type_anchor2 - '//*[@id="associatedtype.Y"]'
43+
//@ snapshot no_type_anchor2 - '//*[@id="associatedtype.Y"]'
4444
// There should be no anchors here.
4545
pub type Y = u32;
46-
// @snapshot no_method_anchor - '//*[@id="method.new"]'
46+
//@ snapshot no_method_anchor - '//*[@id="method.new"]'
4747
// There should be no anchors here.
4848
pub fn new() -> Self { Self }
4949
}

tests/rustdoc/anonymous-lifetime.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ pub trait Stream {
1111
fn size_hint(&self) -> (usize, Option<usize>);
1212
}
1313

14-
// @has 'foo/trait.Stream.html'
15-
// @has - '//*[@class="code-header"]' 'impl<S: ?Sized + Stream + Unpin> Stream for &mut S'
14+
//@ has 'foo/trait.Stream.html'
15+
//@ has - '//*[@class="code-header"]' 'impl<S: ?Sized + Stream + Unpin> Stream for &mut S'
1616
impl<S: ?Sized + Stream + Unpin> Stream for &mut S {
1717
type Item = S::Item;
1818

tests/rustdoc/anonymous-reexport.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
// This test ensures we don't display anonymous (non-inline) re-exports of public items.
44

5-
// @has 'foo/index.html'
6-
// @has - '//*[@id="main-content"]' ''
5+
//@ has 'foo/index.html'
6+
//@ has - '//*[@id="main-content"]' ''
77
// We check that the only "h2" present are "Structs" (for "Bla") and "Re-exports".
8-
// @count - '//*[@id="main-content"]/h2' 2
9-
// @has - '//*[@id="main-content"]/h2' 'Structs'
10-
// @has - '//*[@id="main-content"]/h2' 'Re-exports'
8+
//@ count - '//*[@id="main-content"]/h2' 2
9+
//@ has - '//*[@id="main-content"]/h2' 'Structs'
10+
//@ has - '//*[@id="main-content"]/h2' 'Re-exports'
1111
// The 3 re-exports.
12-
// @count - '//*[@id="main-content"]//*[@class="item-table"]//li//code' 3
12+
//@ count - '//*[@id="main-content"]//*[@class="item-table"]//li//code' 3
1313
// The public struct.
14-
// @count - '//*[@id="main-content"]//a[@class="struct"]' 1
14+
//@ count - '//*[@id="main-content"]//a[@class="struct"]' 1
1515

1616
mod ext {
1717
pub trait Foo {}

tests/rustdoc/array-links.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@
33

44
pub struct MyBox<T: ?Sized>(*const T);
55

6-
// @has 'foo/fn.alpha.html'
7-
// @snapshot link_slice_u32 - '//pre[@class="rust item-decl"]/code'
6+
//@ has 'foo/fn.alpha.html'
7+
//@ snapshot link_slice_u32 - '//pre[@class="rust item-decl"]/code'
88
pub fn alpha() -> &'static [u32; 1] {
99
loop {}
1010
}
1111

12-
// @has 'foo/fn.beta.html'
13-
// @snapshot link_slice_generic - '//pre[@class="rust item-decl"]/code'
12+
//@ has 'foo/fn.beta.html'
13+
//@ snapshot link_slice_generic - '//pre[@class="rust item-decl"]/code'
1414
pub fn beta<T>() -> &'static [T; 1] {
1515
loop {}
1616
}
1717

18-
// @has 'foo/fn.gamma.html'
19-
// @snapshot link_box_u32 - '//pre[@class="rust item-decl"]/code'
18+
//@ has 'foo/fn.gamma.html'
19+
//@ snapshot link_box_u32 - '//pre[@class="rust item-decl"]/code'
2020
pub fn gamma() -> MyBox<[u32; 1]> {
2121
loop {}
2222
}
2323

24-
// @has 'foo/fn.delta.html'
25-
// @snapshot link_box_generic - '//pre[@class="rust item-decl"]/code'
24+
//@ has 'foo/fn.delta.html'
25+
//@ snapshot link_box_generic - '//pre[@class="rust item-decl"]/code'
2626
pub fn delta<T>() -> MyBox<[T; 1]> {
2727
loop {}
2828
}

tests/rustdoc/asm-foreign.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use std::arch::asm;
44

5-
// @has asm_foreign/fn.aarch64.html
5+
//@ has asm_foreign/fn.aarch64.html
66
pub unsafe fn aarch64(a: f64, b: f64) -> f64 {
77
let c;
88
asm!("add {:d}, {:d}, d0", out(vreg) c, in(vreg) a, in("d0") {
@@ -12,7 +12,7 @@ pub unsafe fn aarch64(a: f64, b: f64) -> f64 {
1212
c
1313
}
1414

15-
// @has asm_foreign/fn.x86.html
15+
//@ has asm_foreign/fn.x86.html
1616
pub unsafe fn x86(a: f64, b: f64) -> f64 {
1717
let c;
1818
asm!("addsd {}, {}, xmm0", out(xmm_reg) c, in(xmm_reg) a, in("xmm0") b);

tests/rustdoc/asm-foreign2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
use std::arch::asm;
55

6-
// @has asm_foreign2/fn.x86.html
6+
//@ has asm_foreign2/fn.x86.html
77
pub unsafe fn x86(x: i64) -> i64 {
88
let y;
99
asm!("movq {}, {}", in(reg) x, out(reg) y, options(att_syntax));

tests/rustdoc/asref-for-and-of-local-82465.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
use std::convert::AsRef;
55
pub struct Local;
66

7-
// @has foo/struct.Local.html '//h3[@class="code-header"]' 'impl AsRef<str> for Local'
7+
//@ has foo/struct.Local.html '//h3[@class="code-header"]' 'impl AsRef<str> for Local'
88
impl AsRef<str> for Local {
99
fn as_ref(&self) -> &str {
1010
todo!()
1111
}
1212
}
1313

14-
// @has - '//h3[@class="code-header"]' 'impl AsRef<Local> for str'
14+
//@ has - '//h3[@class="code-header"]' 'impl AsRef<Local> for str'
1515
impl AsRef<Local> for str {
1616
fn as_ref(&self) -> &Local {
1717
todo!()

tests/rustdoc/assoc-consts-version.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
pub struct SomeStruct;
99

1010
impl SomeStruct {
11-
// @has 'foo/struct.SomeStruct.html' \
11+
//@ has 'foo/struct.SomeStruct.html' \
1212
// '//*[@id="associatedconstant.SOME_CONST"]//span[@class="since"]' '1.1.2'
1313
#[stable(since="1.1.2", feature="rust2")]
1414
pub const SOME_CONST: usize = 0;

0 commit comments

Comments
 (0)