From a6bbcfd78c3bf5ea902b29183769425e7662bd71 Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Thu, 11 Apr 2019 15:32:59 -0500 Subject: [PATCH] test(generate): test default and provided name --- tests/all/generate.rs | 30 ++++++++++++++++++++++++++++++ tests/all/main.rs | 1 + 2 files changed, 31 insertions(+) create mode 100644 tests/all/generate.rs diff --git a/tests/all/generate.rs b/tests/all/generate.rs new file mode 100644 index 00000000..e020b03a --- /dev/null +++ b/tests/all/generate.rs @@ -0,0 +1,30 @@ +use assert_cmd::prelude::*; +use std::str; +use utils; + +#[test] +fn generate_with_defaults() { + let fixture = utils::fixture::not_a_crate(); + let cmd = fixture.wasm_pack().arg("generate").assert().failure(); + + let output = cmd.get_output(); + + assert!(str::from_utf8(&output.stdout) + .unwrap() + .contains("hello-wasm")); +} + +#[test] +fn generate_with_provided_name() { + let fixture = utils::fixture::not_a_crate(); + let cmd = fixture + .wasm_pack() + .arg("generate") + .arg("--name ferris") + .assert() + .failure(); + + let output = cmd.get_output(); + + assert!(str::from_utf8(&output.stdout).unwrap().contains("ferris")); +} diff --git a/tests/all/main.rs b/tests/all/main.rs index 08004a1f..1eda752a 100644 --- a/tests/all/main.rs +++ b/tests/all/main.rs @@ -13,6 +13,7 @@ extern crate wasm_pack; mod build; mod download; +mod generate; mod license; mod lockfile; mod manifest;