Add (a lot of) tests to rustdoc

a7ec03f
Opened by Guillaume Gomez at 2024-09-09 19:23:43

Since we now have a more complete way to compare two HTML contents, I think we can now strongly reinforce rustdoc's tests (which are a bit weak and lacking for now).

cc @rust-lang/docs

  1. Some ideas:

    • src/librustdoc/html/markdown.rs already has a #[cfg(test)] block, but it doesn't test the "hide lines of code with # " behavior.
    • ~~src/librustdoc/test.rs could use some tests to verify how it adds attributes to the test, whether it wraps tests in a fn main(), things like that.~~

    QuietMisdreavus at 2017-11-04 18:27:53

  2. One thing i'd like to see (that will probably need cooperation from some ~~rustbuild~~ compiletest experts) is the ability to test the stdout-printing behavior of rustdoc in various situations. We don't have UI tests for rustdoc the same way the compiler does, so right now there's no place for these in the testing setup.

    QuietMisdreavus at 2018-03-19 19:05:15

  3. ping: Is this still an issue?

    Noah Lev at 2020-10-12 04:38:19

  4. Still waiting on https://github.com/rust-lang/rust/pull/70533.

    Guillaume Gomez at 2020-10-12 11:38:05

  5. Triage: #70533 was superseded by https://github.com/rust-lang/rust/pull/79979 which has been merged. @GuillaumeGomez can this be closed? If not, we should probably add more detail to what kind of tests need to be added since this issue is not very actionable right now.

    Ryan Levick at 2021-06-17 08:21:24

  6. Still far from done unfortunately. Please keep it open. As for the kind of tests, it's GUI ones. But being more precise is a bit complicated as we're still changing the front-end quickly for the moment.

    Guillaume Gomez at 2021-06-17 08:26:23