aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/util/filesystem_test.rs
blob: 39fa256337c566926107026f50a05489f543f0ab (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//! ref: composer/tests/Composer/Test/Util/FilesystemTest.php

// These exercise Filesystem path helpers and on-disk operations (sizes, copy, symlinks and
// junctions over a temp tree). The filesystem fixtures and platform-specific symlink/junction
// behaviour are not ported.
use shirabe::util::filesystem::Filesystem;
use shirabe_php_shim::{dirname, is_dir, is_file};

#[allow(dead_code)]
struct SetUp {
    fs: Filesystem,
    working_dir: String,
    test_file: String,
}

#[allow(dead_code)]
fn set_up() -> SetUp {
    let fs = Filesystem::new(None);
    // getUniqueTmpDirectory is base TestCase infrastructure that is not ported.
    let working_dir: String = todo!();
    #[allow(unreachable_code)]
    let unique_tmp: String = todo!();
    #[allow(unreachable_code)]
    let test_file: String = format!("{unique_tmp}/composer_test_file");
    #[allow(unreachable_code)]
    SetUp {
        fs,
        working_dir,
        test_file,
    }
}

#[allow(dead_code)]
fn tear_down(set_up: &mut SetUp) {
    if is_dir(&set_up.working_dir) {
        let _ = set_up.fs.remove_directory(&set_up.working_dir);
    }
    if is_file(&set_up.test_file) {
        let _ = set_up.fs.remove_directory(dirname(&set_up.test_file));
    }
}

#[allow(dead_code)]
struct TearDown {
    set_up: SetUp,
}

impl Drop for TearDown {
    fn drop(&mut self) {
        tear_down(&mut self.set_up);
    }
}

#[test]
#[ignore = "not yet ported (Filesystem path helpers plus on-disk size/copy/symlink/junction fixtures)"]
fn test_find_shortest_path_code() {
    todo!()
}

#[test]
#[ignore = "not yet ported (Filesystem path helpers plus on-disk size/copy/symlink/junction fixtures)"]
fn test_find_shortest_path() {
    todo!()
}

#[test]
#[ignore = "not yet ported (Filesystem path helpers plus on-disk size/copy/symlink/junction fixtures)"]
fn test_remove_directory_php() {
    todo!()
}

#[test]
#[ignore = "not yet ported (Filesystem path helpers plus on-disk size/copy/symlink/junction fixtures)"]
fn test_file_size() {
    todo!()
}

#[test]
#[ignore = "not yet ported (Filesystem path helpers plus on-disk size/copy/symlink/junction fixtures)"]
fn test_directory_size() {
    todo!()
}

#[test]
#[ignore = "not yet ported (Filesystem path helpers plus on-disk size/copy/symlink/junction fixtures)"]
fn test_normalize_path() {
    todo!()
}

#[test]
#[ignore = "not yet ported (Filesystem path helpers plus on-disk size/copy/symlink/junction fixtures)"]
fn test_unlink_symlinked_directory() {
    todo!()
}

#[test]
#[ignore = "not yet ported (Filesystem path helpers plus on-disk size/copy/symlink/junction fixtures)"]
fn test_remove_symlinked_directory_with_trailing_slash() {
    todo!()
}

#[test]
#[ignore = "not yet ported (Filesystem path helpers plus on-disk size/copy/symlink/junction fixtures)"]
fn test_junctions() {
    todo!()
}

#[test]
#[ignore = "not yet ported (Filesystem path helpers plus on-disk size/copy/symlink/junction fixtures)"]
fn test_override_junctions() {
    todo!()
}

#[test]
#[ignore = "not yet ported (Filesystem path helpers plus on-disk size/copy/symlink/junction fixtures)"]
fn test_copy() {
    todo!()
}

#[test]
#[ignore = "not yet ported (Filesystem path helpers plus on-disk size/copy/symlink/junction fixtures)"]
fn test_copy_then_remove() {
    todo!()
}