Skip to content

Cleanup rustdoc tests with @!has and @!matches #54824

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 10 commits into from
Oct 26, 2018
2 changes: 1 addition & 1 deletion src/test/rustdoc/deprecated-impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl Bar for Foo2 {

// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.5: fn_def_with_doc'
// @has - 'fn_def_with_doc short'
// @!has - 'fn_def_with full'
// @!has - 'fn_def_with_doc full'
fn fn_def_with_doc() {}

// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.6: fn_def_without_doc'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// Test that we HTML-escape Rust expressions, where HTML special chars
// can occur, and we know it's definitely not markup.
// Test that the contents of constants are not displayed as part of the
// documentation.

// @!has escape_rust_expr/constant.CONST_S.html '//pre[@class="rust const"]' '"<script>"'
pub const CONST_S: &'static str = "<script>";
// @!has dont_show_const_contents/constant.CONST_S.html 'dont show this'
pub const CONST_S: &'static str = "dont show this";
2 changes: 1 addition & 1 deletion src/test/rustdoc/empty-section.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
pub struct Foo;

// @has foo/struct.Foo.html
// @!has - '//*[@class="synthetic-implementations"]' 'Auto Trait Implementations'
// @!has - 'Auto Trait Implementations'
impl !Send for Foo {}
impl !Sync for Foo {}
4 changes: 2 additions & 2 deletions src/test/rustdoc/hidden-methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ pub mod hidden {

// @has foo/struct.Foo.html
// @!has - 'Methods'
// @!has - 'impl Foo'
// @!has - '//code' 'impl Foo'
// @!has - 'this_should_be_hidden'
pub use hidden::Foo;

// @has foo/struct.Bar.html
// @!has - 'Methods'
// @!has - 'impl Bar'
// @!has - '//code' 'impl Bar'
// @!has - 'this_should_be_hidden'
pub use hidden::Bar;
2 changes: 1 addition & 1 deletion src/test/rustdoc/issue-13698.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ pub trait Bar {
fn bar(&self) {}
}

// @!has issue_13698/struct.Foo.html '//*[@id="method.foo"]' 'fn bar'
// @!has issue_13698/struct.Foo.html '//*[@id="method.bar"]' 'fn bar'
impl Bar for Foo {}
3 changes: 2 additions & 1 deletion src/test/rustdoc/issue-46767.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ mod private {
}
pub use self::private::Enum::*;

// @!has foo/index.html '//a/@href' './private/index.html'
// @!has-dir foo/private
// @!has foo/index.html '//a/@href' 'private/index.html'
1 change: 0 additions & 1 deletion src/test/rustdoc/manual_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ pub trait T {
// @has - '//*[@class="docblock"]' 'Docs associated with the S1 trait a_method implementation.'
// @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
// @has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
// @has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
// @has - '//*[@class="docblock"]' 'Docs associated with the trait c_method definition.'
// @!has - '//*[@class="docblock"]' 'There is another line'
// @has - '//*[@class="docblock"]' 'Read more'
Expand Down
2 changes: 2 additions & 0 deletions src/test/rustdoc/playground-empty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

#![doc(html_playground_url = "")]

// compile-flags:-Z unstable-options --playground-url https://play.rust-lang.org/

//! module docs
//!
//! ```
Expand Down
3 changes: 2 additions & 1 deletion src/test/rustdoc/redirect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ mod private_no_inline {

// @has redirect/index.html
// @has - '//code' 'pub use private_no_inline::Qux'
// @!has - '//code/a' 'Qux'
// @!has - '//a' 'Qux'
// @!has redirect/struct.Qux.html
#[doc(no_inline)]
pub use private_no_inline::Qux;
2 changes: 1 addition & 1 deletion src/test/rustdoc/unneeded-trait-implementations-title.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@

pub struct Bar;

// @!has foo/struct.Bar.html '//*[@id="implementations"]'
// @count foo/struct.Bar.html '//*[@id="implementations"]' 0