From 660241d1d47ac939e88163bab747c853be82eac0 Mon Sep 17 00:00:00 2001 From: Yotam Ofek Date: Mon, 24 Feb 2025 13:28:55 +0000 Subject: [PATCH 1/2] Fix test directives that were accidentally ignored --- tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs | 8 ++++---- .../run-make/rustdoc-scrape-examples-multiple/src/lib.rs | 7 +++---- .../run-make/rustdoc-scrape-examples-ordering/src/lib.rs | 8 ++++---- tests/run-make/rustdoc-scrape-examples-remap/src/lib.rs | 4 ++-- tests/run-make/rustdoc-scrape-examples-test/src/lib.rs | 2 +- .../rustdoc-scrape-examples-whitespace/src/lib.rs | 2 +- tests/run-make/rustdoc-themes/foo.rs | 6 +++--- tests/run-make/rustdoc-with-out-dir-option/src/lib.rs | 2 +- tests/run-make/rustdoc-with-output-option/src/lib.rs | 2 +- .../run-make/rustdoc-with-short-out-dir-option/src/lib.rs | 2 +- tests/rustdoc-ui/unused-extern-crate.rs | 1 - tests/ui/inline-const/collect-scopes-in-pat.rs | 2 +- 12 files changed, 22 insertions(+), 24 deletions(-) diff --git a/tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs index 26ab1390a49ae..3ec2cf66fa30f 100644 --- a/tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs +++ b/tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs @@ -1,8 +1,8 @@ // Scraped example should only include line numbers for items b and c in ex.rs -// @!has foobar/fn.f.html '//*[@class="src-line-numbers"]' '14' -// @has foobar/fn.f.html '//*[@class="src-line-numbers"]' '15' -// @has foobar/fn.f.html '//*[@class="src-line-numbers"]' '21' -// @!has foobar/fn.f.html '//*[@class="src-line-numbers"]' '22' +//@ !has foobar/fn.f.html '//span[@data-nosnippet]' '14' +//@ has foobar/fn.f.html '//span[@data-nosnippet]' '15' +//@ has foobar/fn.f.html '//span[@data-nosnippet]' '21' +//@ !has foobar/fn.f.html '//span[@data-nosnippet]' '22' pub fn f() {} diff --git a/tests/run-make/rustdoc-scrape-examples-multiple/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-multiple/src/lib.rs index bdfeda92d79a0..25600915f5f93 100644 --- a/tests/run-make/rustdoc-scrape-examples-multiple/src/lib.rs +++ b/tests/run-make/rustdoc-scrape-examples-multiple/src/lib.rs @@ -1,6 +1,5 @@ -// @has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]//*[@class="prev"]' '' -// @has foobar/fn.ok.html '//*[@class="more-scraped-examples"]' '' -// @has src/ex/ex.rs.html -// @has foobar/fn.ok.html '//a[@href="../src/ex/ex.rs.html#2"]' '' +//@ has foobar/fn.ok.html '//*[@class="more-scraped-examples"]' '' +//@ has src/ex/ex.rs.html +//@ has foobar/fn.ok.html '//a[@href="../src/ex/ex.rs.html#2"]' '' pub fn ok() {} diff --git a/tests/run-make/rustdoc-scrape-examples-ordering/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-ordering/src/lib.rs index c53c987a7cbf0..c957263c048f7 100644 --- a/tests/run-make/rustdoc-scrape-examples-ordering/src/lib.rs +++ b/tests/run-make/rustdoc-scrape-examples-ordering/src/lib.rs @@ -1,6 +1,6 @@ -// @has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]' 'ex2' -// @has foobar/fn.ok.html '//*[@class="more-scraped-examples"]' 'ex1' -// @has foobar/fn.ok.html '//*[@class="highlight focus"]' 'ok' -// @has foobar/fn.ok.html '//*[@class="highlight"]' 'ok' +//@ has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]' 'ex2' +//@ has foobar/fn.ok.html '//*[@class="more-scraped-examples"]' 'ex1' +//@ has foobar/fn.ok.html '//*[@class="highlight focus"]' 'ok' +//@ has foobar/fn.ok.html '//*[@class="highlight"]' 'ok' pub fn ok(_x: i32) {} diff --git a/tests/run-make/rustdoc-scrape-examples-remap/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-remap/src/lib.rs index f525a4270dde1..e1dc4f9150689 100644 --- a/tests/run-make/rustdoc-scrape-examples-remap/src/lib.rs +++ b/tests/run-make/rustdoc-scrape-examples-remap/src/lib.rs @@ -1,5 +1,5 @@ -// @has foobar/b/fn.foo.html '//*[@class="scraped-example expanded"]' 'ex.rs' -// @has foobar/c/fn.foo.html '//*[@class="scraped-example expanded"]' 'ex.rs' +//@ has foobar/b/fn.foo.html '//*[@class="scraped-example expanded"]' 'ex.rs' +//@ has foobar/c/fn.foo.html '//*[@class="scraped-example expanded"]' 'ex.rs' #[path = "a.rs"] pub mod b; diff --git a/tests/run-make/rustdoc-scrape-examples-test/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-test/src/lib.rs index 22be1ad41010f..93d56b7e972f8 100644 --- a/tests/run-make/rustdoc-scrape-examples-test/src/lib.rs +++ b/tests/run-make/rustdoc-scrape-examples-test/src/lib.rs @@ -1,3 +1,3 @@ -// @has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]' '' +//@ has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]' '' pub fn ok() {} diff --git a/tests/run-make/rustdoc-scrape-examples-whitespace/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-whitespace/src/lib.rs index 28c34716c2f3b..8fc3a5e41d2ea 100644 --- a/tests/run-make/rustdoc-scrape-examples-whitespace/src/lib.rs +++ b/tests/run-make/rustdoc-scrape-examples-whitespace/src/lib.rs @@ -1,3 +1,3 @@ -// @has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]//code' ' ' +//@ has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]//code' ' ' pub fn ok() {} diff --git a/tests/run-make/rustdoc-themes/foo.rs b/tests/run-make/rustdoc-themes/foo.rs index 8b1e75b0ae13b..555429b07df2a 100644 --- a/tests/run-make/rustdoc-themes/foo.rs +++ b/tests/run-make/rustdoc-themes/foo.rs @@ -1,4 +1,4 @@ -// @has test.css -// @has foo/struct.Foo.html -// @has - '//*[@name="rustdoc-vars"]/@data-themes' 'test' +//@ has test.css +//@ has foo/struct.Foo.html +//@ has - '//*[@name="rustdoc-vars"]/@data-themes' 'test' pub struct Foo; diff --git a/tests/run-make/rustdoc-with-out-dir-option/src/lib.rs b/tests/run-make/rustdoc-with-out-dir-option/src/lib.rs index 044bb6acb19b8..98753560d3a4a 100644 --- a/tests/run-make/rustdoc-with-out-dir-option/src/lib.rs +++ b/tests/run-make/rustdoc-with-out-dir-option/src/lib.rs @@ -1,2 +1,2 @@ -// @has foobar/fn.ok.html +//@ has foobar/fn.ok.html pub fn ok() {} diff --git a/tests/run-make/rustdoc-with-output-option/src/lib.rs b/tests/run-make/rustdoc-with-output-option/src/lib.rs index 044bb6acb19b8..98753560d3a4a 100644 --- a/tests/run-make/rustdoc-with-output-option/src/lib.rs +++ b/tests/run-make/rustdoc-with-output-option/src/lib.rs @@ -1,2 +1,2 @@ -// @has foobar/fn.ok.html +//@ has foobar/fn.ok.html pub fn ok() {} diff --git a/tests/run-make/rustdoc-with-short-out-dir-option/src/lib.rs b/tests/run-make/rustdoc-with-short-out-dir-option/src/lib.rs index 044bb6acb19b8..98753560d3a4a 100644 --- a/tests/run-make/rustdoc-with-short-out-dir-option/src/lib.rs +++ b/tests/run-make/rustdoc-with-short-out-dir-option/src/lib.rs @@ -1,2 +1,2 @@ -// @has foobar/fn.ok.html +//@ has foobar/fn.ok.html pub fn ok() {} diff --git a/tests/rustdoc-ui/unused-extern-crate.rs b/tests/rustdoc-ui/unused-extern-crate.rs index 240dd1f00e222..62fd51aba9a55 100644 --- a/tests/rustdoc-ui/unused-extern-crate.rs +++ b/tests/rustdoc-ui/unused-extern-crate.rs @@ -1,3 +1,2 @@ //@ check-pass //@ aux-crate:panic_item=panic-item.rs -// @has unused_extern_crate/index.html diff --git a/tests/ui/inline-const/collect-scopes-in-pat.rs b/tests/ui/inline-const/collect-scopes-in-pat.rs index 024fde537413f..16baf920f584e 100644 --- a/tests/ui/inline-const/collect-scopes-in-pat.rs +++ b/tests/ui/inline-const/collect-scopes-in-pat.rs @@ -1,4 +1,4 @@ -// @compile-flags: -Zlint-mir +//@ compile-flags: -Zlint-mir //@ check-pass #![feature(inline_const_pat)] From 0881dba5d38331ecb0a4b4e259d77cf57b95636f Mon Sep 17 00:00:00 2001 From: Yotam Ofek Date: Thu, 27 Feb 2025 13:20:52 +0000 Subject: [PATCH 2/2] Move "unused_exter_crate" test from rustdoc-ui to rustdoc --- tests/{rustdoc-ui => rustdoc}/auxiliary/panic-item.rs | 0 tests/{rustdoc-ui => rustdoc}/unused-extern-crate.rs | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename tests/{rustdoc-ui => rustdoc}/auxiliary/panic-item.rs (100%) rename tests/{rustdoc-ui => rustdoc}/unused-extern-crate.rs (50%) diff --git a/tests/rustdoc-ui/auxiliary/panic-item.rs b/tests/rustdoc/auxiliary/panic-item.rs similarity index 100% rename from tests/rustdoc-ui/auxiliary/panic-item.rs rename to tests/rustdoc/auxiliary/panic-item.rs diff --git a/tests/rustdoc-ui/unused-extern-crate.rs b/tests/rustdoc/unused-extern-crate.rs similarity index 50% rename from tests/rustdoc-ui/unused-extern-crate.rs rename to tests/rustdoc/unused-extern-crate.rs index 62fd51aba9a55..cdc00fd313afc 100644 --- a/tests/rustdoc-ui/unused-extern-crate.rs +++ b/tests/rustdoc/unused-extern-crate.rs @@ -1,2 +1,2 @@ -//@ check-pass //@ aux-crate:panic_item=panic-item.rs +//@ has unused_extern_crate/index.html