MCPcopy Create free account
hub / github.com/Recordscript/recordscript / test_overwrite_settings

Function test_overwrite_settings

libs/hbb_common/src/config.rs:2198–2338  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2196
2197 #[test]
2198 fn test_overwrite_settings() {
2199 DEFAULT_SETTINGS
2200 .write()
2201 .unwrap()
2202 .insert("b".to_string(), "a".to_string());
2203 DEFAULT_SETTINGS
2204 .write()
2205 .unwrap()
2206 .insert("c".to_string(), "a".to_string());
2207 CONFIG2
2208 .write()
2209 .unwrap()
2210 .options
2211 .insert("a".to_string(), "b".to_string());
2212 CONFIG2
2213 .write()
2214 .unwrap()
2215 .options
2216 .insert("b".to_string(), "b".to_string());
2217 OVERWRITE_SETTINGS
2218 .write()
2219 .unwrap()
2220 .insert("b".to_string(), "c".to_string());
2221 OVERWRITE_SETTINGS
2222 .write()
2223 .unwrap()
2224 .insert("c".to_string(), "f".to_string());
2225 OVERWRITE_SETTINGS
2226 .write()
2227 .unwrap()
2228 .insert("d".to_string(), "c".to_string());
2229 let mut res: HashMap<String, String> = Default::default();
2230 res.insert("b".to_owned(), "c".to_string());
2231 res.insert("d".to_owned(), "c".to_string());
2232 res.insert("c".to_owned(), "a".to_string());
2233 Config::purify_options(&mut res);
2234 assert!(res.len() == 0);
2235 res.insert("b".to_owned(), "c".to_string());
2236 res.insert("d".to_owned(), "c".to_string());
2237 res.insert("c".to_owned(), "a".to_string());
2238 res.insert("f".to_owned(), "a".to_string());
2239 Config::purify_options(&mut res);
2240 assert!(res.len() == 1);
2241 res.insert("b".to_owned(), "c".to_string());
2242 res.insert("d".to_owned(), "c".to_string());
2243 res.insert("c".to_owned(), "a".to_string());
2244 res.insert("f".to_owned(), "a".to_string());
2245 res.insert("e".to_owned(), "d".to_string());
2246 Config::purify_options(&mut res);
2247 assert!(res.len() == 2);
2248 res.insert("b".to_owned(), "c".to_string());
2249 res.insert("d".to_owned(), "c".to_string());
2250 res.insert("c".to_owned(), "a".to_string());
2251 res.insert("f".to_owned(), "a".to_string());
2252 res.insert("c".to_owned(), "d".to_string());
2253 res.insert("d".to_owned(), "cc".to_string());
2254 Config::purify_options(&mut res);
2255 assert!(res.len() == 2);

Callers

nothing calls this directly

Calls 3

writeMethod · 0.80
to_stringMethod · 0.80
clearMethod · 0.80

Tested by

no test coverage detected