Print files / tests as they're processed when --debug

This is because there's no proper way to catch panics in Rust, which
  makes it hard to know _which_ test did cause the panic when this
  happen. The stack trace gives little detail about this, but we can
  print this information before it happens -- making it easier to
  identify the culprit.
This commit is contained in:
KtorZ
2022-12-17 13:33:32 +01:00
committed by Lucas
parent eb386f4606
commit 44d72c046e
3 changed files with 23 additions and 2 deletions

View File

@@ -173,8 +173,9 @@ where
match_tests,
verbose,
} => {
let tests = self
.collect_scripts(&checked_modules, |def| matches!(def, Definition::Test(..)))?;
let tests = self.collect_scripts(&checked_modules, verbose, |def| {
matches!(def, Definition::Test(..))
})?;
if !tests.is_empty() {
self.event_listener.handle_event(Event::RunningTests);
}
@@ -516,6 +517,7 @@ where
fn collect_scripts(
&mut self,
checked_modules: &CheckedModules,
verbose: bool,
should_collect: fn(&TypedDefinition) -> bool,
) -> Result<Vec<Script>, Error> {
let mut programs = Vec::new();
@@ -594,6 +596,13 @@ where
..
} = func_def;
if verbose {
self.event_listener.handle_event(Event::GeneratingUPLCFor {
name: name.clone(),
path: input_path.clone(),
})
}
let mut generator = CodeGenerator::new(
&functions,
// &type_aliases,

View File

@@ -24,6 +24,10 @@ pub enum Event {
GeneratingUPLC {
output_path: PathBuf,
},
GeneratingUPLCFor {
name: String,
path: PathBuf,
},
EvaluatingFunction {
results: Vec<EvalInfo>,
},