aboutsummaryrefslogtreecommitdiff
path: root/unit-tests/cond-op.mk
diff options
context:
space:
mode:
Diffstat (limited to 'unit-tests/cond-op.mk')
-rw-r--r--unit-tests/cond-op.mk40
1 files changed, 37 insertions, 3 deletions
diff --git a/unit-tests/cond-op.mk b/unit-tests/cond-op.mk
index 170355f6c0ad..2ed451c90391 100644
--- a/unit-tests/cond-op.mk
+++ b/unit-tests/cond-op.mk
@@ -1,4 +1,4 @@
-# $NetBSD: cond-op.mk,v 1.10 2020/11/15 14:58:14 rillig Exp $
+# $NetBSD: cond-op.mk,v 1.13 2021/01/19 18:20:30 rillig Exp $
#
# Tests for operators like &&, ||, ! in .if conditions.
#
@@ -61,8 +61,8 @@
# As soon as the parser sees the '$', it knows that the condition will
# be malformed. Therefore there is no point in evaluating it.
#
-# As of 2020-09-11, that part of the condition is evaluated nevertheless,
-# since CondParser_Expr just requests the next token, without restricting
+# As of 2021-01-20, that part of the condition is evaluated nevertheless,
+# since CondParser_Or just requests the next token, without restricting
# the token to the expected tokens. If the parser were to restrict the
# valid follow tokens for the token "0" to those that can actually produce
# a correct condition (which in this case would be comparison operators,
@@ -98,5 +98,39 @@
. endfor
.endfor
+# This condition is obviously malformed. It is properly detected and also
+# was properly detected before 2021-01-19, but only because the left hand
+# side of the '&&' evaluated to true.
+.if 1 &&
+. error
+.else
+. error
+.endif
+
+# This obviously malformed condition was not detected as such before cond.c
+# 1.238 from 2021-01-19.
+.if 0 &&
+. error
+.else
+. error
+.endif
+
+# This obviously malformed condition was not detected as such before cond.c
+# 1.238 from 2021-01-19.
+.if 1 ||
+. error
+.else
+. error
+.endif
+
+# This condition is obviously malformed. It is properly detected and also
+# was properly detected before 2021-01-19, but only because the left hand
+# side of the '||' evaluated to false.
+.if 0 ||
+. error
+.else
+. error
+.endif
+
all:
@:;