aboutsummaryrefslogtreecommitdiff
path: root/tests/cli.rs
diff options
context:
space:
mode:
authorOndřej Čertík <ondrej@certik.us>2020-01-27 19:00:29 -0700
committerOndřej Čertík <ondrej@certik.us>2020-01-27 21:52:55 -0700
commitc109de444b913b23766df1378e583d9cab77bda5 (patch)
tree046baa3f5a9844d16948b4efadd216a6c5a13101 /tests/cli.rs
parentb8f2216c94983aaa93b1917825437bdbc4341adf (diff)
downloadfpm-c109de444b913b23766df1378e583d9cab77bda5.tar.gz
fpm-c109de444b913b23766df1378e583d9cab77bda5.zip
Implement fpm_bin() with absolute path
Diffstat (limited to 'tests/cli.rs')
-rw-r--r--tests/cli.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/cli.rs b/tests/cli.rs
index 38b0419..d03e449 100644
--- a/tests/cli.rs
+++ b/tests/cli.rs
@@ -43,9 +43,16 @@ impl Success2 for Assert {
}
}
+fn fpm_bin() -> Command {
+ let mut fpm_bin_relative: std::path::PathBuf = ["target", "debug", "fpm"].iter().collect();
+ fpm_bin_relative.set_extension(std::env::consts::EXE_EXTENSION);
+ let fpm_bin_absolute = std::fs::canonicalize(fpm_bin_relative).unwrap();
+ Command::new(fpm_bin_absolute.to_str().unwrap())
+}
+
#[test]
fn test_help() {
- let mut cmd = Command::new("./target/debug/fpm");
+ let mut cmd = fpm_bin();
cmd.arg("--help");
cmd.assert()
.success2()
@@ -56,7 +63,7 @@ fn test_help() {
#[test]
fn test_1() {
- let mut build = Command::new("./target/debug/fpm");
+ let mut build = fpm_bin();
build.arg("build")
.arg("--target-dir")
.arg("build-test")
@@ -66,7 +73,7 @@ fn test_1() {
.stdout(predicate::str::contains("Built target p1")
.and(predicate::str::contains("TEST1 OK").not()));
- let mut run = Command::new("./target/debug/fpm");
+ let mut run = fpm_bin();
run.arg("run")
.current_dir("tests/1");
run.assert()
@@ -76,7 +83,7 @@ fn test_1() {
#[test]
fn test_2() {
- let mut build = Command::new("./target/debug/fpm");
+ let mut build = fpm_bin();
build.arg("build")
.arg("--target-dir")
.arg("build-test")
@@ -86,7 +93,7 @@ fn test_2() {
.stdout(predicate::str::contains("Built target p1")
.and(predicate::str::contains("TEST2 OK").not()));
- let mut run = Command::new("./target/debug/fpm");
+ let mut run = fpm_bin();
run.arg("run")
.current_dir("tests/2");
run.assert()