aboutsummaryrefslogtreecommitdiff
path: root/crates/test_utils/src
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-03-16 14:28:02 +0000
committerLukas Wirth <[email protected]>2021-03-16 14:28:02 +0000
commit75fafd6fcc010c71d770d19bea4b744b92c5267b (patch)
tree8a2426ff2bb880689a331203346c5dc2229fbb37 /crates/test_utils/src
parente97cd709cd91ccfafbd45bab8b2bf01f3ddf6a04 (diff)
Add new_source_root meta to test fixtures
Diffstat (limited to 'crates/test_utils/src')
-rw-r--r--crates/test_utils/src/fixture.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/crates/test_utils/src/fixture.rs b/crates/test_utils/src/fixture.rs
index e3f57f3b2..6bc824e94 100644
--- a/crates/test_utils/src/fixture.rs
+++ b/crates/test_utils/src/fixture.rs
@@ -14,6 +14,7 @@ pub struct Fixture {
14 pub cfg_key_values: Vec<(String, String)>, 14 pub cfg_key_values: Vec<(String, String)>,
15 pub edition: Option<String>, 15 pub edition: Option<String>,
16 pub env: FxHashMap<String, String>, 16 pub env: FxHashMap<String, String>,
17 pub introduce_new_source_root: bool,
17} 18}
18 19
19impl Fixture { 20impl Fixture {
@@ -70,6 +71,7 @@ impl Fixture {
70 let mut cfg_atoms = Vec::new(); 71 let mut cfg_atoms = Vec::new();
71 let mut cfg_key_values = Vec::new(); 72 let mut cfg_key_values = Vec::new();
72 let mut env = FxHashMap::default(); 73 let mut env = FxHashMap::default();
74 let mut introduce_new_source_root = false;
73 for component in components[1..].iter() { 75 for component in components[1..].iter() {
74 let (key, value) = split_once(component, ':').unwrap(); 76 let (key, value) = split_once(component, ':').unwrap();
75 match key { 77 match key {
@@ -91,11 +93,22 @@ impl Fixture {
91 } 93 }
92 } 94 }
93 } 95 }
96 "new_source_root" => introduce_new_source_root = true,
94 _ => panic!("bad component: {:?}", component), 97 _ => panic!("bad component: {:?}", component),
95 } 98 }
96 } 99 }
97 100
98 Fixture { path, text: String::new(), krate, deps, cfg_atoms, cfg_key_values, edition, env } 101 Fixture {
102 path,
103 text: String::new(),
104 krate,
105 deps,
106 cfg_atoms,
107 cfg_key_values,
108 edition,
109 env,
110 introduce_new_source_root,
111 }
99 } 112 }
100} 113}
101 114