aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/config/json_config_source_test.rs
blob: 2d101aa0c8d9c4e9b7e59f1ac838d6768a9b3d36 (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
//! ref: composer/tests/Composer/Test/Config/JsonConfigSourceTest.php

use shirabe::util::filesystem::Filesystem;
use std::path::PathBuf;
use tempfile::TempDir;

fn set_up() -> TearDown {
    let fs = Filesystem::new(None);
    // getUniqueTmpDirectory creates a fresh unique temp directory.
    let working_dir = TempDir::new().unwrap();
    TearDown { fs, working_dir }
}

struct TearDown {
    fs: Filesystem,
    working_dir: TempDir,
}

impl TearDown {
    fn working_dir(&self) -> PathBuf {
        self.working_dir.path().to_path_buf()
    }
}

impl Drop for TearDown {
    fn drop(&mut self) {
        let working_dir = self.working_dir.path();
        if working_dir.is_dir() {
            self.fs.remove_directory(working_dir).unwrap();
        }
    }
}

// JsonConfigSource edits composer.json through JsonManipulator, whose text-rewriting
// operations reach addcslashes (todo!()) in the php-shim.
#[test]
#[ignore = "JsonConfigSource uses JsonManipulator, which reaches addcslashes (todo!()) in the php-shim"]
fn test_add_repository() {
    let _tear_down = set_up();
    todo!()
}

#[test]
#[ignore = "JsonConfigSource uses JsonManipulator, which reaches addcslashes (todo!()) in the php-shim"]
fn test_add_repository_as_list() {
    let _tear_down = set_up();
    todo!()
}

#[test]
#[ignore = "JsonConfigSource uses JsonManipulator, which reaches addcslashes (todo!()) in the php-shim"]
fn test_add_repository_with_options() {
    let _tear_down = set_up();
    todo!()
}

#[test]
#[ignore = "JsonConfigSource uses JsonManipulator, which reaches addcslashes (todo!()) in the php-shim"]
fn test_remove_repository() {
    let _tear_down = set_up();
    todo!()
}

#[test]
#[ignore = "JsonConfigSource uses JsonManipulator, which reaches addcslashes (todo!()) in the php-shim"]
fn test_add_packagist_repository_with_false_value() {
    let _tear_down = set_up();
    todo!()
}

#[test]
#[ignore = "JsonConfigSource uses JsonManipulator, which reaches addcslashes (todo!()) in the php-shim"]
fn test_remove_packagist() {
    let _tear_down = set_up();
    todo!()
}

#[test]
#[ignore = "JsonConfigSource uses JsonManipulator, which reaches addcslashes (todo!()) in the php-shim"]
fn test_add_link() {
    let _tear_down = set_up();
    todo!()
}

#[test]
#[ignore = "JsonConfigSource uses JsonManipulator, which reaches addcslashes (todo!()) in the php-shim"]
fn test_remove_link() {
    let _tear_down = set_up();
    todo!()
}