diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-11-04 10:17:49 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-04 10:17:49 +0100 |
| commit | cb1aad3a0cc862c5ff57a557e196ba49a02917de (patch) | |
| tree | 80cd62cbeb0f8d2bb999cc984d213f42293ebd24 /tests/src/args.rs | |
| parent | 6b636167ef2e84c761777261ce1ca3087a75f765 (diff) | |
| parent | 2c9728f53b318a6cae092f30ad0956a536af7ccb (diff) | |
Refactor Parser (#5310)
Diffstat (limited to 'tests/src/args.rs')
| -rw-r--r-- | tests/src/args.rs | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/src/args.rs b/tests/src/args.rs index 786733cc..db5d1a9b 100644 --- a/tests/src/args.rs +++ b/tests/src/args.rs @@ -43,7 +43,9 @@ pub struct CliArguments { /// Runs SVG export. #[arg(long)] pub svg: bool, - /// Displays the syntax tree. + /// Displays the syntax tree before running tests. + /// + /// Note: This is ignored if using '--syntax-compare'. #[arg(long)] pub syntax: bool, /// Displays only one line per test, hiding details about failures. @@ -55,6 +57,29 @@ pub struct CliArguments { /// How many threads to spawn when running the tests. #[arg(short = 'j', long)] pub num_threads: Option<usize>, + /// Changes testing behavior for debugging the parser: With no argument, + /// outputs the concrete syntax trees of tests as files in + /// 'tests/store/syntax/'. With a directory as argument, will treat it as a + /// reference of correct syntax tree files and will print which output + /// syntax trees differ (viewing the diffs is on you). + /// + /// This overrides the normal testing system. It parses, but does not run + /// the test suite. + /// + /// If `cargo test` is run with `--no-default-features`, then compiling will + /// not include Typst's core crates, only typst-syntax, greatly speeding up + /// debugging when changing the parser. + /// + /// You can generate a correct reference directory by running on a known + /// good commit and copying the generated outputs to a new directory. + /// `_things` may be a good location as it is in the top-level gitignore. + /// + /// You can view diffs in VS Code with: `code --diff <ref_dir>/<test>.syntax + /// tests/store/syntax/<test>.syntax` + #[arg(long)] + pub parser_compare: Option<Option<PathBuf>>, + // ^ I'm not using a subcommand here because then test patterns don't parse + // how you would expect and I'm too lazy to try to fix it. } impl CliArguments { |
