chore: Run latest rustfmt

master
Jesper Håkansson 7 years ago
parent a558ea5e50
commit b47dfa3009
  1. 28
      tests/all/build.rs
  2. 18
      tests/all/lockfile.rs
  3. 42
      tests/all/manifest.rs

@ -10,17 +10,17 @@ fn build_in_non_crate_directory_doesnt_panic() {
"wasm-pack",
"build",
&fixture.path.display().to_string(),
])
.unwrap();
]).unwrap();
let result = fixture.run(cli.cmd);
assert!(
result.is_err(),
"running wasm-pack in a non-crate directory should fail, but it should not panic"
);
let err = result.unwrap_err();
assert!(err
.iter_chain()
.any(|e| e.to_string().contains("missing a `Cargo.toml`")));
assert!(
err.iter_chain()
.any(|e| e.to_string().contains("missing a `Cargo.toml`"))
);
}
#[test]
@ -31,8 +31,7 @@ fn it_should_build_js_hello_world_example() {
"wasm-pack",
"build",
&fixture.path.display().to_string(),
])
.unwrap();
]).unwrap();
fixture.run(cli.cmd).unwrap();
}
@ -46,8 +45,7 @@ fn it_should_build_crates_in_a_workspace() {
[workspace]
members = ["blah"]
"#,
)
.file(
).file(
Path::new("blah").join("Cargo.toml"),
r#"
[package]
@ -64,8 +62,7 @@ fn it_should_build_crates_in_a_workspace() {
[dependencies]
wasm-bindgen = "=0.2.21"
"#,
)
.file(
).file(
Path::new("blah").join("src").join("lib.rs"),
r#"
extern crate wasm_bindgen;
@ -80,8 +77,7 @@ fn it_should_build_crates_in_a_workspace() {
"wasm-pack",
"build",
&fixture.path.join("blah").display().to_string(),
])
.unwrap();
]).unwrap();
fixture.run(cli.cmd).unwrap();
}
@ -105,8 +101,7 @@ fn renamed_crate_name_works() {
[dependencies]
wasm-bindgen = "=0.2.21"
"#,
)
.file(
).file(
"src/lib.rs",
r#"
extern crate wasm_bindgen;
@ -121,7 +116,6 @@ fn renamed_crate_name_works() {
"wasm-pack",
"build",
&fixture.path.display().to_string(),
])
.unwrap();
]).unwrap();
fixture.run(cli.cmd).unwrap();
}

@ -30,8 +30,7 @@ fn it_gets_wasm_bindgen_version_in_crate_inside_workspace() {
[workspace]
members = ["./blah"]
"#,
)
.file(
).file(
"blah/Cargo.toml",
r#"
[package]
@ -48,8 +47,7 @@ fn it_gets_wasm_bindgen_version_in_crate_inside_workspace() {
[dependencies]
wasm-bindgen = "=0.2.21"
"#,
)
.file(
).file(
"blah/src/lib.rs",
r#"
extern crate wasm_bindgen;
@ -75,8 +73,7 @@ fn it_gets_wasm_bindgen_version_from_dependencies() {
[workspace]
members = ["./parent", "./child"]
"#,
)
.file(
).file(
"child/Cargo.toml",
r#"
[package]
@ -93,8 +90,7 @@ fn it_gets_wasm_bindgen_version_from_dependencies() {
[dependencies]
wasm-bindgen = "=0.2.21"
"#,
)
.file(
).file(
"child/src/lib.rs",
r#"
extern crate wasm_bindgen;
@ -103,8 +99,7 @@ fn it_gets_wasm_bindgen_version_from_dependencies() {
#[wasm_bindgen]
pub fn hello() -> u32 { 42 }
"#,
)
.file(
).file(
"parent/Cargo.toml",
r#"
[package]
@ -118,8 +113,7 @@ fn it_gets_wasm_bindgen_version_from_dependencies() {
[lib]
crate-type = ["cdylib"]
"#,
)
.file(
).file(
"parent/src/lib.rs",
r#"
// Just re-export all of `child`.

@ -65,9 +65,11 @@ fn it_creates_a_package_json_default_path() {
let crate_data = manifest::CrateData::new(&fixture.path).unwrap();
let step = wasm_pack::progressbar::Step::new(1);
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap();
assert!(crate_data
assert!(
crate_data
.write_package_json(&out_dir, &None, false, "", &step)
.is_ok());
.is_ok()
);
let package_json_path = &fixture.path.join("pkg").join("package.json");
fs::metadata(package_json_path).unwrap();
utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap();
@ -101,9 +103,11 @@ fn it_creates_a_package_json_provided_path() {
let crate_data = manifest::CrateData::new(&fixture.path).unwrap();
let step = wasm_pack::progressbar::Step::new(1);
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap();
assert!(crate_data
assert!(
crate_data
.write_package_json(&out_dir, &None, false, "", &step)
.is_ok());
.is_ok()
);
let package_json_path = &fixture.path.join("pkg").join("package.json");
fs::metadata(package_json_path).unwrap();
utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap();
@ -130,9 +134,11 @@ fn it_creates_a_package_json_provided_path_with_scope() {
let crate_data = manifest::CrateData::new(&fixture.path).unwrap();
let step = wasm_pack::progressbar::Step::new(1);
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap();
assert!(crate_data
assert!(
crate_data
.write_package_json(&out_dir, &Some("test".to_string()), false, "", &step)
.is_ok());
.is_ok()
);
let package_json_path = &fixture.path.join("pkg").join("package.json");
fs::metadata(package_json_path).unwrap();
utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap();
@ -159,9 +165,11 @@ fn it_creates_a_pkg_json_with_correct_files_on_node() {
let crate_data = manifest::CrateData::new(&fixture.path).unwrap();
let step = wasm_pack::progressbar::Step::new(1);
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap();
assert!(crate_data
assert!(
crate_data
.write_package_json(&out_dir, &None, false, "nodejs", &step)
.is_ok());
.is_ok()
);
let package_json_path = &out_dir.join("package.json");
fs::metadata(package_json_path).unwrap();
utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap();
@ -195,9 +203,11 @@ fn it_creates_a_pkg_json_with_correct_files_on_nomodules() {
let crate_data = manifest::CrateData::new(&fixture.path).unwrap();
let step = wasm_pack::progressbar::Step::new(1);
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap();
assert!(crate_data
assert!(
crate_data
.write_package_json(&out_dir, &None, false, "no-modules", &step)
.is_ok());
.is_ok()
);
let package_json_path = &out_dir.join("package.json");
fs::metadata(package_json_path).unwrap();
utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap();
@ -230,9 +240,11 @@ fn it_creates_a_pkg_json_in_out_dir() {
let crate_data = manifest::CrateData::new(&fixture.path).unwrap();
let step = wasm_pack::progressbar::Step::new(1);
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap();
assert!(crate_data
assert!(
crate_data
.write_package_json(&out_dir, &None, false, "", &step)
.is_ok());
.is_ok()
);
let package_json_path = &fixture.path.join(&out_dir).join("package.json");
fs::metadata(package_json_path).unwrap();
@ -246,9 +258,11 @@ fn it_creates_a_package_json_with_correct_keys_when_types_are_skipped() {
let crate_data = manifest::CrateData::new(&fixture.path).unwrap();
let step = wasm_pack::progressbar::Step::new(1);
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap();
assert!(crate_data
assert!(
crate_data
.write_package_json(&out_dir, &None, true, "", &step)
.is_ok());
.is_ok()
);
let package_json_path = &out_dir.join("package.json");
fs::metadata(package_json_path).unwrap();
utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap();

Loading…
Cancel
Save