MCPcopy Create free account
hub / github.com/explodingcamera/tinywasm / run_paths

Method run_paths

crates/tinywasm/tests/testsuite/mod.rs:30–61  ·  view source on GitHub ↗
(&mut self, tests: &[std::path::PathBuf])

Source from the content-addressed store, hash-verified

28 }
29
30 pub fn run_paths(&mut self, tests: &[std::path::PathBuf]) -> Result<()> {
31 let mut files = Vec::new();
32 for path in tests {
33 if path.is_dir() {
34 for entry in std::fs::read_dir(path)? {
35 let entry = entry?;
36 let path = entry.path();
37 if path.extension().is_some_and(|ext| ext == "wast") {
38 files.push(path);
39 }
40 }
41 } else {
42 files.push(path.clone());
43 }
44 }
45 files.sort();
46
47 let runner_files = files
48 .iter()
49 .map(|path| {
50 let contents = std::fs::read_to_string(path)?;
51 let name = path.to_string_lossy().into_owned();
52 Ok((name, contents))
53 })
54 .collect::<Result<Vec<_>>>()?;
55
56 self.runner.run_files(runner_files.iter().map(|(name, contents)| RunnerTestFile {
57 name: name.clone(),
58 parent: name.clone(),
59 contents,
60 }))
61 }
62
63 pub fn run_files<'a>(&mut self, tests: impl IntoIterator<Item = wasm_testsuite::data::TestFile<'a>>) -> Result<()> {
64 self.runner.run_files(tests.into_iter().map(|file| RunnerTestFile {

Callers 2

mainFunction · 0.45
mainFunction · 0.45

Calls 3

mapMethod · 0.80
pushMethod · 0.45
run_filesMethod · 0.45

Tested by

no test coverage detected