summaryrefslogtreecommitdiffstats
path: root/rust/vendor/test-case/tests/acceptance_tests.rs
blob: af30935b51023192589847c830ca14b8fde4be85 (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#![cfg(test)]

mod acceptance {
    use itertools::Itertools;
    use std::env;
    use std::path::PathBuf;
    use std::process::Command;

    #[test]
    fn basic() {
        let output = Command::new("cargo")
            .current_dir(PathBuf::from("acceptance_tests").join("basic"))
            .args(&["test"])
            .output()
            .expect("cargo command failed to start");

        let lines = String::from_utf8_lossy(&output.stdout)
            .to_string()
            .lines()
            .sorted()
            .join("\n");
        insta::assert_display_snapshot!(lines);
    }

    #[test]
    fn hamcrest_assertions() {
        let output = Command::new("cargo")
            .current_dir(PathBuf::from("acceptance_tests").join("hamcrest_assertions"))
            .args(&["test"])
            .output()
            .expect("cargo command failed to start");

        let lines = String::from_utf8_lossy(&output.stdout)
            .to_string()
            .lines()
            .sorted()
            .join("\n");
        insta::assert_display_snapshot!(lines);
    }

    #[test]
    fn r#async() {
        let output = Command::new("cargo")
            .current_dir(PathBuf::from("acceptance_tests").join("async"))
            .args(&["test"])
            .output()
            .expect("cargo command failed to start");

        let lines = String::from_utf8_lossy(&output.stdout)
            .to_string()
            .lines()
            .sorted()
            .join("\n");
        insta::assert_display_snapshot!(lines);
    }
}