sagiegurari / cargo-make
1
use super::*;
2
use envmnt;
3
use std::env;
4
use std::path::PathBuf;
5

6
#[test]
7 8
fn load_from_path_exists() {
8 8
    let cwd = env::current_dir().unwrap();
9 8
    let path = cwd.join("examples/cargo-make");
10 8
    let cache_data = load_from_path(path);
11

12 8
    assert_eq!(cache_data.last_update_check.unwrap(), 1000u64);
13 8
}
14

15
#[test]
16 8
fn load_from_path_not_exists() {
17 8
    let path = PathBuf::from("examples2/.cargo-make");
18 8
    let cache_data = load_from_path(path);
19

20 8
    assert!(cache_data.last_update_check.is_none());
21 8
}
22

23
#[test]
24
#[ignore]
25 2
fn load_with_cargo_home() {
26 2
    let path = env::current_dir().unwrap();
27 2
    let directory = path.join("examples/cargo-make");
28 2
    envmnt::set("CARGO_MAKE_HOME", directory.to_str().unwrap());
29 2
    let cache_data = load();
30

31 2
    envmnt::remove("CARGO_MAKE_HOME");
32

33 2
    assert_eq!(cache_data.last_update_check.unwrap(), 1000u64);
34 2
}
35

36
#[test]
37
#[ignore]
38 2
fn load_without_cargo_home() {
39 2
    envmnt::remove("CARGO_MAKE_HOME");
40 2
    load();
41 2
}

Read our documentation on viewing source code .

Loading