Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

rustdoc: fix up old test #122355

Merged
merged 1 commit into from Mar 12, 2024
Merged

Conversation

fmease
Copy link
Member

@fmease fmease commented Mar 12, 2024

tests/rustdoc/line-breaks.rs had several issues:

  1. It used //@count instead of // @count (notice the space!) which gets treated as a ui_test directive instead of a htmldocck one. compiletest didn't flag it as an error because it's allowlisted (#121561) presumably precisely because of this test. And before the compiletest→ui_test migration, these directives must've been ignored, too, because …
  2. … the checks themselves no longer work either: The count of <br>s is actually 0 in all 3 cases because – well – we no longer generate any <br>s inside <pre>s.

Since I don't know how to @count \ns instead of <br>s, I've turned them into @matches. Btw, I don't know if this test is still desirable or if we have other tests that cover this (I haven't checked).

r? rustdoc

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Mar 12, 2024
@@ -694,7 +694,6 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
"check-stdout",
"check-test-line-numbers-match",
"compile-flags",
"count",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @jieyouxu (#121561) I presume you allowlisted count precisely because of tests/rustdoc/line-breaks.rs, am I correct?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must have assumed it was a valid directive too...

U::Output: Display + Copy
// @matches foo/fn.where_clause.html '//*[@class="rust item-decl"]//code' "\
// where_clause<T, U>\(param_one: T, param_two: U\)where\n\
// \ T: Add<U> \+ Display \+ Copy,\n\
Copy link
Member Author

@fmease fmease Mar 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The \ right before the LF makes htmldocck dedent the following line, hence the “floating” \ on this line: It stops the dedentation process and “bakes” 4 literal spaces into the string literal whose presence we want to check.

@notriddle
Copy link
Contributor

notriddle commented Mar 12, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Mar 12, 2024

📌 Commit f4b2a8a has been approved by notriddle

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 12, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 12, 2024
…kingjubilee

Rollup of 12 pull requests

Successful merges:

 - rust-lang#121754 ([bootstrap] Move the `split-debuginfo` setting to the per-target section)
 - rust-lang#121953 (Add tests for the generated assembly of mask related simd instructions.)
 - rust-lang#122081 (validate `builder::PATH_REMAP`)
 - rust-lang#122245 (Detect truncated DepGraph files)
 - rust-lang#122354 (bootstrap: Don't eagerly format verbose messages)
 - rust-lang#122355 (rustdoc: fix up old test)
 - rust-lang#122363 (tests: Add ui/attributes/unix_sigpipe/unix_sigpipe-str-list.rs)
 - rust-lang#122366 (Fix stack overflow with recursive associated types)
 - rust-lang#122377 (Fix discriminant_kind copy paste from the pointee trait case)
 - rust-lang#122378 (Properly rebuild rustbooks)
 - rust-lang#122380 (Fix typo in lib.rs of proc_macro)
 - rust-lang#122381 (llvm-wrapper: adapt for LLVM API changes)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 1aef2fb into rust-lang:master Mar 12, 2024
11 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Mar 12, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 12, 2024
Rollup merge of rust-lang#122355 - fmease:rustdoc-fix-up-old-test, r=notriddle

rustdoc: fix up old test

`tests/rustdoc/line-breaks.rs` had several issues:

1. It used `//`@count`` instead of `// `@count`` (notice the space!) which gets treated as a `ui_test` directive instead of a `htmldocck` one. `compiletest` didn't flag it as an error because it's allowlisted ([rust-lang#121561](rust-lang#121561)) presumably precisely because of this test. And before the compiletest→ui_test migration, these directives must've been ignored, too, because …
2. … the checks themselves no longer work either: The count of `<br>`s is actually 0 in all 3 cases because – well – we no longer generate any `<br>`s inside `<pre>`s.

Since I don't know how to ``@count`` `\n`s instead of `<br>`s, I've turned them into ``@matches`.` Btw, I don't know if this test is still desirable or if we have other tests that cover this (I haven't checked).

r? rustdoc
@fmease fmease deleted the rustdoc-fix-up-old-test branch March 12, 2024 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants