diff options
-rw-r--r-- | eval.c | 6 | ||||
-rwxr-xr-x | tests.sh | 10 | ||||
-rw-r--r-- | tests/test_false.out | 0 | ||||
-rw-r--r-- | tests/test_true.out | 19 |
4 files changed, 35 insertions, 0 deletions
@@ -858,6 +858,8 @@ static bool eval_expr(struct expr *expr, struct eval_state *state) { } } + assert(!*state->quit); + bool ret = expr->eval(expr, state); if (time) { @@ -871,6 +873,10 @@ static bool eval_expr(struct expr *expr, struct eval_state *state) { ++expr->successes; } + assert(!expr->always_true || ret); + assert(!expr->always_false || !ret); + assert(!expr->never_returns || *state->quit); + return ret; } @@ -259,6 +259,8 @@ bsd_tests=( ) gnu_tests=( + test_true + test_false test_executable test_readable test_writable @@ -528,6 +530,14 @@ function test_path() { bfs_diff basic -path 'basic/*f*' } +function test_true() { + bfs_diff basic -true +} + +function test_false() { + bfs_diff basic -false +} + function test_executable() { bfs_diff perms -executable } diff --git a/tests/test_false.out b/tests/test_false.out new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/test_false.out diff --git a/tests/test_true.out b/tests/test_true.out new file mode 100644 index 0000000..bb3cd8d --- /dev/null +++ b/tests/test_true.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/e +basic/g +basic/i +basic/j +basic/k +basic/l +basic/c/d +basic/e/f +basic/g/h +basic/j/foo +basic/k/foo +basic/l/foo +basic/k/foo/bar +basic/l/foo/bar +basic/l/foo/bar/baz |