blob: e101c79de408d24fb8d8c626d9806ccb1edc9519 (
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
|
//! 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);
}
}
macro_rules! stub {
($name:ident) => {
#[test]
#[ignore = "not yet ported (Filesystem path helpers plus on-disk size/copy/symlink/junction fixtures)"]
fn $name() {
todo!()
}
};
}
stub!(test_find_shortest_path_code);
stub!(test_find_shortest_path);
stub!(test_remove_directory_php);
stub!(test_file_size);
stub!(test_directory_size);
stub!(test_normalize_path);
stub!(test_unlink_symlinked_directory);
stub!(test_remove_symlinked_directory_with_trailing_slash);
stub!(test_junctions);
stub!(test_override_junctions);
stub!(test_copy);
stub!(test_copy_then_remove);
|