mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
expr: add tests for precise error messages
This commit is contained in:
@@ -6,6 +6,14 @@
|
||||
|
||||
use crate::common::util::TestScenario;
|
||||
|
||||
#[test]
|
||||
fn test_no_arguments() {
|
||||
new_ucmd!()
|
||||
.fails()
|
||||
.code_is(2)
|
||||
.stderr_only("expr: missing operand\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_simple_values() {
|
||||
// null or 0 => EXIT_VALUE == 1
|
||||
@@ -275,6 +283,12 @@ fn test_substr() {
|
||||
|
||||
#[test]
|
||||
fn test_invalid_substr() {
|
||||
new_ucmd!()
|
||||
.args(&["56", "substr"])
|
||||
.fails()
|
||||
.code_is(2)
|
||||
.stderr_only("expr: syntax error: unexpected argument 'substr'\n");
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["substr", "abc", "0", "1"])
|
||||
.fails()
|
||||
|
||||
Reference in New Issue
Block a user