Skip to content

Commit eec3c3d

Browse files
Add GUI test for trait bounds display
1 parent 590c01a commit eec3c3d

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

tests/rustdoc-gui/src/test_docs/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -614,3 +614,9 @@ pub mod private {
614614
B,
615615
}
616616
}
617+
618+
pub mod trait_bounds {
619+
pub trait OneBound: Sized {}
620+
pub trait TwoBounds: Sized + Copy {}
621+
pub trait ThreeBounds: Sized + Copy + Eq {}
622+
}
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Check that if a trait has more than 2 bounds, they are displayed on different lines.
2+
3+
// It tries to load a JS for each trait but there are none since they're not implemented.
4+
fail-on-request-error: false
5+
go-to: "file://" + |DOC_PATH| + "/test_docs/trait_bounds/trait.OneBound.html"
6+
// They should have the same Y position.
7+
compare-elements-position: (
8+
".item-decl code",
9+
".item-decl a.trait[title='trait core::marker::Sized']",
10+
["y"],
11+
)
12+
go-to: "file://" + |DOC_PATH| + "/test_docs/trait_bounds/trait.TwoBounds.html"
13+
// They should have the same Y position.
14+
compare-elements-position: (
15+
".item-decl code",
16+
".item-decl a.trait[title='trait core::marker::Copy']",
17+
["y"],
18+
)
19+
go-to: "file://" + |DOC_PATH| + "/test_docs/trait_bounds/trait.ThreeBounds.html"
20+
// All on their own line.
21+
compare-elements-position-false: (
22+
".item-decl code",
23+
".item-decl a.trait[title='trait core::marker::Sized']",
24+
["y"],
25+
)
26+
compare-elements-position-false: (
27+
".item-decl a.trait[title='trait core::marker::Sized']",
28+
".item-decl a.trait[title='trait core::marker::Copy']",
29+
["y"],
30+
)
31+
compare-elements-position-false: (
32+
".item-decl a.trait[title='trait core::marker::Copy']",
33+
".item-decl a.trait[title='trait core::cmp::Eq']",
34+
["y"],
35+
)

0 commit comments

Comments
 (0)