freebsd-nq/contrib/bmake/unit-tests/cond-op-not.mk
Simon J. Gerraty dba7b0ef92 Merge bmake-20210206
Changes of interest

  o unit-tests: use private TMPDIR to avoid errors from other users
  o avoid strdup in mkTempFile
  o always use vfork
  o job.c: do not create empty shell files in jobs mode
    reduce unnecessary calls to waitpid
  o cond.c: fix debug output for comparison operators in conditionals
2021-02-10 22:03:22 -08:00

67 lines
1.2 KiB
Makefile

# $NetBSD: cond-op-not.mk,v 1.7 2021/01/19 17:49:13 rillig Exp $
#
# Tests for the ! operator in .if conditions, which negates its argument.
# The exclamation mark negates its operand.
.if !1
. error
.endif
# Exclamation marks can be chained.
# This doesn't happen in practice though.
.if !!!1
. error
.endif
# The ! binds more tightly than the &&.
.if !!0 && 1
. error
.endif
# The operator '==' binds more tightly than '!'.
# This is unusual since most other programming languages define the precedence
# to be the other way round.
.if !${:Uexpression} == "expression"
. error
.endif
.if !${:U}
. info Not empty evaluates to true.
.else
. info Not empty evaluates to false.
.endif
.if !${:U }
. info Not space evaluates to true.
.else
. info Not space evaluates to false.
.endif
.if !${:U0}
. info Not 0 evaluates to true.
.else
. info Not 0 evaluates to false.
.endif
.if !${:U1}
. info Not 1 evaluates to true.
.else
. info Not 1 evaluates to false.
.endif
.if !${:Uword}
. info Not word evaluates to true.
.else
. info Not word evaluates to false.
.endif
# A single exclamation mark is a parse error.
.if !
. error
.else
. error
.endif
all:
@:;