Add GUI test to ensure that negative impls are correctly sorted
This commit is contained in:
parent
450916305f
commit
985178dacf
3 changed files with 45 additions and 10 deletions
|
|
@ -2,18 +2,45 @@
|
|||
// have the same display than the "local" ones.
|
||||
go-to: "file://" + |DOC_PATH| + "/implementors/trait.Whatever.html"
|
||||
assert: "#implementors-list"
|
||||
// There are supposed to be two implementors listed.
|
||||
assert-count: ("#implementors-list .impl", 2)
|
||||
// There are supposed to be four implementors listed.
|
||||
assert-count: ("#implementors-list .impl", 4)
|
||||
// There are supposed to be two non-negative implementors.
|
||||
assert-count: ("#implementors-list .negative-marker ~ *", 2)
|
||||
// Now we check that both implementors have an anchor, an ID and a similar DOM.
|
||||
assert: ("#implementors-list .impl:nth-child(1) > a.anchor")
|
||||
assert-attribute: ("#implementors-list .impl:nth-child(1)", {"id": "impl-Whatever-for-Struct"})
|
||||
assert-attribute: ("#implementors-list .impl:nth-child(1) > a.anchor", {"href": "#impl-Whatever-for-Struct"})
|
||||
assert: "#implementors-list .impl:nth-child(1) > .code-header"
|
||||
define-function: (
|
||||
"check-dom",
|
||||
[id],
|
||||
block {
|
||||
assert-attribute: (|id| + " > a.anchor", {"href": |id|})
|
||||
assert: |id| + " > .code-header"
|
||||
},
|
||||
)
|
||||
|
||||
assert: ("#implementors-list .impl:nth-child(2) > a.anchor")
|
||||
assert-attribute: ("#implementors-list .impl:nth-child(2)", {"id": "impl-Whatever-1"})
|
||||
assert-attribute: ("#implementors-list .impl:nth-child(2) > a.anchor", {"href": "#impl-Whatever-1"})
|
||||
assert: "#implementors-list .impl:nth-child(2) > .code-header"
|
||||
call-function: ("check-dom", {"id": "#impl-Whatever-for-Struct2"})
|
||||
call-function: ("check-dom", {"id": "#impl-Whatever-2"})
|
||||
call-function: ("check-dom", {"id": "#impl-Whatever-for-Struct"})
|
||||
call-function: ("check-dom", {"id": "#impl-Whatever-3"})
|
||||
|
||||
// Ensure that negative impl are sorted first.
|
||||
assert-property: (
|
||||
"#implementors-list > *:nth-child(1) > h3",
|
||||
{"textContent": "impl !Whatever for Struct2"},
|
||||
)
|
||||
assert-property: (
|
||||
"#implementors-list > *:nth-child(2) > h3",
|
||||
{"textContent": "impl !Whatever for StructToImplOnReexport"},
|
||||
)
|
||||
// Third one is the negative marker.
|
||||
assert-attribute: ("#implementors-list > *:nth-child(3)", {"class": "negative-marker"})
|
||||
// This one is a `<detail>` so the selector is a bit different.
|
||||
assert-property: (
|
||||
"#implementors-list > *:nth-child(4) section > h3",
|
||||
{"textContent": "impl Whatever for Struct"},
|
||||
)
|
||||
assert-property: (
|
||||
"#implementors-list > *:nth-child(5) > h3",
|
||||
{"textContent": "impl Whatever for Foo"},
|
||||
)
|
||||
|
||||
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HasEmptyTraits.html"
|
||||
compare-elements-position-near-false: (
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![feature(negative_impls)]
|
||||
|
||||
pub trait Whatever {
|
||||
type Foo;
|
||||
|
||||
|
|
@ -5,11 +7,14 @@ pub trait Whatever {
|
|||
}
|
||||
|
||||
pub struct Struct;
|
||||
pub struct Struct2;
|
||||
|
||||
impl Whatever for Struct {
|
||||
type Foo = u8;
|
||||
}
|
||||
|
||||
impl !Whatever for Struct2 {}
|
||||
|
||||
impl http::HttpTrait for Struct {}
|
||||
|
||||
mod traits {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// ignore-tidy-linelength
|
||||
|
||||
#![feature(doc_cfg)]
|
||||
#![feature(negative_impls)]
|
||||
|
||||
pub mod another_folder;
|
||||
pub mod another_mod;
|
||||
|
|
@ -60,6 +61,8 @@ impl implementors::Whatever for Foo {
|
|||
type Foo = u32;
|
||||
}
|
||||
|
||||
impl !implementors::Whatever for StructToImplOnReexport {}
|
||||
|
||||
#[doc(inline)]
|
||||
pub use implementors::TraitToReexport;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue