Skip to content

Commit

Permalink
fix(depcheck): add failing test to repro bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleygwilliams committed Jul 25, 2018
1 parent dd30b88 commit 58eaed1
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/fixtures/serde-feature/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "serde-serialize"
description = "an example rust->wasm crate"
version = "0.1.0"
authors = ["Ashley Williams <ashley666ashley@gmail.com>"]
license = "WTFPL"
repository = "https://github.com/ashleygwilliams/wasm-pack"

[lib]
crate-type = ["cdylib"]

[dependencies.wasm-bindgen]
version = "^0.2"
features = ["serde-serialize"]
2 changes: 2 additions & 0 deletions tests/fixtures/serde-feature/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# js-hello-world
> an example rust -> wasm project
15 changes: 15 additions & 0 deletions tests/fixtures/serde-feature/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#![feature(proc_macro, wasm_import_module, wasm_custom_section)]

extern crate wasm_bindgen;

use wasm_bindgen::prelude::*;

#[wasm_bindgen]
extern {
fn alert(s: &str);
}

#[wasm_bindgen]
pub fn greet(name: &str) {
alert(&format!("Hello, {}!", name));
}
8 changes: 8 additions & 0 deletions tests/manifest/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ fn it_checks_has_cdylib_wrong_crate_type() {
);
}

#[test]
fn it_recognizes_a_map_during_depcheck() {
let step = wasm_pack::progressbar::Step::new(1);
assert!(
manifest::check_crate_config(&PathBuf::from("tests/fixtures/serde-feature"), &step).is_ok()
);
}

#[test]
fn it_creates_a_package_json_default_path() {
let step = wasm_pack::progressbar::Step::new(1);
Expand Down

0 comments on commit 58eaed1

Please sign in to comment.