| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: cond-cmp-string.mk,v 1.8 2020/10/30 13:41:14 rillig Exp $ | | 1 | # $NetBSD: cond-cmp-string.mk,v 1.9 2020/10/30 14:46:01 rillig Exp $ |
2 | # | | 2 | # |
3 | # Tests for string comparisons in .if conditions. | | 3 | # Tests for string comparisons in .if conditions. |
4 | | | 4 | |
5 | # This is a simple comparison of string literals. | | 5 | # This is a simple comparison of string literals. |
6 | # Nothing surprising here. | | 6 | # Nothing surprising here. |
7 | .if "str" != "str" | | 7 | .if "str" != "str" |
8 | . error | | 8 | . error |
9 | .endif | | 9 | .endif |
10 | | | 10 | |
11 | # The right-hand side of the comparison may be written without quotes. | | 11 | # The right-hand side of the comparison may be written without quotes. |
12 | .if "str" != str | | 12 | .if "str" != str |
13 | . error | | 13 | . error |
14 | .endif | | 14 | .endif |
| @@ -56,23 +56,38 @@ | | | @@ -56,23 +56,38 @@ |
56 | .if ${:Uword} != "${:Uword}" | | 56 | .if ${:Uword} != "${:Uword}" |
57 | . error | | 57 | . error |
58 | .endif | | 58 | .endif |
59 | | | 59 | |
60 | # XXX: As of 2020-10-30, adding literal characters to the string results | | 60 | # XXX: As of 2020-10-30, adding literal characters to the string results |
61 | # in a parse error. This is a bug and should have been caught much earlier. | | 61 | # in a parse error. This is a bug and should have been caught much earlier. |
62 | # I wonder since when it exists. | | 62 | # I wonder since when it exists. |
63 | .if ${:Uword} != "${:Uword} " | | 63 | .if ${:Uword} != "${:Uword} " |
64 | . error | | 64 | . error |
65 | .else | | 65 | .else |
66 | . error | | 66 | . error |
67 | .endif | | 67 | .endif |
68 | | | 68 | |
| | | 69 | # Some other characters work though, and some don't. |
| | | 70 | # Those that are mentioned in is_separator don't work. |
| | | 71 | .if ${:Uword0} != "${:Uword}0" |
| | | 72 | . error |
| | | 73 | .endif |
| | | 74 | .if ${:Uword&} != "${:Uword}&" |
| | | 75 | . error |
| | | 76 | .endif |
| | | 77 | .if ${:Uword!} != "${:Uword}!" |
| | | 78 | . error |
| | | 79 | .endif |
| | | 80 | .if ${:Uword<} != "${:Uword}<" |
| | | 81 | . error |
| | | 82 | .endif |
| | | 83 | |
69 | # Adding another variable expression to the string literal works though. | | 84 | # Adding another variable expression to the string literal works though. |
70 | .if ${:Uword} != "${:Uwo}${:Urd}" | | 85 | .if ${:Uword} != "${:Uwo}${:Urd}" |
71 | . error | | 86 | . error |
72 | .endif | | 87 | .endif |
73 | | | 88 | |
74 | # Adding a space at the beginning of the quoted variable expression works | | 89 | # Adding a space at the beginning of the quoted variable expression works |
75 | # though. | | 90 | # though. |
76 | .if ${:U word } != " ${:Uword} " | | 91 | .if ${:U word } != " ${:Uword} " |
77 | . error | | 92 | . error |
78 | .endif | | 93 | .endif |