Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make/unit-tests make: add test for edge case in modi...



details:   https://anonhg.NetBSD.org/src/rev/271ecc8b4d59
branches:  trunk
changeset: 1019572:271ecc8b4d59
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Mar 14 16:00:07 2021 +0000

description:
make: add test for edge case in modifier ':[...]'

TryParseIntBase0 wrongly returns successful for a string that does not
start with a number at all.  Its only caller, ApplyModifier_Words,
already handles all error cases properly.

No functional change.

diffstat:

 usr.bin/make/unit-tests/modword.exp |  2 ++
 usr.bin/make/unit-tests/modword.mk  |  3 ++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diffs (29 lines):

diff -r a6b2edd0aac1 -r 271ecc8b4d59 usr.bin/make/unit-tests/modword.exp
--- a/usr.bin/make/unit-tests/modword.exp       Sun Mar 14 15:43:31 2021 +0000
+++ b/usr.bin/make/unit-tests/modword.exp       Sun Mar 14 16:00:07 2021 +0000
@@ -71,6 +71,8 @@
 LIST:[1.]="" is an error
 make: Bad modifier ":[1..]" for variable "LIST"
 LIST:[1..]="" is an error
+make: Bad modifier ":[1.. ]" for variable "LIST"
+LIST:[1.. ]="" is an error
 LIST:[1..1]="one"
 make: Bad modifier ":[1..1.]" for variable "LIST"
 LIST:[1..1.]="" is an error
diff -r a6b2edd0aac1 -r 271ecc8b4d59 usr.bin/make/unit-tests/modword.mk
--- a/usr.bin/make/unit-tests/modword.mk        Sun Mar 14 15:43:31 2021 +0000
+++ b/usr.bin/make/unit-tests/modword.mk        Sun Mar 14 16:00:07 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: modword.mk,v 1.5 2020/11/15 20:20:58 rillig Exp $
+# $NetBSD: modword.mk,v 1.6 2021/03/14 16:00:07 rillig Exp $
 #
 # Test behaviour of new :[] modifier
 # TODO: When was this modifier new?
@@ -99,6 +99,7 @@
 mod-squarebrackets-start-end:
        @echo 'LIST:[1.]="${LIST:[1.]}" is an error'
        @echo 'LIST:[1..]="${LIST:[1..]}" is an error'
+       @echo 'LIST:[1.. ]="${LIST:[1.. ]}" is an error'
        @echo 'LIST:[1..1]="${LIST:[1..1]}"'
        @echo 'LIST:[1..1.]="${LIST:[1..1.]}" is an error'
        @echo 'LIST:[1..2]="${LIST:[1..2]}"'



Home | Main Index | Thread Index | Old Index