Skip to content

Commit 6b2ff7a

Browse files
authored
Remove no arg test (#11) Check Shell Script Path (#9)
* ✅ Remove no arg test * 🐛 Makes sure that the path to script given is valid
1 parent 102eadd commit 6b2ff7a

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

src/cli.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ impl Cli {
9090
debug!("Configuring for shell mode...");
9191
debug!("Script Path = {:?}", sub_matcher.value_of("script"));
9292
debug!("Watch Pattern = {:?}", sub_matcher.value_of("watch"));
93+
if !Path::new(sub_matcher.value_of("script").unwrap()).exists() {
94+
error!("Given path to script does not exist!");
95+
std::process::exit(1);
96+
}
9397
let split = sub_matcher.value_of("watch").unwrap().split(',');
9498
for s in split {
9599
watch_patterns.push(format!("*{}", s.to_string()));

tests/cli.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,10 @@
11
extern crate assert_cmd;
22
extern crate predicates;
3-
use std::path::Path;
43

54
use assert_cmd::prelude::*;
65
//use predicates::prelude::*;
76
use std::process::Command;
87

9-
#[test]
10-
fn no_configuration_fails() -> Result<(), Box<dyn std::error::Error>> {
11-
let mut cmd = Command::cargo_bin("lightmon")?;
12-
if Path::new("package.json").exists() || Path::new("Cargo.toml").exists() {
13-
Ok(())
14-
} else {
15-
cmd.assert().failure();
16-
Ok(())
17-
}
18-
}
19-
208
#[test]
219
fn unsupported_configuration_fails() -> Result<(), Box<dyn std::error::Error>> {
2210
let mut cmd = Command::cargo_bin("lightmon")?;

0 commit comments

Comments
 (0)