summaryrefslogtreecommitdiff
path: root/tests/src/args.rs
diff options
context:
space:
mode:
authorIan Wrzesinski <wrzian@umich.edu>2024-09-22 17:38:38 -0400
committerIan Wrzesinski <wrzian@umich.edu>2024-10-31 18:26:12 -0400
commitda83f33c4c015f927920b437610153c029c8291b (patch)
tree2346a04cc7415a0b58a6952cbdbfad7562499182 /tests/src/args.rs
parent1261d176b0d0eebe8aef117fb5929209f018f1fa (diff)
1. Add test-runner option to compare parser output
Diffstat (limited to 'tests/src/args.rs')
-rw-r--r--tests/src/args.rs23
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/src/args.rs b/tests/src/args.rs
index 786733cc..e94986ce 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,25 @@ 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.
+ ///
+ /// 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 {