aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/unit-tests/cond-op-and.mk
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bmake/unit-tests/cond-op-and.mk')
-rw-r--r--contrib/bmake/unit-tests/cond-op-and.mk48
1 files changed, 48 insertions, 0 deletions
diff --git a/contrib/bmake/unit-tests/cond-op-and.mk b/contrib/bmake/unit-tests/cond-op-and.mk
new file mode 100644
index 000000000000..83c694f15723
--- /dev/null
+++ b/contrib/bmake/unit-tests/cond-op-and.mk
@@ -0,0 +1,48 @@
+# $NetBSD: cond-op-and.mk,v 1.5 2020/10/24 08:46:08 rillig Exp $
+#
+# Tests for the && operator in .if conditions.
+
+.if 0 && 0
+. error
+.endif
+
+.if 1 && 0
+. error
+.endif
+
+.if 0 && 1
+. error
+.endif
+
+.if !(1 && 1)
+. error
+.endif
+
+# The right-hand side is not evaluated since the left-hand side is already
+# false.
+.if 0 && ${UNDEF}
+.endif
+
+# The && operator may be abbreviated as &. This is not widely known though
+# and is also not documented in the manual page.
+
+.if 0 & 0
+. error
+.endif
+.if 1 & 0
+. error
+.endif
+.if 0 & 1
+. error
+.endif
+.if !(1 & 1)
+. error
+.endif
+
+# There is no operator &&&.
+.if 0 &&& 0
+. error
+.endif
+
+all:
+ @:;