diff --git a/Cargo.lock b/Cargo.lock index 6d14f45bf4..449b4b0403 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1679,7 +1679,6 @@ dependencies = [ "spdx", "wasm-encoder 0.221.0", "wasmparser 0.221.0", - "wat", ] [[package]] diff --git a/crates/wasm-metadata/Cargo.toml b/crates/wasm-metadata/Cargo.toml index ba7acd07d3..a00f74f6b4 100644 --- a/crates/wasm-metadata/Cargo.toml +++ b/crates/wasm-metadata/Cargo.toml @@ -20,6 +20,3 @@ serde = { workspace = true } serde_derive = { workspace = true } serde_json = { version = "1" } spdx = "0.10.1" - -[dev-dependencies] -wat = { workspace = true } diff --git a/crates/wasm-metadata/src/producers.rs b/crates/wasm-metadata/src/producers.rs index 5583be4bdf..5044fdb6dc 100644 --- a/crates/wasm-metadata/src/producers.rs +++ b/crates/wasm-metadata/src/producers.rs @@ -191,11 +191,11 @@ impl<'a> ProducersField<'a> { mod test { use super::*; use crate::Metadata; + use wasm_encoder::Module; #[test] fn producers_empty_module() { - let wat = "(module)"; - let module = wat::parse_str(wat).unwrap(); + let module = Module::new().finish(); let mut producers = Producers::empty(); producers.add("language", "bar", ""); producers.add("processed-by", "baz", "1.0"); @@ -221,8 +221,7 @@ mod test { #[test] fn producers_add_another_field() { - let wat = "(module)"; - let module = wat::parse_str(wat).unwrap(); + let module = Module::new().finish(); let mut producers = Producers::empty(); producers.add("language", "bar", ""); producers.add("processed-by", "baz", "1.0"); @@ -252,8 +251,7 @@ mod test { #[test] fn producers_overwrite_field() { - let wat = "(module)"; - let module = wat::parse_str(wat).unwrap(); + let module = Module::new().finish(); let mut producers = Producers::empty(); producers.add("processed-by", "baz", "1.0"); let module = producers.add_to_wasm(&module).unwrap(); diff --git a/crates/wasm-metadata/src/registry.rs b/crates/wasm-metadata/src/registry.rs index 4c0b54a4e1..72fe2ee6af 100644 --- a/crates/wasm-metadata/src/registry.rs +++ b/crates/wasm-metadata/src/registry.rs @@ -345,11 +345,11 @@ impl Display for CustomLicense { mod test { use super::*; use crate::Metadata; + use wasm_encoder::Module; #[test] fn overwrite_registry_metadata() { - let wat = "(module)"; - let module = wat::parse_str(wat).unwrap(); + let module = Module::new().finish(); let registry_metadata = RegistryMetadata { authors: Some(vec!["Foo".to_owned()]), ..Default::default() diff --git a/crates/wasm-metadata/tests/component.rs b/crates/wasm-metadata/tests/component.rs index 3c282c9ed6..6c2c3f3e25 100644 --- a/crates/wasm-metadata/tests/component.rs +++ b/crates/wasm-metadata/tests/component.rs @@ -1,11 +1,11 @@ use std::vec; +use wasm_encoder::{Component, Module}; use wasm_metadata::*; #[test] fn add_to_empty_component() { - let wat = "(component)"; - let component = wat::parse_str(wat).unwrap(); + let component = Component::new().finish(); let add = AddMetadata { name: Some("foo".to_owned()), language: vec!["bar".to_owned()], @@ -105,8 +105,7 @@ fn add_to_empty_component() { #[test] fn add_to_nested_component() { // Create the same old module, stick some metadata into it - let wat = "(module)"; - let module = wat::parse_str(wat).unwrap(); + let module = Module::new().finish(); let add = AddMetadata { name: Some("foo".to_owned()), language: vec!["bar".to_owned()], diff --git a/crates/wasm-metadata/tests/module.rs b/crates/wasm-metadata/tests/module.rs index f747730469..d25014fc0c 100644 --- a/crates/wasm-metadata/tests/module.rs +++ b/crates/wasm-metadata/tests/module.rs @@ -1,11 +1,11 @@ use std::vec; +use wasm_encoder::Module; use wasm_metadata::*; #[test] fn add_to_empty_module() { - let wat = "(module)"; - let module = wat::parse_str(wat).unwrap(); + let module = Module::new().finish(); let add = AddMetadata { name: Some("foo".to_owned()), language: vec!["bar".to_owned()],