diff --git a/tests/by-util/test_expr.rs b/tests/by-util/test_expr.rs index 1064ef525..b70c60fb3 100644 --- a/tests/by-util/test_expr.rs +++ b/tests/by-util/test_expr.rs @@ -138,6 +138,11 @@ fn test_or() { .args(&["0", "|", "10", "/", "5"]) .succeeds() .stdout_only("2\n"); + + new_ucmd!() + .args(&["12", "|", "9a", "+", "1"]) + .succeeds() + .stdout_only("12\n"); } #[test] @@ -275,3 +280,23 @@ fn test_invalid_substr() { .code_is(1) .stdout_only("\n"); } + +#[test] +fn test_escape() { + new_ucmd!().args(&["+", "1"]).succeeds().stdout_only("1\n"); + + new_ucmd!() + .args(&["1", "+", "+", "1"]) + .succeeds() + .stdout_only("2\n"); + + new_ucmd!() + .args(&["2", "*", "+", "3"]) + .succeeds() + .stdout_only("6\n"); + + new_ucmd!() + .args(&["(", "1", ")", "+", "1"]) + .succeeds() + .stdout_only("2\n"); +}