|
|
|
@ -34,7 +34,7 @@ fn it_copies_a_license_default_path() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
|
fn it_copies_a_license_provied_path() { |
|
|
|
|
fn it_copies_a_license_provided_path() { |
|
|
|
|
let fixture = fixture::single_license(); |
|
|
|
|
let out_dir = fixture.path.join("pkg"); |
|
|
|
|
fs::create_dir(&out_dir).expect("should create pkg directory OK"); |
|
|
|
@ -128,3 +128,30 @@ fn it_copies_all_licenses_provided_path() { |
|
|
|
|
let pkg_license_2 = utils::file::read_file(&pkg_license_path_2).unwrap(); |
|
|
|
|
assert_eq!(crate_license_2, pkg_license_2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
|
fn it_copies_a_non_standard_license_provided_path() { |
|
|
|
|
let license_file = "NON-STANDARD-LICENSE"; |
|
|
|
|
let fixture = fixture::non_standard_license(license_file); |
|
|
|
|
let out_dir = fixture.path.join("pkg"); |
|
|
|
|
fs::create_dir(&out_dir).expect("should create pkg directory OK"); |
|
|
|
|
let crate_data = CrateData::new(&fixture.path); |
|
|
|
|
|
|
|
|
|
let step = wasm_pack::progressbar::Step::new(1); |
|
|
|
|
assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir, &step).is_ok()); |
|
|
|
|
|
|
|
|
|
let crate_license_path = fixture.path.join(license_file); |
|
|
|
|
let pkg_license_path = out_dir.join(license_file); |
|
|
|
|
println!( |
|
|
|
|
"wasm-pack: should have copied LICENSE from '{}' to '{}'", |
|
|
|
|
crate_license_path.display(), |
|
|
|
|
pkg_license_path.display() |
|
|
|
|
); |
|
|
|
|
assert!(fs::metadata(&crate_license_path).is_ok()); |
|
|
|
|
|
|
|
|
|
assert!(fs::metadata(&pkg_license_path).is_ok()); |
|
|
|
|
|
|
|
|
|
let crate_license = utils::file::read_file(&crate_license_path).unwrap(); |
|
|
|
|
let pkg_license = utils::file::read_file(&pkg_license_path).unwrap(); |
|
|
|
|
assert_eq!(crate_license, pkg_license); |
|
|
|
|
} |
|
|
|
|