From 033aaaa19bfbdc6fade5429ea5444ea26c32809e Mon Sep 17 00:00:00 2001 From: steveklabnik Date: Wed, 14 Mar 2018 16:45:49 +0100 Subject: [PATCH] Move examples into tests/fixtures These aren't examples in the sense Cargo uses them; they're test fixtures. As such, let's put them in tests/ Fixes #56 --- {examples => tests/fixtures}/js-hello-world/Cargo.lock | 0 {examples => tests/fixtures}/js-hello-world/Cargo.toml | 0 {examples => tests/fixtures}/js-hello-world/README.md | 0 {examples => tests/fixtures}/js-hello-world/src/lib.rs | 0 {examples => tests/fixtures}/no-readme/Cargo.lock | 0 {examples => tests/fixtures}/no-readme/Cargo.toml | 0 {examples => tests/fixtures}/no-readme/src/lib.rs | 0 tests/manifest.rs | 6 +++--- tests/readme.rs | 2 +- 9 files changed, 4 insertions(+), 4 deletions(-) rename {examples => tests/fixtures}/js-hello-world/Cargo.lock (100%) rename {examples => tests/fixtures}/js-hello-world/Cargo.toml (100%) rename {examples => tests/fixtures}/js-hello-world/README.md (100%) rename {examples => tests/fixtures}/js-hello-world/src/lib.rs (100%) rename {examples => tests/fixtures}/no-readme/Cargo.lock (100%) rename {examples => tests/fixtures}/no-readme/Cargo.toml (100%) rename {examples => tests/fixtures}/no-readme/src/lib.rs (100%) diff --git a/examples/js-hello-world/Cargo.lock b/tests/fixtures/js-hello-world/Cargo.lock similarity index 100% rename from examples/js-hello-world/Cargo.lock rename to tests/fixtures/js-hello-world/Cargo.lock diff --git a/examples/js-hello-world/Cargo.toml b/tests/fixtures/js-hello-world/Cargo.toml similarity index 100% rename from examples/js-hello-world/Cargo.toml rename to tests/fixtures/js-hello-world/Cargo.toml diff --git a/examples/js-hello-world/README.md b/tests/fixtures/js-hello-world/README.md similarity index 100% rename from examples/js-hello-world/README.md rename to tests/fixtures/js-hello-world/README.md diff --git a/examples/js-hello-world/src/lib.rs b/tests/fixtures/js-hello-world/src/lib.rs similarity index 100% rename from examples/js-hello-world/src/lib.rs rename to tests/fixtures/js-hello-world/src/lib.rs diff --git a/examples/no-readme/Cargo.lock b/tests/fixtures/no-readme/Cargo.lock similarity index 100% rename from examples/no-readme/Cargo.lock rename to tests/fixtures/no-readme/Cargo.lock diff --git a/examples/no-readme/Cargo.toml b/tests/fixtures/no-readme/Cargo.toml similarity index 100% rename from examples/no-readme/Cargo.toml rename to tests/fixtures/no-readme/Cargo.toml diff --git a/examples/no-readme/src/lib.rs b/tests/fixtures/no-readme/src/lib.rs similarity index 100% rename from examples/no-readme/src/lib.rs rename to tests/fixtures/no-readme/src/lib.rs diff --git a/tests/manifest.rs b/tests/manifest.rs index 54f5a14..223b06a 100644 --- a/tests/manifest.rs +++ b/tests/manifest.rs @@ -18,9 +18,9 @@ fn it_gets_the_crate_name_default_path() { #[test] fn it_gets_the_crate_name_provided_path() { - assert!(manifest::get_crate_name("./examples/js-hello-world").is_ok()); + assert!(manifest::get_crate_name("tests/fixtures/js-hello-world").is_ok()); assert_eq!( - manifest::get_crate_name("./examples/js-hello-world").unwrap(), + manifest::get_crate_name("tests/fixtures/js-hello-world").unwrap(), "js-hello-world" ); } @@ -45,7 +45,7 @@ fn it_creates_a_package_json_default_path() { #[test] fn it_creates_a_package_json_provided_path() { - let path = "./examples/js-hello-world".to_string(); + let path = "tests/fixtures/js-hello-world".to_string(); wasm_pack::create_pkg_dir(&path).unwrap(); assert!(manifest::write_package_json(&path).is_ok()); let package_json_path = format!("{}/pkg/package.json", &path); diff --git a/tests/readme.rs b/tests/readme.rs index 4e3b6a3..fac3f8a 100644 --- a/tests/readme.rs +++ b/tests/readme.rs @@ -21,7 +21,7 @@ fn it_copies_a_readme_default_path() { #[test] fn it_creates_a_package_json_provided_path() { - let path = "./examples/js-hello-world".to_string(); + let path = "tests/fixtures/js-hello-world".to_string(); assert!(readme::copy_from_crate(&path).is_ok()); let crate_readme_path = format!("{}/README.md", &path); let pkg_readme_path = format!("{}/pkg/README.md", &path);