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

3
#[test]
4
#[ignore]
5 2
fn get_storage_directory_no_env_no_os_dir() {
6 2
    envmnt::remove("CARGO_MAKE_HOME");
7

8 2
    let directory = get_storage_directory(None, "test.txt", false).unwrap();
9 2
    let legacy_directory = get_legacy_directory().unwrap();
10

11 2
    assert_eq!(directory, legacy_directory);
12 2
}
13

14
#[test]
15
#[ignore]
16 2
fn get_storage_directory_with_env() {
17 2
    let env_directory = env::current_dir().unwrap();
18 2
    envmnt::set("CARGO_MAKE_HOME", env_directory.to_str().unwrap());
19

20 2
    let directory = get_storage_directory(None, "test.txt", false).unwrap();
21

22 2
    envmnt::remove("CARGO_MAKE_HOME");
23

24 2
    assert_eq!(directory, env_directory);
25 2
}
26

27
#[test]
28
#[ignore]
29 2
fn get_storage_directory_no_env_with_os_dir_file_exists() {
30 2
    envmnt::remove("CARGO_MAKE_HOME");
31

32 2
    let path = env::current_dir().unwrap();
33 2
    let mut os_directory = path.join("examples");
34 2
    let directory = get_storage_directory(Some(os_directory.clone()), "cache.toml", true).unwrap();
35

36 2
    os_directory = os_directory.join("cargo-make");
37 2
    assert_eq!(directory, os_directory);
38 2
}

Read our documentation on viewing source code .

Loading