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

Function main

crates/tinywasm/tests/test-wast.rs:6–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4use tinywasm_cli::wast_runner::WastRunner;
5
6fn main() -> Result<()> {
7 let args = std::env::args().collect::<Vec<_>>();
8 if args.len() < 2 {
9 bail!("usage: cargo test-wast <wast-file>")
10 };
11
12 let mut cwd = std::env::current_dir()?;
13 if cwd.ends_with("crates/tinywasm/") {
14 cwd.pop();
15 cwd.pop();
16 }
17
18 // if its a folder, run all the wast files in the folder
19 let arg = PathBuf::from(cwd.clone()).join(&args[1]);
20 println!("running tests in {:?}", arg);
21
22 let files = if arg.is_dir() {
23 std::fs::read_dir(&arg)?.map(|entry| entry.map(|e| e.path())).collect::<Result<Vec<_>, _>>()?
24 } else {
25 vec![arg]
26 };
27
28 let mut test_suite = WastRunner::new();
29 test_suite.run_paths(&files)
30}

Callers

nothing calls this directly

Calls 4

popMethod · 0.80
mapMethod · 0.80
lenMethod · 0.45
run_pathsMethod · 0.45

Tested by

no test coverage detected