diff --git a/crates/project/src/lib.rs b/crates/project/src/lib.rs index 96610cbc..a1f9552a 100644 --- a/crates/project/src/lib.rs +++ b/crates/project/src/lib.rs @@ -78,11 +78,11 @@ impl Project { } pub fn build(&mut self, uplc: bool) -> Result<(), Error> { - self.compile(true, uplc) + self.compile(true, uplc, false) } pub fn check(&mut self) -> Result<(), Error> { - self.compile(false, false) + self.compile(false, false, true) } pub fn compile( @@ -101,12 +101,19 @@ impl Project { let validators = self.validate_validators(&mut checked_modules)?; + // TODO: In principle, uplc_gen and run_tests can't be true together. We probably want to + // model the options differently to make it obvious at the type-level. if uplc_gen { let programs = self.code_gen(validators, &checked_modules)?; self.write_build_outputs(programs, uplc_dump)?; } + if run_tests { + let tests = self.test_gen(&checked_modules)?; + self.run_tests(tests); + } + Ok(()) } @@ -472,6 +479,21 @@ impl Project { Ok(programs) } + fn run_tests(&self, tests: Vec