Skip to content

Commit d454de7

Browse files
Use tesutils in tests
1 parent 38af3e0 commit d454de7

File tree

4 files changed

+24
-15
lines changed

4 files changed

+24
-15
lines changed

Cargo.lock

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ structopt = "0.3.5"
1313

1414
[dev-dependencies]
1515
assert_cmd = "0.11.1"
16-
predicates = "1.0.2"
1716
assert_fs = "0.13.1"
17+
predicates = "1.0.2"
18+
testutils = { path = "testutils" }

tests/cli_test.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ fn dump_file() {
5858
.assert()
5959
.success();
6060

61-
assert!(predicate::str::similar(EXPECTED_OUT)
62-
.from_utf8()
63-
.from_file_path()
64-
.eval(out_file.path()));
61+
testutils::assert_that!(
62+
out_file.path(),
63+
predicate::str::similar(EXPECTED_OUT)
64+
.from_utf8()
65+
.from_file_path(),
66+
);
6567
}

tests/dump_test.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
extern crate corewa_rs;
22

3-
fn run_test(input: &str, expected_output: &str) {
4-
eprintln!("Parsing warrior:");
5-
eprintln!("{}", input);
6-
3+
fn run_test(input: &str, expected_output: &'static str) {
74
let mut parsed_core = corewa_rs::parse(input).unwrap_or_else(|e| panic!("Parse error:\n{}", e));
5+
6+
// TODO: dump and check output of pre-resolved core
87
parsed_core
98
.result
109
.resolve()
1110
.unwrap_or_else(|e| panic!("{}", e));
1211

13-
// TODO: dump and check output of pre-resolved core
14-
15-
eprintln!("Loaded core:");
16-
dbg!(&parsed_core);
17-
18-
assert_eq!(parsed_core.to_string(), expected_output);
12+
testutils::assert_that!(
13+
&parsed_core.to_string(),
14+
predicates::str::similar(expected_output),
15+
);
1916
}
2017

2118
#[test]

0 commit comments

Comments
 (0)