wiggle: emit a metadata module containing witx document (#1387)
* wiggle: emit a metadata module containing witx document * wiggle: put metadata module behind a wiggle_metadata feature * wasi-common: add wiggle_metadata feature and optional witx dep * refactor according to alex's advice * wasi-common: make snapshots pub * wasi-common: i do need a wiggle_metadata feature to be available * Tweak features and such * wiggle: fix tests by passing metadata flag to wiggle-runtime * wiggle: need to move wiggle-runtime to a non-dev dependency so that the feature resolves for external users of the crates Co-authored-by: Alex Crichton <alex@alexcrichton.com>
This commit is contained in:
@@ -1,11 +1,26 @@
|
||||
use wiggle_runtime::{GuestBorrows, GuestError, GuestErrorType, GuestPtr};
|
||||
use wiggle_test::WasiCtx;
|
||||
|
||||
// This test file exists to make sure that the entire `wasi.witx` file can be
|
||||
// handled by wiggle, producing code that compiles correctly.
|
||||
// The trait impls here are never executed, and just exist to validate that the
|
||||
// witx is exposed with the type signatures that we expect.
|
||||
|
||||
wiggle::from_witx!({
|
||||
witx: ["tests/wasi.witx"],
|
||||
ctx: WasiCtx,
|
||||
});
|
||||
|
||||
// The only test in this file is to verify that the witx document provided by the
|
||||
// proc macro in the `metadata` module is equal to the document on the disk.
|
||||
#[test]
|
||||
fn document_equivelant() {
|
||||
let macro_doc = metadata::document();
|
||||
let disk_doc = witx::load(&["tests/wasi.witx"]).expect("load wasi.witx from disk");
|
||||
|
||||
assert_eq!(macro_doc, disk_doc);
|
||||
}
|
||||
|
||||
type Result<T> = std::result::Result<T, types::Errno>;
|
||||
|
||||
impl<'a> GuestErrorType<'a> for types::Errno {
|
||||
|
||||
Reference in New Issue
Block a user