| @@ -1,9 +1,21 @@ | | | @@ -1,9 +1,21 @@ |
1 | # $NetBSD: varmod-quote.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $ | | 1 | # $NetBSD: varmod-quote.mk,v 1.3 2020/10/29 19:07:45 rillig Exp $ |
2 | # | | 2 | # |
3 | # Tests for the :Q variable modifier, which quotes the variable value | | 3 | # Tests for the :Q variable modifier, which quotes the variable value |
4 | # to be used in a shell program. | | 4 | # to be used in a shell program. |
5 | | | 5 | |
6 | # TODO: Implementation | | 6 | # Any characters that might be interpreted by the shell are escaped. |
| | | 7 | # The set of escaped characters is the same, no matter which shell (sh, csh, |
| | | 8 | # ksh) is in effect. |
| | | 9 | .if ${:Ua b c:Q} != "a\\ b\\ c" |
| | | 10 | . error |
| | | 11 | .endif |
| | | 12 | |
| | | 13 | # The quote modifier only applies if the whole modifier name is "Q". |
| | | 14 | # There is no "Qshell" or "Qawk" or "Qregex" or even "Qhtml" variant. |
| | | 15 | # All strings except the plain "Q" are interpreted as SysV modifier. |
| | | 16 | .if ${:Ua.Qshell:Qshell=replaced} != "a.replaced" |
| | | 17 | . error |
| | | 18 | .endif |
7 | | | 19 | |
8 | all: | | 20 | all: |
9 | @:; | | 21 | @:; |