Skip to content

Commit

Permalink
simplify tests
Browse files Browse the repository at this point in the history
remove RUNNING, COMPILING, ERROR, DOCUMENTING, FRESH and UPDATING
constants
  • Loading branch information
matklad committed May 11, 2016
1 parent ae28ed3 commit 29cdad4
Show file tree
Hide file tree
Showing 34 changed files with 1,183 additions and 1,437 deletions.
6 changes: 0 additions & 6 deletions tests/support/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,12 +683,6 @@ fn substitute_macros(input: &str) -> String {
return result;
}

pub static RUNNING: &'static str = " Running";
pub static COMPILING: &'static str = " Compiling";
pub static ERROR: &'static str = "error:";
pub static DOCUMENTING: &'static str = " Documenting";
pub static FRESH: &'static str = " Fresh";
pub static UPDATING: &'static str = " Updating";
pub static ADDING: &'static str = " Adding";
pub static REMOVING: &'static str = " Removing";
pub static DOCTEST: &'static str = " Doc-tests";
Expand Down
11 changes: 5 additions & 6 deletions tests/test_bad_manifest_path.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use support::{project, execs, main_file, basic_bin_manifest, ERROR};
use support::{project, execs, main_file, basic_bin_manifest};
use hamcrest::{assert_that};

fn setup() {}
Expand All @@ -12,9 +12,8 @@ fn assert_not_a_cargo_toml(command: &str, manifest_path_argument: &str) {
.arg("--manifest-path").arg(manifest_path_argument)
.cwd(p.root().parent().unwrap()),
execs().with_status(101)
.with_stderr(&format!("{error} the manifest-path must be a path \
to a Cargo.toml file",
error = ERROR)));
.with_stderr(&format!("[ERROR] the manifest-path must be a path \
to a Cargo.toml file")));
}

#[allow(deprecated)] // connect => join in 1.3
Expand All @@ -28,8 +27,8 @@ fn assert_cargo_toml_doesnt_exist(command: &str, manifest_path_argument: &str) {
.cwd(p.root().parent().unwrap()),
execs().with_status(101)
.with_stderr(
format!("{error} manifest path `{}` does not exist",
expected_path, error = ERROR)
format!("[ERROR] manifest path `{}` does not exist",
expected_path)
));
}

Expand Down
12 changes: 5 additions & 7 deletions tests/test_cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::str;

use cargo_process;
use support::paths;
use support::{execs, project, mkdir_recursive, ProjectBuilder, ERROR};
use support::{execs, project, mkdir_recursive, ProjectBuilder};
use hamcrest::{assert_that};

fn setup() {
Expand Down Expand Up @@ -102,12 +102,11 @@ test!(find_closest_biuld_to_build {

assert_that(pr,
execs().with_status(101)
.with_stderr(&format!("{error} no such subcommand
.with_stderr(&format!("[ERROR] no such subcommand
<tab>Did you mean `build`?
",
error = ERROR)));
")));
});

// if a subcommand is more than 3 edit distance away, we don't make a suggestion
Expand All @@ -118,9 +117,8 @@ test!(find_closest_dont_correct_nonsense {

assert_that(pr,
execs().with_status(101)
.with_stderr(&format!("{error} no such subcommand
",
error = ERROR)));
.with_stderr(&format!("[ERROR] no such subcommand
")));
});

test!(override_cargo_home {
Expand Down
Loading

0 comments on commit 29cdad4

Please sign in to comment.