diff --git a/crates/cli/src/cmd/check.rs b/crates/cli/src/cmd/check.rs index 1bbc1126..2ec59807 100644 --- a/crates/cli/src/cmd/check.rs +++ b/crates/cli/src/cmd/check.rs @@ -10,13 +10,18 @@ pub struct Args { /// Skip tests; run only the type-checker #[clap(short, long)] skip_tests: bool, + + /// Only run tests if their path + name match the given string + #[clap(short, long)] + match_tests: Option, } pub fn exec( Args { directory, skip_tests, + match_tests, }: Args, ) -> miette::Result<()> { - crate::with_project(directory, |p| p.check(skip_tests)) + crate::with_project(directory, |p| p.check(skip_tests, match_tests.clone())) } diff --git a/crates/project/src/lib.rs b/crates/project/src/lib.rs index a561d7ad..8ebec612 100644 --- a/crates/project/src/lib.rs +++ b/crates/project/src/lib.rs @@ -101,12 +101,12 @@ where self.compile(options) } - pub fn check(&mut self, skip_tests: bool) -> Result<(), Error> { + pub fn check(&mut self, skip_tests: bool, match_tests: Option) -> Result<(), Error> { let options = Options { code_gen_mode: if skip_tests { CodeGenMode::NoOp } else { - CodeGenMode::Test + CodeGenMode::Test(match_tests) }, }; @@ -145,10 +145,9 @@ where self.write_build_outputs(programs, uplc_dump)?; } - CodeGenMode::Test => { + CodeGenMode::Test(match_tests) => { let tests = self.test_gen(&checked_modules)?; - - self.run_tests(tests); + self.run_tests(tests, match_tests); } CodeGenMode::NoOp => (), } @@ -518,7 +517,7 @@ where Ok(programs) } - fn run_tests(&self, tests: Vec