-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathexamples.rs
37 lines (33 loc) · 998 Bytes
/
examples.rs
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
#[test]
fn expected_type() {
let target = "expected_type";
let expected = snapbox::file!["../examples/expected_type.svg": TermSvg];
assert_example(target, expected);
}
#[test]
fn footer() {
let target = "footer";
let expected = snapbox::file!["../examples/footer.svg": TermSvg];
assert_example(target, expected);
}
#[test]
fn format() {
let target = "format";
let expected = snapbox::file!["../examples/format.svg": TermSvg];
assert_example(target, expected);
}
#[test]
fn multislice() {
let target = "multislice";
let expected = snapbox::file!["../examples/multislice.svg": TermSvg];
assert_example(target, expected);
}
#[track_caller]
fn assert_example(target: &str, expected: snapbox::Data) {
let bin_path = snapbox::cmd::compile_example(target, ["--features=testing-colors"]).unwrap();
snapbox::cmd::Command::new(bin_path)
.env("CLICOLOR_FORCE", "1")
.assert()
.success()
.stdout_eq(expected.raw());
}