mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 11:07:44 +00:00
Merge pull request #1511 from sylvestre/more
fix(more) handle no arguments without panic; add test and a FixME
This commit is contained in:
commit
8e886c30dc
3 changed files with 15 additions and 0 deletions
|
@ -41,6 +41,12 @@ static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
pub fn uumain(args: Vec<String>) -> i32 {
|
pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
let mut opts = Options::new();
|
let mut opts = Options::new();
|
||||||
|
|
||||||
|
// FixME: fail without panic for now; but `more` should work with no arguments (ie, for piped input)
|
||||||
|
if args.len() < 2 {
|
||||||
|
println!("{}: incorrect usage", args[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
opts.optflag("h", "help", "display this help and exit");
|
opts.optflag("h", "help", "display this help and exit");
|
||||||
opts.optflag("v", "version", "output version information and exit");
|
opts.optflag("v", "version", "output version information and exit");
|
||||||
|
|
||||||
|
|
8
tests/test_more.rs
Normal file
8
tests/test_more.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use common::util::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_more_no_arg() {
|
||||||
|
let (_, mut ucmd) = at_and_ucmd!();
|
||||||
|
let result = ucmd.run();
|
||||||
|
assert!(!result.success);
|
||||||
|
}
|
|
@ -78,6 +78,7 @@ generic! {
|
||||||
"ls", test_ls;
|
"ls", test_ls;
|
||||||
"mkdir", test_mkdir;
|
"mkdir", test_mkdir;
|
||||||
"mktemp", test_mktemp;
|
"mktemp", test_mktemp;
|
||||||
|
"more", test_more;
|
||||||
"mv", test_mv;
|
"mv", test_mv;
|
||||||
"numfmt", test_numfmt;
|
"numfmt", test_numfmt;
|
||||||
"nl", test_nl;
|
"nl", test_nl;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue