"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "unit-tests/cond-cmp-unary.mk" between
bmake-20201101.tar.gz and bmake-20201117.tar.gz

About: bmake a BSD make tool (derived from NetBSD’s make).

cond-cmp-unary.mk  (bmake-20201101):cond-cmp-unary.mk  (bmake-20201117)
# $NetBSD: cond-cmp-unary.mk,v 1.1 2020/09/14 06:22:59 rillig Exp $ # $NetBSD: cond-cmp-unary.mk,v 1.2 2020/11/11 07:30:11 rillig Exp $
# #
# Tests for unary comparisons in .if conditions, that is, comparisons with # Tests for unary comparisons in .if conditions, that is, comparisons with
# a single operand. If the operand is a number, it is compared to zero, # a single operand. If the operand is a number, it is compared to zero,
# if it is a string, it is tested for emptiness. # if it is a string, it is tested for emptiness.
# The number 0 evaluates to false. # The number 0 evaluates to false.
.if 0 .if 0
. error . error
.endif .endif
skipping to change at line 28 skipping to change at line 28
.if "" .if ""
. error . error
.endif .endif
# Any other string evaluates to true. # Any other string evaluates to true.
.if !"0" .if !"0"
. error . error
.endif .endif
# The empty string may come from a variable expression. # The empty string may come from a variable expression.
#
# XXX: As of 2020-11-11, this empty string is interpreted "as a number" in
# EvalNotEmpty, which is plain wrong. The bug is in TryParseNumber.
.if ${:U} .if ${:U}
. error . error
.endif .endif
# A variable expression that is not surrounded by quotes is interpreted # A variable expression that is not surrounded by quotes is interpreted
# as a number if possible, otherwise as a string. # as a number if possible, otherwise as a string.
.if ${:U0} .if ${:U0}
. error . error
.endif .endif
# A non-zero number from a variable expression evaluates to true. # A non-zero number from a variable expression evaluates to true.
.if !${:U12345} .if !${:U12345}
. error . error
.endif .endif
# A string of whitespace should evaluate to false.
#
# XXX: As of 2020-11-11, the implementation in EvalNotEmpty does not skip
# whitespace before testing for the end. This was probably an oversight in
# a commit from 1992-04-15 saying "A variable is empty when it just contains
# spaces".
.if ${:U }
. info This is only reached because of a bug in EvalNotEmpty.
.else
. error
.endif
all: # nothing all: # nothing
 End of changes. 3 change blocks. 
1 lines changed or deleted 16 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)