1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2026-01-17 02:31:02 +00:00

Fix namespace collision for test.

To avoid linking issues with Rust's libtest, the crate for the test
utility was changed to 'uutest'. However, the user doesn't need to see
this so a few hoops were jumped through to make this transparent.

I also updated the make rules to build the individual features first and
then uutils. This makes 'make && make test' look more organized.
This commit is contained in:
Joseph Crail 2015-11-27 01:54:18 -05:00
parent cfadcfaf64
commit d4e0ea41a3
6 changed files with 19 additions and 30 deletions

View file

@ -1,10 +1,10 @@
[package]
name = "test_uu"
name = "test"
version = "0.0.1"
authors = []
[lib]
name = "test_uu"
name = "uutest"
path = "test.rs"
[dependencies]
@ -13,5 +13,5 @@ libc = "*"
uucore = { path="../uucore" }
[[bin]]
name="test"
name="uutest"
path="test.rs"

View file

@ -1,4 +1,4 @@
#![crate_name = "test_uu"]
#![crate_name = "uutest"]
/*
* This file is part of the uutils coreutils package.

View file

@ -20,21 +20,13 @@ static VERSION: &'static str = env!("CARGO_PKG_VERSION");
include!(concat!(env!("OUT_DIR"), "/uutils_map.rs"));
fn name_sub(util_name: &str) -> &str {
match util_name {
"test" => "test_uu",
"test_uu" => "test",
x @ _ => x
}
}
fn usage(cmap: &UtilityMap) {
println!("{} {}", NAME, VERSION);
println!("");
println!("Usage:");
println!(" {} [util [arguments...]]\n", NAME);
println!("Currently defined functions:");
let mut utils: Vec<&str> = cmap.keys().map(|&s| name_sub(s)).collect();
let mut utils: Vec<&str> = cmap.keys().map(|&s| s).collect();
utils.sort();
for util in utils.iter() {
println!("\t{}", util);
@ -72,7 +64,7 @@ fn main() {
args.remove(0);
let util = &args[0][..];
match umap.get(name_sub(util)) {
match umap.get(util) {
Some(&uumain) => {
std::process::exit(uumain(args.clone()));
}
@ -81,7 +73,7 @@ fn main() {
// see if they want help on a specific util
if args.len() >= 2 {
let util = &args[1][..];
match umap.get(name_sub(util)) {
match umap.get(util) {
Some(&uumain) => {
std::process::exit(uumain(vec![util.to_string(), "--help".to_string()]));
}