diff options
author | Simon J. Gerraty <sjg@FreeBSD.org> | 2017-04-21 22:19:13 +0000 |
---|---|---|
committer | Simon J. Gerraty <sjg@FreeBSD.org> | 2017-04-21 22:19:13 +0000 |
commit | 8b054d3c36eed7b18c65afe380162dd2f771424a (patch) | |
tree | d931ebac80a461e315a3dfed338a224273b10bcb /contrib/bmake | |
parent | ef3c43b4e304782654cff4c0cad283ff417b447d (diff) |
Str_Match: fix closure tests for [^] and add unit-test.
Notes
Notes:
svn path=/head/; revision=317274
Diffstat (limited to 'contrib/bmake')
-rw-r--r-- | contrib/bmake/str.c | 9 | ||||
-rw-r--r-- | contrib/bmake/unit-tests/modmatch.exp | 1 | ||||
-rw-r--r-- | contrib/bmake/unit-tests/modmatch.mk | 1 |
3 files changed, 8 insertions, 3 deletions
diff --git a/contrib/bmake/str.c b/contrib/bmake/str.c index 4c56e15b78df..5ca2e346e142 100644 --- a/contrib/bmake/str.c +++ b/contrib/bmake/str.c @@ -382,8 +382,11 @@ Str_Match(const char *string, const char *pattern) } else nomatch = 0; for (;;) { - if ((*pattern == ']') || (*pattern == 0)) - return(nomatch); + if ((*pattern == ']') || (*pattern == 0)) { + if (nomatch) + break; + return(0); + } if (*pattern == *string) break; if (pattern[1] == '-') { @@ -400,7 +403,7 @@ Str_Match(const char *string, const char *pattern) } ++pattern; } - if (nomatch) + if (nomatch && (*pattern != ']') && (*pattern != 0)) return 0; while ((*pattern != ']') && (*pattern != 0)) ++pattern; diff --git a/contrib/bmake/unit-tests/modmatch.exp b/contrib/bmake/unit-tests/modmatch.exp index 73dbb6a87b8c..a7bf8b748f5b 100644 --- a/contrib/bmake/unit-tests/modmatch.exp +++ b/contrib/bmake/unit-tests/modmatch.exp @@ -16,4 +16,5 @@ LIB=e X_LIBS:M*/lib${LIB}.a:tu is "/TMP/LIBE.A" Mscanner=OK Upper=One Two Three Four Lower=five six seven +nose=One Three five exit status 0 diff --git a/contrib/bmake/unit-tests/modmatch.mk b/contrib/bmake/unit-tests/modmatch.mk index 2c0313884936..45199287acdb 100644 --- a/contrib/bmake/unit-tests/modmatch.mk +++ b/contrib/bmake/unit-tests/modmatch.mk @@ -31,3 +31,4 @@ LIST= One Two Three Four five six seven check-cclass: @echo Upper=${LIST:M[A-Z]*} @echo Lower=${LIST:M[^A-Z]*} + @echo nose=${LIST:M[^s]*[ex]} |