| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: varmod-edge.mk,v 1.9 2020/08/01 15:13:45 rillig Exp $ | | 1 | # $NetBSD: varmod-edge.mk,v 1.10 2020/08/01 15:16:15 rillig Exp $ |
2 | # | | 2 | # |
3 | # Tests for edge cases in variable modifiers. | | 3 | # Tests for edge cases in variable modifiers. |
4 | # | | 4 | # |
5 | # These tests demonstrate the current implementation in small examples. | | 5 | # These tests demonstrate the current implementation in small examples. |
6 | # They may contain surprising behavior. | | 6 | # They may contain surprising behavior. |
7 | # | | 7 | # |
8 | # Each test consists of: | | 8 | # Each test consists of: |
9 | # - INP, the input to the test | | 9 | # - INP, the input to the test |
10 | # - MOD, the expression for testing the modifier | | 10 | # - MOD, the expression for testing the modifier |
11 | # - EXP, the expected output | | 11 | # - EXP, the expected output |
12 | | | 12 | |
13 | TESTS+= M-paren | | 13 | TESTS+= M-paren |
14 | INP.M-paren= (parentheses) {braces} (opening closing) () | | 14 | INP.M-paren= (parentheses) {braces} (opening closing) () |
| @@ -146,22 +146,27 @@ EXP.eq-bs= file.c file.ext | | | @@ -146,22 +146,27 @@ EXP.eq-bs= file.c file.ext |
146 | # Having only an escaped '=' results in a parse error. | | 146 | # Having only an escaped '=' results in a parse error. |
147 | # The call to "pattern.lhs = ParseModifierPart" fails. | | 147 | # The call to "pattern.lhs = ParseModifierPart" fails. |
148 | TESTS+= eq-esc | | 148 | TESTS+= eq-esc |
149 | INP.eq-esc= file.c file... | | 149 | INP.eq-esc= file.c file... |
150 | MOD.eq-esc= ${INP.eq-esc:a\=b} | | 150 | MOD.eq-esc= ${INP.eq-esc:a\=b} |
151 | EXP.eq-esc= # empty | | 151 | EXP.eq-esc= # empty |
152 | # make: Unclosed substitution for INP.eq-esc (= missing) | | 152 | # make: Unclosed substitution for INP.eq-esc (= missing) |
153 | | | 153 | |
154 | TESTS+= colon | | 154 | TESTS+= colon |
155 | INP.colon= value | | 155 | INP.colon= value |
156 | MOD.colon= ${INP.colon:} | | 156 | MOD.colon= ${INP.colon:} |
157 | EXP.colon= value | | 157 | EXP.colon= value |
158 | | | 158 | |
| | | 159 | TESTS+= colons |
| | | 160 | INP.colons= value |
| | | 161 | MOD.colons= ${INP.colons::::} |
| | | 162 | EXP.colons= # empty |
| | | 163 | |
159 | all: | | 164 | all: |
160 | .for test in ${TESTS} | | 165 | .for test in ${TESTS} |
161 | . if ${MOD.${test}} == ${EXP.${test}} | | 166 | . if ${MOD.${test}} == ${EXP.${test}} |
162 | @printf 'ok %s\n' ${test:Q}'' | | 167 | @printf 'ok %s\n' ${test:Q}'' |
163 | . else | | 168 | . else |
164 | @printf 'error in %s: expected %s, got %s\n' \ | | 169 | @printf 'error in %s: expected %s, got %s\n' \ |
165 | ${test:Q}'' ${EXP.${test}:Q}'' ${MOD.${test}:Q}'' | | 170 | ${test:Q}'' ${EXP.${test}:Q}'' ${MOD.${test}:Q}'' |
166 | . endif | | 171 | . endif |
167 | .endfor | | 172 | .endfor |