xref: /freebsd/contrib/bmake/unit-tests/escape.exp (revision 517904de5ccac643589c71ac0d2751797f89e4f9)
1var-1bs
2printf "%s=:%s:\n" VAR1BS 111\\111;   printf "%s=:%s:\n" VAR1BSa 111\\aaa;   printf "%s=:%s:\n" VAR1BSA 111\\aaa;   printf "%s=:%s:\n" VAR1BSda 111\\\$\{a\};   printf "%s=:%s:\n" VAR1BSdA 111\\\$\{A\};   printf "%s=:%s:\n" VAR1BSc 111\#\ backslash\ escapes\ comment\ char,\ so\ this\ is\ part\ of\ the\ value;   printf "%s=:%s:\n" VAR1BSsc 111\\\ ;
3VAR1BS=:111\111:
4VAR1BSa=:111\aaa:
5VAR1BSA=:111\aaa:
6VAR1BSda=:111\${a}:
7VAR1BSdA=:111\${A}:
8VAR1BSc=:111# backslash escapes comment char, so this is part of the value:
9VAR1BSsc=:111\ :
10var-2bs
11printf "%s=:%s:\n" VAR2BS 222\\\\222;   printf "%s=:%s:\n" VAR2BSa 222\\\\aaa;   printf "%s=:%s:\n" VAR2BSA 222\\\\aaa;   printf "%s=:%s:\n" VAR2BSda 222\\\\\$\{a\};   printf "%s=:%s:\n" VAR2BSdA 222\\\\\$\{A\};   printf "%s=:%s:\n" VAR2BSc 222\\\\;   printf "%s=:%s:\n" VAR2BSsc 222\\\\;
12VAR2BS=:222\\222:
13VAR2BSa=:222\\aaa:
14VAR2BSA=:222\\aaa:
15VAR2BSda=:222\\${a}:
16VAR2BSdA=:222\\${A}:
17VAR2BSc=:222\\:
18VAR2BSsc=:222\\:
19var-1bsnl
20printf "%s=:%s:\n" VAR1BSNL 111\ 111;   printf "%s=:%s:\n" VAR1BSNLa 111\ aaa;   printf "%s=:%s:\n" VAR1BSNLA 111\ aaa;   printf "%s=:%s:\n" VAR1BSNLda 111\ \$\{a\};   printf "%s=:%s:\n" VAR1BSNLdA 111\ \$\{A\};   printf "%s=:%s:\n" VAR1BSNLc 111;   printf "%s=:%s:\n" VAR1BSNLsc 111;
21VAR1BSNL=:111 111:
22VAR1BSNLa=:111 aaa:
23VAR1BSNLA=:111 aaa:
24VAR1BSNLda=:111 ${a}:
25VAR1BSNLdA=:111 ${A}:
26VAR1BSNLc=:111:
27VAR1BSNLsc=:111:
28var-2bsnl
29printf "%s=:%s:\n" VAR2BSNL 222\\\\;   printf "%s=:%s:\n" VAR2BSNLa 222\\\\;   printf "%s=:%s:\n" VAR2BSNLA 222\\\\;   printf "%s=:%s:\n" VAR2BSNLda 222\\\\;   printf "%s=:%s:\n" VAR2BSNLdA 222\\\\;   printf "%s=:%s:\n" VAR2BSNLc 222\\\\;   printf "%s=:%s:\n" VAR2BSNLsc 222\\\\;
30VAR2BSNL=:222\\:
31VAR2BSNLa=:222\\:
32VAR2BSNLA=:222\\:
33VAR2BSNLda=:222\\:
34VAR2BSNLdA=:222\\:
35VAR2BSNLc=:222\\:
36VAR2BSNLsc=:222\\:
37var-3bsnl
38printf "%s=:%s:\n" VAR3BSNL 333\\\\\ 333=;   printf "%s=:%s:\n" VAR3BSNLa 333\\\\\ aaa=;   printf "%s=:%s:\n" VAR3BSNLA 333\\\\\ aaa=;   printf "%s=:%s:\n" VAR3BSNLda 333\\\\\ \$\{a\}=;   printf "%s=:%s:\n" VAR3BSNLdA 333\\\\\ \$\{A\}=;   printf "%s=:%s:\n" VAR3BSNLc 333\\\\;   printf "%s=:%s:\n" VAR3BSNLsc 333\\\\;
39VAR3BSNL=:333\\ 333=:
40VAR3BSNLa=:333\\ aaa=:
41VAR3BSNLA=:333\\ aaa=:
42VAR3BSNLda=:333\\ ${a}=:
43VAR3BSNLdA=:333\\ ${A}=:
44VAR3BSNLc=:333\\:
45VAR3BSNLsc=:333\\:
46var-1bsnl-space
47printf "%s=:%s:\n" VAR1BSNL00 first\ line;   printf "%s=:%s:\n" VAR1BSNL0 first\ line\ no\ space\ on\ second\ line;   printf "%s=:%s:\n" VAR1BSNLs first\ line\ one\ space\ on\ second\ line;   printf "%s=:%s:\n" VAR1BSNLss first\ line\ two\ spaces\ on\ second\ line;   printf "%s=:%s:\n" VAR1BSNLt first\ line\ one\ tab\ on\ second\ line;   printf "%s=:%s:\n" VAR1BSNLtt first\ line\ two\ tabs\ on\ second\ line;   printf "%s=:%s:\n" VAR1BSNLxx first\ line\ many\ spaces\ and\ tabs\ \[\ \ \	\ \]\ on\ second\ line;
48VAR1BSNL00=:first line:
49VAR1BSNL0=:first line no space on second line:
50VAR1BSNLs=:first line one space on second line:
51VAR1BSNLss=:first line two spaces on second line:
52VAR1BSNLt=:first line one tab on second line:
53VAR1BSNLtt=:first line two tabs on second line:
54VAR1BSNLxx=:first line many spaces and tabs [  	 ] on second line:
55cmd-1bsnl
56echo :'first line\
57#second line without space\
58third line':
59:first line\
60#second line without space\
61third line:
62echo :'first line\
63     second line spaces should be retained':
64:first line\
65     second line spaces should be retained:
66echo :'first line\
67second line tab should be elided':
68:first line\
69second line tab should be elided:
70echo :'first line\
71	only one tab should be elided, second tab remains'
72:first line\
73	only one tab should be elided, second tab remains
74cmd-1bsnl-eof
75echo :'command ending with backslash-newline'; \
76
77:command ending with backslash-newline
78cmd-2bsnl
79echo take one\\
80take one\
81echo take two\\
82take two\
83echo take three\\
84take three\
85cmd-3bsnl
86echo :'first line\\\
87#second line without space\\\
88third line':
89:first line\\\
90#second line without space\\\
91third line:
92echo :'first line\\\
93     second line spaces should be retained':
94:first line\\\
95     second line spaces should be retained:
96echo :'first line\\\
97second line tab should be elided':
98:first line\\\
99second line tab should be elided:
100echo :'first line\\\
101	only one tab should be elided, second tab remains'
102:first line\\\
103	only one tab should be elided, second tab remains
104exit status 0
105