bytecodealliance / wasm-tools

CLI and Rust libraries for low-level manipulation of WebAssembly modules
Apache License 2.0
1.21k stars 224 forks source link

Initialize a test suite for `wit-encoder` #1626

Closed yoshuawuyts closed 1 week ago

yoshuawuyts commented 1 week ago

Follow-up to #1549 and #1580, this begins adding a test suite for wit-encoder. Specifically: this takes the tests from wit-parser, and then tries to encode those in individual tests. It fixes a number of bugs, as well as adds support for include statements. It also changes the default indentation for WIT documents to 2, which matches the style that's been used in the WIT spec and WASI documents.

Not all .wit files have their own tests yet. But I ran out of time before I could finish up all the tests, but I figured even a partial test suite would already be a useful contribution. Thanks!

yoshuawuyts commented 1 week ago

lmao, what in the Windows line-endings:

---- concrete_types stdout ----
thread 'concrete_types' panicked at crates\wit-encoder\tests\empty.rs:9:5:
assertion failed: `(left == right)`

Diff < left / right > :
 package foo:empty;