diff options
| author | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2024-05-18 20:38:05 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-18 20:38:05 +0100 |
| commit | ffc04dfcc6d6e0ecae8a3c44978e6db9fbc26718 (patch) | |
| tree | a39a15210ef6a59ab2edcd617b4ea90555f8912a /src | |
| parent | f08746a95de58004d0ab42bdf252456883bc5c1a (diff) | |
| parent | 3e05be5466198da2b1185fddc8c7edbb58bdd08f (diff) | |
| download | rust-ffc04dfcc6d6e0ecae8a3c44978e6db9fbc26718.tar.gz rust-ffc04dfcc6d6e0ecae8a3c44978e6db9fbc26718.zip | |
Rollup merge of #125236 - dtolnay:expandtest, r=nnethercote
Add tests for `-Zunpretty=expanded` ported from stringify's tests This PR adds a new set of tests for the AST pretty-printer. Previously, pretty-printer edge cases were tested by way of `stringify!` in [tests/ui/macros/stringify.rs](https://github.com/rust-lang/rust/blob/1.78.0/tests/ui/macros/stringify.rs), such as the tests added by https://github.com/rust-lang/rust/commit/419b26931b73209bfafdb9938c09e12b9d650613 and https://github.com/rust-lang/rust/commit/527e2eac17c5d3709e4e30e8b72ae33a6e8990b1. Those tests will no longer provide effective coverage of the AST pretty-printer after #124141. `Nonterminal` and `TokenKind::Interpolated` are being removed, and a consequence is that `stringify!` will perform token stream pretty printing, instead of AST pretty printing, in all of the `stringify!` cases including $:expr and all other interpolations. This PR adds 2 new ui tests with `compile-flags: -Zunpretty=expanded`: - **tests/ui/unpretty/expanded-exhaustive.rs** — this test aims for exhaustive coverage of all the variants of `ExprKind`, `ItemKind`, `PatKind`, `StmtKind`, `TyKind`, and `VisibilityKind`. Some parts could use being fleshed out further, but the current state is roughly on par with what exists in the old stringify-based tests. - **tests/ui/unpretty/expanded-interpolation.rs** — this test covers tricky macro metavariable edge cases that require the AST pretty printer to synthesize parentheses in order for the printed code to be valid Rust syntax. r? `@nnethercote`
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/tidy/src/issues.txt | 1 | ||||
| -rw-r--r-- | src/tools/tidy/src/ui_tests.rs | 1 |
2 files changed, 1 insertions, 1 deletions
diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index a931782e8cc..6b8106bbc21 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -2915,7 +2915,6 @@ ui/macros/issue-95267.rs ui/macros/issue-95533.rs ui/macros/issue-98466-allow.rs ui/macros/issue-98466.rs -ui/macros/issue-98790.rs ui/macros/issue-99261.rs ui/macros/issue-99265.rs ui/macros/issue-99907.rs diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 94a0eee154d..6e92dab1abc 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -41,6 +41,7 @@ const EXTENSION_EXCEPTION_PATHS: &[&str] = &[ "tests/ui/macros/not-utf8.bin", // testing including data with the include macros "tests/ui/macros/syntax-extension-source-utils-files/includeme.fragment", // more include "tests/ui/proc-macro/auxiliary/included-file.txt", // more include + "tests/ui/unpretty/auxiliary/data.txt", // more include "tests/ui/invalid/foo.natvis.xml", // sample debugger visualizer "tests/ui/sanitizer/dataflow-abilist.txt", // dataflow sanitizer ABI list file "tests/ui/shell-argfiles/shell-argfiles.args", // passing args via a file |
