mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
test/expr: add simple value and EXIT_CODE tests
This commit is contained in:
parent
fe954e5825
commit
812d811ff6
1 changed files with 28 additions and 0 deletions
|
@ -2,6 +2,34 @@
|
||||||
|
|
||||||
use crate::common::util::*;
|
use crate::common::util::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_simple_values() {
|
||||||
|
// null or 0 => EXIT_VALUE == 1
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&[""])
|
||||||
|
.fails()
|
||||||
|
.status_code(1)
|
||||||
|
.stdout_only("\n");
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["0"])
|
||||||
|
.fails()
|
||||||
|
.status_code(1)
|
||||||
|
.stdout_only("0\n");
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["00"])
|
||||||
|
.fails()
|
||||||
|
.status_code(1)
|
||||||
|
.stdout_only("00\n");
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["-0"])
|
||||||
|
.fails()
|
||||||
|
.status_code(1)
|
||||||
|
.stdout_only("-0\n");
|
||||||
|
|
||||||
|
// non-null and non-0 => EXIT_VALUE = 0
|
||||||
|
new_ucmd!().args(&["1"]).succeeds().stdout_only("1\n");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_simple_arithmetic() {
|
fn test_simple_arithmetic() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue