summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eval.c6
-rwxr-xr-xtests.sh10
-rw-r--r--tests/test_false.out0
-rw-r--r--tests/test_true.out19
4 files changed, 35 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index b095279..34ccba8 100644
--- a/eval.c
+++ b/eval.c
@@ -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;
}
diff --git a/tests.sh b/tests.sh
index 0e337bd..f0ada64 100755
--- a/tests.sh
+++ b/tests.sh
@@ -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