1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

Merge pull request #5559 from pawelngei/expr-substr-error

expr: different stderr with `expr "56" "substr"`
This commit is contained in:
Sylvestre Ledru 2023-11-22 14:56:42 +01:00 committed by GitHub
commit af021e0d4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 4 deletions

View file

@ -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
@ -295,6 +303,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()