mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 11:07:44 +00:00
test: fix namespace and broken test
I separated test's main() into a separate file to override Cargo's requirement for matching crate names. I had to update the build command to use a special extern reference for test. Fixes issues caused by #728.
This commit is contained in:
parent
b469b2e316
commit
012414c49f
4 changed files with 15 additions and 18 deletions
19
build.rs
19
build.rs
|
@ -29,7 +29,8 @@ pub fn main() {
|
|||
let mut map: UtilityMap = HashMap::new();\n".as_bytes()).unwrap();
|
||||
for krate in crates {
|
||||
match krate.as_ref() {
|
||||
"false" | "true" | "test" => {},
|
||||
"false" | "true" => {},
|
||||
"test" => cf.write_all(format!("extern crate uu{krate};\n", krate=krate).as_bytes()).unwrap(),
|
||||
_ => cf.write_all(format!("extern crate {krate} as uu{krate};\n", krate=krate).as_bytes()).unwrap(),
|
||||
}
|
||||
|
||||
|
@ -43,16 +44,12 @@ pub fn main() {
|
|||
map.insert(\"sha384sum\", uuhashsum::uumain);
|
||||
map.insert(\"sha512sum\", uuhashsum::uumain);\n".as_bytes()).unwrap();
|
||||
},
|
||||
"true" => {
|
||||
mf.write_all(format!("fn uu{}", krate).as_bytes()).unwrap();
|
||||
mf.write_all("(_: Vec<String>) -> i32 { 0 }\n".as_bytes()).unwrap();
|
||||
mf.write_all(format!("map.insert(\"{krate}\", uu{krate} as fn(Vec<String>) -> i32);\n", krate=krate).as_bytes()).unwrap();
|
||||
}
|
||||
"false" | "test" => {
|
||||
mf.write_all(format!("fn uu{}", krate).as_bytes()).unwrap();
|
||||
mf.write_all("(_: Vec<String>) -> i32 { 1 }\n".as_bytes()).unwrap();
|
||||
mf.write_all(format!("map.insert(\"{krate}\", uu{krate} as fn(Vec<String>) -> i32);\n", krate=krate).as_bytes()).unwrap();
|
||||
},
|
||||
"false" =>
|
||||
mf.write_all("fn uufalse(_: Vec<String>) -> i32 { 1 }
|
||||
map.insert(\"false\", uufalse as fn(Vec<String>) -> i32);\n".as_bytes()).unwrap(),
|
||||
"true" =>
|
||||
mf.write_all("fn uutrue(_: Vec<String>) -> i32 { 0 }
|
||||
map.insert(\"true\", uutrue as fn(Vec<String>) -> i32);\n".as_bytes()).unwrap(),
|
||||
_ =>
|
||||
mf.write_all(format!("map.insert(\"{krate}\", uu{krate}::uumain as fn(Vec<String>) -> i32);\n", krate= krate).as_bytes()).unwrap(),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue