diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 44a61dc20..32350e58e 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -41,6 +41,12 @@ static VERSION: &str = env!("CARGO_PKG_VERSION"); pub fn uumain(args: Vec) -> i32 { 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("v", "version", "output version information and exit"); diff --git a/tests/test_more.rs b/tests/test_more.rs new file mode 100644 index 000000000..9d4835769 --- /dev/null +++ b/tests/test_more.rs @@ -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); +} diff --git a/tests/tests.rs b/tests/tests.rs index b802bd4ea..6361178fb 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -78,6 +78,7 @@ generic! { "ls", test_ls; "mkdir", test_mkdir; "mktemp", test_mktemp; + "more", test_more; "mv", test_mv; "numfmt", test_numfmt; "nl", test_nl;