sagiegurari / cargo-make
1
use super::*;
2
use envmnt;
3

4
#[test]
5 8
fn normalize_profile_same() {
6 8
    let output = normalize_profile("test");
7

8 8
    assert_eq!(output, "test");
9 8
}
10

11
#[test]
12 8
fn normalize_profile_mixed_case() {
13 8
    let output = normalize_profile("tEst");
14

15 8
    assert_eq!(output, "test");
16 8
}
17

18
#[test]
19 8
fn normalize_profile_spaces() {
20 8
    let output = normalize_profile("  test  ");
21

22 8
    assert_eq!(output, "test");
23 8
}
24

25
#[test]
26 8
fn normalize_profile_case_and_spaces() {
27 8
    let output = normalize_profile("  tEst  ");
28

29 8
    assert_eq!(output, "test");
30 8
}
31

32
#[test]
33 8
fn normalize_additional_profiles_empty() {
34 8
    let output = normalize_additional_profiles(&vec![]);
35

36 8
    let vec: Vec<String> = vec![];
37 8
    assert_eq!(output, vec);
38 8
}
39

40
#[test]
41 8
fn normalize_additional_profiles_single() {
42 8
    let output = normalize_additional_profiles(&vec!["  TEst  ".to_string()]);
43

44 8
    assert_eq!(output, vec!["test".to_string()]);
45 8
}
46

47
#[test]
48 8
fn normalize_additional_profiles_multiple() {
49
    let output =
50 8
        normalize_additional_profiles(&vec!["  TEst  ".to_string(), "  test2  ".to_string()]);
51

52 8
    assert_eq!(output, vec!["test".to_string(), "test2".to_string()]);
53 8
}
54

55
#[test]
56
#[ignore]
57 2
fn get_not_defined() {
58 2
    envmnt::remove("CARGO_MAKE_PROFILE");
59 2
    let output = get();
60 2
    assert_eq!(output, "development".to_string());
61 2
}
62

63
#[test]
64
#[ignore]
65 2
fn get_defined() {
66 2
    envmnt::set("CARGO_MAKE_PROFILE", "TEST123");
67 2
    let output = get();
68 2
    assert_eq!(output, "TEST123".to_string());
69 2
}
70

71
#[test]
72
#[ignore]
73 2
fn set_empty() {
74 2
    envmnt::remove("CARGO_MAKE_PROFILE");
75 2
    let mut output = set("");
76 2
    assert_eq!(output, "development".to_string());
77 2
    output = get();
78 2
    assert_eq!(output, "development".to_string());
79 2
    output = envmnt::get_or_panic("CARGO_MAKE_PROFILE");
80 2
    assert_eq!(output, "development".to_string());
81 2
}
82

83
#[test]
84
#[ignore]
85 2
fn set_spaces() {
86 2
    envmnt::remove("CARGO_MAKE_PROFILE");
87 2
    let mut output = set("   ");
88 2
    assert_eq!(output, "development".to_string());
89 2
    output = get();
90 2
    assert_eq!(output, "development".to_string());
91 2
    output = envmnt::get_or_panic("CARGO_MAKE_PROFILE");
92 2
    assert_eq!(output, "development".to_string());
93 2
}
94

95
#[test]
96
#[ignore]
97 2
fn set_mixed() {
98 2
    envmnt::remove("CARGO_MAKE_PROFILE");
99 2
    let mut output = set("   SOME profile NAME  ");
100 2
    assert_eq!(output, "some profile name".to_string());
101 2
    output = get();
102 2
    assert_eq!(output, "some profile name".to_string());
103 2
    output = envmnt::get_or_panic("CARGO_MAKE_PROFILE");
104 2
    assert_eq!(output, "some profile name".to_string());
105 2
}
106

107
#[test]
108
#[ignore]
109 2
fn set_additional_multiple() {
110 2
    envmnt::remove("CARGO_MAKE_ADDITIONAL_PROFILES");
111 2
    set_additional(&vec!["  TEst1  ".to_string(), "  test2  ".to_string()]);
112 2
    let output = envmnt::get_or_panic("CARGO_MAKE_ADDITIONAL_PROFILES");
113 2
    assert_eq!(output, "test1;test2".to_string());
114 2
}

Read our documentation on viewing source code .

Loading