Skip to content

Commit

Permalink
Use std::env::EXE_SUFFIX in new tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fhahn committed Sep 30, 2015
1 parent f0647ea commit d9615d7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
18 changes: 12 additions & 6 deletions tests/test_cargo_clean.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::env;

use support::{project, execs, main_file, basic_bin_manifest};
use hamcrest::{assert_that, existing_dir, existing_file, is_not};

Expand Down Expand Up @@ -74,16 +76,20 @@ test!(clean_multiple_packages {
.arg("-p").arg("foo"),
execs().with_status(0));

let d1_path = &p.build_dir().join("debug").join("deps")
.join(format!("d1{}", env::consts::EXE_SUFFIX));
let d2_path = &p.build_dir().join("debug").join("deps")
.join(format!("d2{}", env::consts::EXE_SUFFIX));


assert_that(&p.bin("foo"), existing_file());
assert_that(&p.build_dir().join("debug").join("deps").join("d1"), existing_file());
assert_that(&p.build_dir().join("debug").join("deps").join("d2"), existing_file());
assert_that(d1_path, existing_file());
assert_that(d2_path, existing_file());

assert_that(p.cargo("clean").arg("-p").arg("d1").arg("-p").arg("d2")
.cwd(&p.root().join("src")),
execs().with_status(0).with_stdout(""));
assert_that(&p.bin("foo"), existing_file());
assert_that(&p.build_dir().join("debug").join("deps").join("d1"),
is_not(existing_file()));
assert_that(&p.build_dir().join("debug").join("deps").join("d2"),
is_not(existing_file()));
assert_that(d1_path, is_not(existing_file()));
assert_that(d2_path, is_not(existing_file()));
});
14 changes: 9 additions & 5 deletions tests/test_cargo_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1975,12 +1975,16 @@ test!(build_multiple_packages {
assert_that(process(&p.bin("foo")).unwrap(),
execs().with_stdout("i am foo\n"));

assert_that(&p.build_dir().join("debug").join("deps").join("d1"), existing_file());
assert_that(process(&p.build_dir().join("debug").join("deps").join("d1")).unwrap(),
execs().with_stdout("d1"));
let d1_path = &p.build_dir().join("debug").join("deps")
.join(format!("d1{}", env::consts::EXE_SUFFIX));
let d2_path = &p.build_dir().join("debug").join("deps")
.join(format!("d2{}", env::consts::EXE_SUFFIX));

assert_that(&p.build_dir().join("debug").join("deps").join("d2"), existing_file());
assert_that(process(&p.build_dir().join("debug").join("deps").join("d2")).unwrap(),
assert_that(d1_path, existing_file());
assert_that(process(d1_path).unwrap(), execs().with_stdout("d1"));

assert_that(d2_path, existing_file());
assert_that(process(d2_path).unwrap(),
execs().with_stdout("d2"));
});

Expand Down

0 comments on commit d9615d7

Please sign in to comment.