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

expr: interpret numbers != 0 as true for | and &

This commit is contained in:
Daniel Hofstetter 2023-09-26 16:12:59 +02:00
parent ffbe452b01
commit ff500d7d6f
2 changed files with 20 additions and 3 deletions

View file

@ -113,6 +113,16 @@ fn test_or() {
.args(&["foo", "|", "bar"])
.succeeds()
.stdout_only("foo\n");
new_ucmd!()
.args(&["14", "|", "1"])
.succeeds()
.stdout_only("14\n");
new_ucmd!()
.args(&["-14", "|", "1"])
.succeeds()
.stdout_only("-14\n");
}
#[test]
@ -123,6 +133,13 @@ fn test_and() {
.stdout_only("foo\n");
new_ucmd!().args(&["", "&", "1"]).run().stdout_is("0\n");
new_ucmd!().args(&["14", "&", "1"]).run().stdout_is("14\n");
new_ucmd!()
.args(&["-14", "&", "1"])
.run()
.stdout_is("-14\n");
}
#[test]