Skip to content

Commit 07c1ae9

Browse files
author
katelyn martin
committed
Add some temporary printlns
Because who doesn't love println debugging? Now, running the (failing) test case added in the previous commit, we'll see: ``` ---- toplevel::test::multi_use_with_layered_dirs stdout ---- parsing file at path='"root.witx"' root='"/"' canonical-path='"/root.witx"' found a use statement, parsing file at "subdir/child.witx" parsing file at path='"subdir/child.witx"' root='"/"' canonical-path='"/subdir/child.witx"' found a use statement, parsing file at "sibling.witx" parsing file at path='"sibling.witx"' root='"/"' canonical-path='"/sibling.witx"' thread 'toplevel::test::multi_use_with_layered_dirs' panicked at 'parse: Io("/sibling.witx", Custom { kind: Other, error: "mock fs: file not found" })', src/toplevel.rs:151:10 ``` Note that root is always `/` even when we're evaluating the paths found in a document that lives in a subdirectory! See how the canonical path in the last block resolves to '/sibling.witx'? We found you, Mr. Bug 🐛 🔍😃
1 parent 1e9131f commit 07c1ae9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tools/witx/src/toplevel.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,14 @@ fn parse_file(
4343
definitions: &mut Vec<Definition>,
4444
parsed: &mut HashSet<PathBuf>,
4545
) -> Result<(), WitxError> {
46+
eprintln!("parsing file at path='{:?}' root='{:?}'", &path, &root);
4647
let path = io.canonicalize(&root.join(path))?;
48+
eprintln!("canonical-path='{:?}'", &path);
4749
if !parsed.insert(path.clone()) {
4850
return Ok(());
4951
}
5052
let input = io.fgets(&path)?;
53+
eprintln!(""); // this one is just for space
5154

5255
let adjust_err = |mut error: wast::Error| {
5356
error.set_path(&path);
@@ -67,6 +70,7 @@ fn parse_file(
6770
definitions.push(def);
6871
}
6972
TopLevelSyntax::Use(u) => {
73+
eprintln!("found a use statement, parsing file at {:?}", &u);
7074
parse_file(u.as_ref(), io, root, validator, definitions, parsed)?;
7175
}
7276
}

0 commit comments

Comments
 (0)