Skip to content

Commit

Permalink
remove wat dep from wasm-metadata (#1921)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshuawuyts authored Nov 29, 2024
1 parent 33a8bd0 commit 0a5433e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 18 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions crates/wasm-metadata/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,3 @@ serde = { workspace = true }
serde_derive = { workspace = true }
serde_json = { version = "1" }
spdx = "0.10.1"

[dev-dependencies]
wat = { workspace = true }
10 changes: 4 additions & 6 deletions crates/wasm-metadata/src/producers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions crates/wasm-metadata/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
7 changes: 3 additions & 4 deletions crates/wasm-metadata/tests/component.rs
Original file line number Diff line number Diff line change
@@ -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()],
Expand Down Expand Up @@ -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()],
Expand Down
4 changes: 2 additions & 2 deletions crates/wasm-metadata/tests/module.rs
Original file line number Diff line number Diff line change
@@ -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()],
Expand Down

0 comments on commit 0a5433e

Please sign in to comment.