diff options
Diffstat (limited to 'contrib/bmake/unit-tests/cond-cmp-numeric.mk')
-rw-r--r-- | contrib/bmake/unit-tests/cond-cmp-numeric.mk | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/contrib/bmake/unit-tests/cond-cmp-numeric.mk b/contrib/bmake/unit-tests/cond-cmp-numeric.mk index b1ec3e719d47..e025b99b27cd 100644 --- a/contrib/bmake/unit-tests/cond-cmp-numeric.mk +++ b/contrib/bmake/unit-tests/cond-cmp-numeric.mk @@ -1,6 +1,9 @@ -# $NetBSD: cond-cmp-numeric.mk,v 1.4 2020/11/08 22:56:16 rillig Exp $ +# $NetBSD: cond-cmp-numeric.mk,v 1.7 2023/03/04 08:07:29 rillig Exp $ # # Tests for numeric comparisons in .if conditions. +# +# See also: +# cond-token-number.mk .MAKEFLAGS: -dc @@ -8,11 +11,13 @@ # Even if strtod(3) parses "INF" as +Infinity, make does not accept this # since it is not really a number; see TryParseNumber. +# expect+1: Comparison with '>' requires both operands 'INF' and '1e100' to be numeric .if !(${:UINF} > 1e100) . error .endif # Neither is NaN a number; see TryParseNumber. +# expect+1: Comparison with '>' requires both operands 'NaN' and 'NaN' to be numeric .if ${:UNaN} > NaN . error .endif @@ -29,13 +34,27 @@ # whether the operator is valid, leaving the rest of the work to the # evaluation functions EvalCompareNum and EvalCompareStr. Ensure that this # parse error is properly reported. -# -# XXX: The warning message does not mention the actual operator. +# expect+1: Malformed conditional (123 ! 123) .if 123 ! 123 . error .else . error .endif +# Leading spaces are allowed for numbers. +# See EvalCompare and TryParseNumber. +.if ${:U 123} < 124 +.else +. error +.endif + +# Trailing spaces are NOT allowed for numbers. +# See EvalCompare and TryParseNumber. +# expect+1: Comparison with '<' requires both operands '123 ' and '124' to be numeric +.if ${:U123 } < 124 +. error +.else +. error +.endif + all: - @:; |