mirror of
https://github.com/uutils/coreutils
synced 2024-07-21 01:44:19 +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
20
Cargo.lock
generated
20
Cargo.lock
generated
|
@ -35,6 +35,7 @@ dependencies = [
|
|||
"link 0.0.1",
|
||||
"ln 0.0.1",
|
||||
"logname 0.0.1",
|
||||
"ls 0.0.1",
|
||||
"memchr 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mkdir 0.0.1",
|
||||
"mkfifo 0.0.1",
|
||||
|
@ -448,6 +449,16 @@ dependencies = [
|
|||
"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]]
|
||||
name = "memchr"
|
||||
version = "0.1.7"
|
||||
|
@ -571,6 +582,15 @@ dependencies = [
|
|||
"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]]
|
||||
name = "primal"
|
||||
version = "0.2.3"
|
||||
|
|
1
Makefile
1
Makefile
|
@ -146,6 +146,7 @@ TEST_PROGS := \
|
|||
head \
|
||||
link \
|
||||
ln \
|
||||
ls \
|
||||
mkdir \
|
||||
mktemp \
|
||||
mv \
|
||||
|
|
|
@ -89,8 +89,7 @@ fn help() {
|
|||
|
||||
fn list(options: getopts::Matches) {
|
||||
let locs: Vec<String> = if options.free.is_empty() {
|
||||
show_error!("Missing DIRECTORY or FILES argument. Try --help.");
|
||||
panic!();
|
||||
vec![String::from(".")]
|
||||
} else {
|
||||
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…
Reference in a new issue