fork of https://github.com/rustwasm/wasm-pack for the needs of NextGraph.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Pauan 846b989b9a
Merge pull request #694 from Pauan/quiet
5 years ago
..
utils fix(deps): update deprecated code for std::sync::Once 5 years ago
build.rs Merge pull request #684 from rustwasm/gameldar-627-bindgen-version-error 6 years ago
download.rs feat(command): add generate command 6 years ago
generate.rs feat(command): add generate command 6 years ago
license.rs initial support for --out-name added 6 years ago
lockfile.rs initial support for --out-name added 6 years ago
log_level.rs Adding in unit tests for --quiet and --log-level 6 years ago
main.rs Merge pull request #694 from Pauan/quiet 5 years ago
manifest.rs Fix sideEffects value in generated package.json should be empty 6 years ago
readme.rs Fix tests 6 years ago
stamps.rs fix(command_test): stamps.rs check driver once per day, update RELEASE_CHECKLIST 6 years ago
test.rs Don't always capture stdout, selectively do it 6 years ago
wasm_opt.rs Add support for automatically executing `wasm-opt` 6 years ago
webdriver.rs Remove the no longer needed `Step` type 6 years ago

readme.rs

extern crate failure;
extern crate wasm_pack;

use std::fs;

use utils::{self, fixture};
use wasm_pack::readme;

#[test]
fn it_copies_a_readme_default_path() {
let fixture = fixture::js_hello_world();
let out_dir = fixture.path.join("pkg");
fs::create_dir(&out_dir).expect("should create pkg directory OK");

assert!(readme::copy_from_crate(&fixture.path, &out_dir).is_ok());

let crate_readme_path = fixture.path.join("README.md");
let pkg_readme_path = out_dir.join("README.md");
println!(
"wasm-pack: should have copied README.md from '{}' to '{}'",
crate_readme_path.display(),
pkg_readme_path.display()
);
assert!(fs::metadata(&crate_readme_path).is_ok());

assert!(fs::metadata(&pkg_readme_path).is_ok());

let crate_readme = utils::file::read_file(&crate_readme_path).unwrap();
let pkg_readme = utils::file::read_file(&pkg_readme_path).unwrap();
assert_eq!(crate_readme, pkg_readme);
}

#[test]
fn it_copies_a_readme_provided_path() {
let fixture = fixture::js_hello_world();
let out_dir = fixture.path.join("pkg");
fs::create_dir(&out_dir).expect("should create pkg directory OK");

assert!(readme::copy_from_crate(&fixture.path, &out_dir).is_ok());
let crate_readme_path = fixture.path.join("README.md");
let pkg_readme_path = out_dir.join("README.md");
println!(
"wasm-pack: should have copied README.md from '{}' to '{}'",
crate_readme_path.display(),
pkg_readme_path.display()
);
assert!(fs::metadata(&crate_readme_path).is_ok());
assert!(fs::metadata(&pkg_readme_path).is_ok());

let crate_readme = utils::file::read_file(&crate_readme_path).unwrap();
let pkg_readme = utils::file::read_file(&pkg_readme_path).unwrap();
assert_eq!(crate_readme, pkg_readme);
}