Run cargo fmt

master
Nick Fitzgerald 7 years ago
parent 6d3e9dfebb
commit 098eb33cea
  1. 6
      tests/all/bindgen.rs
  2. 7
      tests/all/build.rs
  3. 42
      tests/all/manifest.rs

@ -31,9 +31,7 @@ fn downloading_prebuilt_wasm_bindgen_handles_http_errors() {
let error = result.err().unwrap(); let error = result.err().unwrap();
assert!(error.iter_chain().any(|e| e.to_string().contains("404"))); assert!(error.iter_chain().any(|e| e.to_string().contains("404")));
assert!( assert!(error
error
.iter_chain() .iter_chain()
.any(|e| e.to_string().contains(bad_version)) .any(|e| e.to_string().contains(bad_version)));
);
} }

@ -17,10 +17,9 @@ fn build_in_non_crate_directory_doesnt_panic() {
"running wasm-pack in a non-crate directory should fail, but it should not panic" "running wasm-pack in a non-crate directory should fail, but it should not panic"
); );
let err = result.unwrap_err(); let err = result.unwrap_err();
assert!( assert!(err
err.iter_chain() .iter_chain()
.any(|e| e.to_string().contains("missing a `Cargo.toml`")) .any(|e| e.to_string().contains("missing a `Cargo.toml`")));
);
} }
#[test] #[test]

@ -65,11 +65,9 @@ fn it_creates_a_package_json_default_path() {
let crate_data = manifest::CargoManifest::read(&fixture.path).unwrap(); let crate_data = manifest::CargoManifest::read(&fixture.path).unwrap();
let step = wasm_pack::progressbar::Step::new(1); let step = wasm_pack::progressbar::Step::new(1);
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap();
assert!( assert!(crate_data
crate_data
.write_package_json(&out_dir, &None, false, "", &step) .write_package_json(&out_dir, &None, false, "", &step)
.is_ok() .is_ok());
);
let package_json_path = &fixture.path.join("pkg").join("package.json"); let package_json_path = &fixture.path.join("pkg").join("package.json");
assert!(fs::metadata(package_json_path).is_ok()); assert!(fs::metadata(package_json_path).is_ok());
assert!(utils::manifest::read_package_json(&fixture.path, &out_dir).is_ok()); assert!(utils::manifest::read_package_json(&fixture.path, &out_dir).is_ok());
@ -103,11 +101,9 @@ fn it_creates_a_package_json_provided_path() {
let crate_data = manifest::CargoManifest::read(&fixture.path).unwrap(); let crate_data = manifest::CargoManifest::read(&fixture.path).unwrap();
let step = wasm_pack::progressbar::Step::new(1); let step = wasm_pack::progressbar::Step::new(1);
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap();
assert!( assert!(crate_data
crate_data
.write_package_json(&out_dir, &None, false, "", &step) .write_package_json(&out_dir, &None, false, "", &step)
.is_ok() .is_ok());
);
let package_json_path = &fixture.path.join("pkg").join("package.json"); let package_json_path = &fixture.path.join("pkg").join("package.json");
assert!(fs::metadata(package_json_path).is_ok()); assert!(fs::metadata(package_json_path).is_ok());
utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap();
@ -134,11 +130,9 @@ fn it_creates_a_package_json_provided_path_with_scope() {
let crate_data = manifest::CargoManifest::read(&fixture.path).unwrap(); let crate_data = manifest::CargoManifest::read(&fixture.path).unwrap();
let step = wasm_pack::progressbar::Step::new(1); let step = wasm_pack::progressbar::Step::new(1);
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap();
assert!( assert!(crate_data
crate_data
.write_package_json(&out_dir, &Some("test".to_string()), false, "", &step) .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"); let package_json_path = &fixture.path.join("pkg").join("package.json");
assert!(fs::metadata(package_json_path).is_ok()); assert!(fs::metadata(package_json_path).is_ok());
assert!(utils::manifest::read_package_json(&fixture.path, &out_dir).is_ok()); assert!(utils::manifest::read_package_json(&fixture.path, &out_dir).is_ok());
@ -165,11 +159,9 @@ fn it_creates_a_pkg_json_with_correct_files_on_node() {
let crate_data = manifest::CargoManifest::read(&fixture.path).unwrap(); let crate_data = manifest::CargoManifest::read(&fixture.path).unwrap();
let step = wasm_pack::progressbar::Step::new(1); let step = wasm_pack::progressbar::Step::new(1);
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap();
assert!( assert!(crate_data
crate_data
.write_package_json(&out_dir, &None, false, "nodejs", &step) .write_package_json(&out_dir, &None, false, "nodejs", &step)
.is_ok() .is_ok());
);
let package_json_path = &out_dir.join("package.json"); let package_json_path = &out_dir.join("package.json");
assert!(fs::metadata(package_json_path).is_ok()); assert!(fs::metadata(package_json_path).is_ok());
utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap();
@ -202,11 +194,9 @@ fn it_creates_a_pkg_json_with_correct_files_on_nomodules() {
let crate_data = manifest::CargoManifest::read(&fixture.path).unwrap(); let crate_data = manifest::CargoManifest::read(&fixture.path).unwrap();
let step = wasm_pack::progressbar::Step::new(1); let step = wasm_pack::progressbar::Step::new(1);
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap();
assert!( assert!(crate_data
crate_data
.write_package_json(&out_dir, &None, false, "no-modules", &step) .write_package_json(&out_dir, &None, false, "no-modules", &step)
.is_ok() .is_ok());
);
let package_json_path = &out_dir.join("package.json"); let package_json_path = &out_dir.join("package.json");
assert!(fs::metadata(package_json_path).is_ok()); assert!(fs::metadata(package_json_path).is_ok());
utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap();
@ -239,11 +229,9 @@ fn it_creates_a_pkg_json_in_out_dir() {
let crate_data = manifest::CargoManifest::read(&fixture.path).unwrap(); let crate_data = manifest::CargoManifest::read(&fixture.path).unwrap();
let step = wasm_pack::progressbar::Step::new(1); let step = wasm_pack::progressbar::Step::new(1);
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap();
assert!( assert!(crate_data
crate_data
.write_package_json(&out_dir, &None, false, "", &step) .write_package_json(&out_dir, &None, false, "", &step)
.is_ok() .is_ok());
);
let package_json_path = &fixture.path.join(&out_dir).join("package.json"); let package_json_path = &fixture.path.join(&out_dir).join("package.json");
assert!(fs::metadata(package_json_path).is_ok()); assert!(fs::metadata(package_json_path).is_ok());
@ -257,11 +245,9 @@ fn it_creates_a_package_json_with_correct_keys_when_types_are_skipped() {
let crate_data = manifest::CargoManifest::read(&fixture.path).unwrap(); let crate_data = manifest::CargoManifest::read(&fixture.path).unwrap();
let step = wasm_pack::progressbar::Step::new(1); let step = wasm_pack::progressbar::Step::new(1);
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap();
assert!( assert!(crate_data
crate_data
.write_package_json(&out_dir, &None, true, "", &step) .write_package_json(&out_dir, &None, true, "", &step)
.is_ok() .is_ok());
);
let package_json_path = &out_dir.join("package.json"); let package_json_path = &out_dir.join("package.json");
assert!(fs::metadata(package_json_path).is_ok()); assert!(fs::metadata(package_json_path).is_ok());
assert!(utils::manifest::read_package_json(&fixture.path, &out_dir).is_ok()); assert!(utils::manifest::read_package_json(&fixture.path, &out_dir).is_ok());

Loading…
Cancel
Save