Skip to content

Commit

Permalink
Add a test for building a wasm crate in a workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
fitzgen committed Nov 5, 2018
1 parent dac12d3 commit 9b5e5da
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/all/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,51 @@ fn it_should_build_js_hello_world_example() {
.unwrap();
fixture.run(cli.cmd).unwrap();
}

#[test]
fn it_should_build_crates_in_a_workspace() {
let fixture = utils::fixture::Fixture::new();
fixture
.file(
"Cargo.toml",
r#"
[workspace]
members = ["./blah"]
"#,
)
.file(
"blah/Cargo.toml",
r#"
[package]
authors = ["The wasm-pack developers"]
description = "so awesome rust+wasm package"
license = "WTFPL"
name = "blah"
repository = "https://github.com/rustwasm/wasm-pack.git"
version = "0.1.0"
[lib]
crate-type = ["cdylib"]
[dependencies]
wasm-bindgen = "=0.2.21"
"#,
)
.file(
"blah/src/lib.rs",
r#"
extern crate wasm_bindgen;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn hello() -> u32 { 42 }
"#,
);
fixture.install_local_wasm_bindgen();
let cli = Cli::from_iter_safe(vec![
"wasm-pack",
"build",
&fixture.path.join("blah").display().to_string(),
]).unwrap();
fixture.run(cli.cmd).unwrap();
}

0 comments on commit 9b5e5da

Please sign in to comment.