mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
expr: add tests for precise error messages
This commit is contained in:
parent
d2ede92736
commit
8b650a7a9b
1 changed files with 14 additions and 0 deletions
|
@ -6,6 +6,14 @@
|
||||||
|
|
||||||
use crate::common::util::TestScenario;
|
use crate::common::util::TestScenario;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_no_arguments() {
|
||||||
|
new_ucmd!()
|
||||||
|
.fails()
|
||||||
|
.code_is(2)
|
||||||
|
.stderr_only("expr: missing operand\n");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_simple_values() {
|
fn test_simple_values() {
|
||||||
// null or 0 => EXIT_VALUE == 1
|
// null or 0 => EXIT_VALUE == 1
|
||||||
|
@ -275,6 +283,12 @@ fn test_substr() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_invalid_substr() {
|
fn test_invalid_substr() {
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["56", "substr"])
|
||||||
|
.fails()
|
||||||
|
.code_is(2)
|
||||||
|
.stderr_only("expr: syntax error: unexpected argument 'substr'\n");
|
||||||
|
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.args(&["substr", "abc", "0", "1"])
|
.args(&["substr", "abc", "0", "1"])
|
||||||
.fails()
|
.fails()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue