MCPcopy Index your code
hub / github.com/explodingcamera/tinywasm / run_paths

Method run_paths

crates/cli/src/wast_runner.rs:84–106  ·  view source on GitHub ↗
(&mut self, tests: &[PathBuf])

Source from the content-addressed store, hash-verified

82 }
83
84 pub fn run_paths(&mut self, tests: &[PathBuf]) -> Result<()> {
85 for path in expand_paths(tests)? {
86 let contents =
87 std::fs::read_to_string(&path).context(format!("failed to read file: {}", path.to_string_lossy()))?;
88
89 let file = TestFile {
90 contents: &contents,
91 name: path.to_string_lossy().to_string(),
92 parent: canonicalize(&path)?.to_string_lossy().to_string(),
93 };
94
95 self.run_file(file)?;
96 }
97
98 self.print_errors();
99 if self.failed() {
100 anstream::println!("{self}");
101 Err(eyre!("failed one or more tests"))
102 } else {
103 anstream::println!("{self}");
104 Ok(())
105 }
106 }
107
108 pub fn set_log_level(level: log::LevelFilter) {
109 let _ = pretty_env_logger::formatted_builder().filter_level(level).try_init();

Callers 2

runs_simple_wast_fileFunction · 0.45
runFunction · 0.45

Calls 4

expand_pathsFunction · 0.85
run_fileMethod · 0.80
failedMethod · 0.80
print_errorsMethod · 0.45

Tested by 1

runs_simple_wast_fileFunction · 0.36