Welcome to mirror list, hosted at ThFree Co, Russian Federation.

scratch.rs « tests « src - github.com/windirstat/walkdir.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 17bf95a37c8e0c72bd0e115a583049050a3c835d (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
use std::fs;
use std::path::PathBuf;

use crate::tests::util::{self, Dir};
use crate::Cursor;

#[test]
fn many_mixed() {
    let dir = Dir::tmp();
    dir.mkdirp("foo/a");
    dir.mkdirp("foo/c");
    dir.mkdirp("foo/e");
    dir.touch_all(&["foo/b", "foo/d", "foo/f"]);
    dir.touch_all(&["foo/c/bar", "foo/c/baz"]);
    dir.touch_all(&["foo/a/quux"]);

    let mut cur = Cursor::new(dir.path());
    loop {
        match cur.read() {
            Ok(None) => break,
            Ok(Some(entry)) => {
                println!("{:?}", entry.path());
            }
            Err(err) => {
                println!("ERROR: {}", err);
                break;
            }
        }
    }

    // let r = dir.run_recursive(wd);
    // r.assert_no_errors();
    //
    // let expected = vec![
    // dir.path().to_path_buf(),
    // dir.join("foo"),
    // dir.join("foo").join("a"),
    // dir.join("foo").join("b"),
    // dir.join("foo").join("c"),
    // dir.join("foo").join("d"),
    // dir.join("foo").join("e"),
    // dir.join("foo").join("f"),
    // ];
    // assert_eq!(expected, r.sorted_paths());
}