diff options
author | Simon J. Gerraty <sjg@FreeBSD.org> | 2020-09-05 16:11:04 +0000 |
---|---|---|
committer | Simon J. Gerraty <sjg@FreeBSD.org> | 2020-09-05 16:11:04 +0000 |
commit | 6bbc783f48498b808e19db4441299dc7d85a278b (patch) | |
tree | be201219a56594c76537191ee91fdd3ef8cfb348 /unit-tests/cond-short.mk | |
parent | 367d32e2b15fe0397ddecccaa04cf9ed0164c969 (diff) |
Import bmake-20200902vendor/NetBSD/bmake/20200902
Lots of code refactoring, simplification and cleanup.
Lots of new unit-tests providing much higher code coverage.
All courtesy of rillig at netbsd.
Other significant changes:
o new read-only variable .SHELL which provides the path of the shell
used to run scripts (as defined by the .SHELL target).
o new debug option -dl: LINT mode, does the equivalent of := for all
variable assignments so that file and line number are reported for
variable parse errors.
Notes
Notes:
svn path=/vendor/NetBSD/bmake/dist/; revision=365361
svn path=/vendor/NetBSD/bmake/20200902/; revision=365363; tag=vendor/NetBSD/bmake/20200902
Diffstat (limited to 'unit-tests/cond-short.mk')
-rw-r--r-- | unit-tests/cond-short.mk | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/unit-tests/cond-short.mk b/unit-tests/cond-short.mk index 41d76768a404..ae441d80f7d9 100644 --- a/unit-tests/cond-short.mk +++ b/unit-tests/cond-short.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-short.mk,v 1.7 2020/07/09 22:34:09 sjg Exp $ +# $NetBSD: cond-short.mk,v 1.9 2020/08/19 22:47:09 rillig Exp $ # # Demonstrates that in conditions, the right-hand side of an && or || # is only evaluated if it can actually influence the result. @@ -66,6 +66,19 @@ VAR= # empty again, for the following tests .if 0 && !empty(:U${:!echo "unexpected exclam modifier" 1>&2 !}) .endif +# Irrelevant assignment modifiers are skipped as well. +.if 0 && ${1 2 3:L:@i@${FIRST::?=$i}@} +.endif +.if 0 && ${1 2 3:L:@i@${LAST::=$i}@} +.endif +.if 0 && ${1 2 3:L:@i@${APPENDED::+=$i}@} +.endif +.if 0 && ${echo.1 echo.2 echo.3:L:@i@${RAN::!=${i:C,.*,&; & 1>\&2,:S,., ,g}}@} +.endif +.if defined(FIRST) || defined(LAST) || defined(APPENDED) || defined(RAN) +.warning first=${FIRST} last=${LAST} appended=${APPENDED} ran=${RAN} +.endif + # The || operator. .if 1 || ${echo "unexpected or" 1>&2 :L:sh} @@ -110,6 +123,7 @@ x=Ok x=Fail .endif x!= echo 'defined(V42) && ${V42} > 0: $x' >&2; echo + # this one throws both String comparison operator and # Malformed conditional with cond.c 1.78 # indirect iV2 would expand to "" and treated as 0 @@ -119,6 +133,7 @@ x=Fail x=Ok .endif x!= echo 'defined(V66) && ( "${iV2}" < ${V42} ): $x' >&2; echo + # next two thow String comparison operator with cond.c 1.78 # indirect iV1 would expand to 42 .if 1 || ${iV1} < ${V42} @@ -127,12 +142,14 @@ x=Ok x=Fail .endif x!= echo '1 || ${iV1} < ${V42}: $x' >&2; echo + .if 1 || ${iV2:U2} < ${V42} x=Ok .else x=Fail .endif x!= echo '1 || ${iV2:U2} < ${V42}: $x' >&2; echo + # the same expressions are fine when the lhs is expanded # ${iV1} expands to 42 .if 0 || ${iV1} <= ${V42} @@ -141,6 +158,7 @@ x=Ok x=Fail .endif x!= echo '0 || ${iV1} <= ${V42}: $x' >&2; echo + # ${iV2:U2} expands to 2 .if 0 || ${iV2:U2} < ${V42} x=Ok |