-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcli.rs
More file actions
39 lines (33 loc) · 975 Bytes
/
cli.rs
File metadata and controls
39 lines (33 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use assert_cmd::Command;
use predicates::str::contains;
use tempfile::tempdir;
use std::fs;
#[test]
fn examples_lists_templates() {
let mut cmd = Command::cargo_bin("dwf").unwrap();
cmd.arg("examples")
.assert()
.success()
.stdout(contains("rust-default"));
}
#[test]
fn init_creates_dwf_toml() {
let dir = tempdir().unwrap();
std::env::set_current_dir(dir.path()).unwrap();
let mut cmd = Command::cargo_bin("dwf").unwrap();
cmd.args(["init", "--template", "rust-default"])
.assert()
.success();
let s = fs::read_to_string(dir.path().join("dwf.toml")).unwrap();
assert!(s.contains("pipeline"));
}
#[test]
fn run_fails_without_dwf_toml() {
let dir = tempdir().unwrap();
std::env::set_current_dir(dir.path()).unwrap();
let mut cmd = Command::cargo_bin("dwf").unwrap();
cmd.args(["run", "fast"])
.assert()
.failure()
.stderr(contains("dwf.toml not found"));
}