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

3
#[test]
4 8
fn create_text_file_read_and_delete() {
5 8
    let file = create_text_file("test\nend", ".testfile");
6 8
    assert!(file.ends_with(".testfile"));
7

8 8
    let text = fsio::file::read_text_file(&file).unwrap();
9

10 8
    let mut file_path = PathBuf::new();
11 8
    file_path.push(&file);
12 8
    let read_text = read_text_file(&file_path);
13

14 8
    delete_file(&file);
15

16 8
    assert_eq!("test\nend".to_string(), text);
17 8
    assert_eq!(read_text, text);
18 8
}
19

20
#[test]
21 8
fn write_text_file_read_and_delete() {
22 8
    let file = "./target/_temp/file.txt";
23 8
    let written = write_text_file(&file, "test\nend");
24 8
    assert!(written);
25

26 8
    let text = fsio::file::read_text_file(&file).unwrap();
27

28 8
    let mut file_path = PathBuf::new();
29 8
    file_path.push(&file);
30 8
    let read_text = read_text_file(&file_path);
31

32 8
    delete_file(&file);
33

34 8
    assert_eq!("test\nend".to_string(), text);
35 8
    assert_eq!(read_text, text);
36 8
}

Read our documentation on viewing source code .

Loading