File: examples.rs

package info (click to toggle)
rust-annotate-snippets 0.11.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 524 kB
  • sloc: makefile: 2
file content (37 lines) | stat: -rw-r--r-- 998 bytes parent folder | download
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());
}