mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
Adding tests for ls. Corrected issue with ls on the present directory throwing panic!()
This commit is contained in:
parent
825a850fa9
commit
0bb0c40c36
4 changed files with 38 additions and 2 deletions
20
Cargo.lock
generated
20
Cargo.lock
generated
|
@ -35,6 +35,7 @@ dependencies = [
|
||||||
"link 0.0.1",
|
"link 0.0.1",
|
||||||
"ln 0.0.1",
|
"ln 0.0.1",
|
||||||
"logname 0.0.1",
|
"logname 0.0.1",
|
||||||
|
"ls 0.0.1",
|
||||||
"memchr 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"memchr 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"mkdir 0.0.1",
|
"mkdir 0.0.1",
|
||||||
"mkfifo 0.0.1",
|
"mkfifo 0.0.1",
|
||||||
|
@ -448,6 +449,16 @@ dependencies = [
|
||||||
"uucore 0.0.1",
|
"uucore 0.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ls"
|
||||||
|
version = "0.0.1"
|
||||||
|
dependencies = [
|
||||||
|
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"pretty-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"uucore 0.0.1",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "0.1.7"
|
version = "0.1.7"
|
||||||
|
@ -571,6 +582,15 @@ dependencies = [
|
||||||
"uucore 0.0.1",
|
"uucore 0.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pretty-bytes"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "primal"
|
name = "primal"
|
||||||
version = "0.2.3"
|
version = "0.2.3"
|
||||||
|
|
1
Makefile
1
Makefile
|
@ -146,6 +146,7 @@ TEST_PROGS := \
|
||||||
head \
|
head \
|
||||||
link \
|
link \
|
||||||
ln \
|
ln \
|
||||||
|
ls \
|
||||||
mkdir \
|
mkdir \
|
||||||
mktemp \
|
mktemp \
|
||||||
mv \
|
mv \
|
||||||
|
|
|
@ -89,8 +89,7 @@ fn help() {
|
||||||
|
|
||||||
fn list(options: getopts::Matches) {
|
fn list(options: getopts::Matches) {
|
||||||
let locs: Vec<String> = if options.free.is_empty() {
|
let locs: Vec<String> = if options.free.is_empty() {
|
||||||
show_error!("Missing DIRECTORY or FILES argument. Try --help.");
|
vec![String::from(".")]
|
||||||
panic!();
|
|
||||||
} else {
|
} else {
|
||||||
options.free.iter().cloned().collect()
|
options.free.iter().cloned().collect()
|
||||||
};
|
};
|
||||||
|
|
16
tests/ls.rs
Normal file
16
tests/ls.rs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#[macro_use]
|
||||||
|
mod common;
|
||||||
|
|
||||||
|
use common::util::*;
|
||||||
|
|
||||||
|
static UTIL_NAME: &'static str = "ls";
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_ls_ls() {
|
||||||
|
let (at, mut ucmd) = testing(UTIL_NAME);
|
||||||
|
|
||||||
|
let result = ucmd.run();
|
||||||
|
|
||||||
|
let exit_success = result.success;
|
||||||
|
assert_eq!(exit_success, true);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue