To make them explicit, visible, avoid being accidentally trimmed.
Also prevents Git warnings, e.g. on `git am`.
Also:
- runtests: add support for `%spc%` and `%tab%` macros.
- test59: delete non-significant line-ending space.
- spacecheck.pl: drop line-ending whitespace exception for tests.
Closes #19300
"\\.(bat|sln)\$",
);
-my @space_at_eol = (
- "^tests/data/test",
-);
-
my @non_ascii_allowed = (
'\xC3\xB6', # UTF-8 for https://codepoints.net/U+00F6 LATIN SMALL LETTER O WITH DIAERESIS
);
push @err, "content: must use LF EOL for this file type";
}
- if(!fn_match($filename, @space_at_eol) &&
- $content =~ /[ \t]\n/) {
+ if($content =~ /[ \t]\n/) {
my $line;
for my $l (split(/\n/, $content)) {
$line++;
%repeat[100 x hello]%
+## Whitespace
+
+To add significant whitespace characters at the end of the line, or to empty
+lines:
+
+ %spc%
+ %tab%
+
## Insert capped epoch days
Mostly to test capped cookie expire dates: `%days[NUM]` inserts the number of
Connection: close\r
\r
This server reply is for testing a simple Location: following
-http://%HOSTIP:%HTTPPORT/we/want/our/data/%TESTNUMBER0002.txt?coolsite=yes http://%HOSTIP:%HTTPPORT/we/want/our/%TESTNUMBER 0
+http://%HOSTIP:%HTTPPORT/we/want/our/data/%TESTNUMBER0002.txt?coolsite=yes http://%HOSTIP:%HTTPPORT/we/want/our/%TESTNUMBER 0%spc%
</stdout>
</verify>
</testcase>
Content-Length: 2313
Content-Type: application/x-www-form-urlencoded
-This creates
+This creates%spc%
</protocol>
</verify>
</testcase>
./%LOGDIR/code1185.c:4:82: warning: Longer than 79 columns (LONGLINE)
int hello; /*------------------------------------------------------------------*/
./%LOGDIR/code1185.c:5:4: error: Contains TAB character (TABS)
- int tab;
+ int%tab%tab;
^
./%LOGDIR/code1185.c:7:13: warning: func with space (SPACEBEFOREPAREN)
int a = func ();
} else {
^
./%LOGDIR/code1185.c:24:11: warning: missing space after close paren (PARENBRACE)
- if(a == 2){
+ if(a == 2){%spc%%spc%
^
./%LOGDIR/code1185.c:28:14: warning: no space before semicolon (SPACESEMICOLON)
func_return() ;
// CPP comment ?
^
./%LOGDIR/code1185.c:1:1: error: Missing copyright statement (COPYRIGHT)
-
+%spc%
^
./%LOGDIR/code1185.c:1:1: error: Missing closing comment (OPENCOMMENT)
-
+%spc%
^
checksrc: 0 errors and 41 warnings
</stdout>
<verify>
<protocol crlf="yes">
USER user
-PASS
+PASS%spc%
PWD
EPSV
TYPE I
This is not the full help; this menu is split into categories.
Use "--help category" to get an overview of all categories, which are:
-auth, connection, curl, deprecated, dns, file, ftp, global, http, imap, ldap,
-output, pop3, post, proxy, scp, sftp, smtp, ssh, telnet, tftp, timeout, tls,
+auth, connection, curl, deprecated, dns, file, ftp, global, http, imap, ldap,%spc%
+output, pop3, post, proxy, scp, sftp, smtp, ssh, telnet, tftp, timeout, tls,%spc%
upload, verbose.
Use "--help all" to list all options
Use "--help [option]" to view documentation for a given option
# a comment
h2 foo.example.com 443 h3 shiny.example.com 8443 "20291231 23:30:00" 0 0
h1 example.com 443 h3 shiny.example.com 8443 "20121231 00:00:01" 0 0
- h3 example.com 443 h3 shiny.example.com 8443 "20131231 00:00:00" 0 0
+%tab%h3 example.com 443 h3 shiny.example.com 8443 "20131231 00:00:00" 0 0
# also a comment
bad example.com 443 h3 shiny.example.com 8443 "20191231 00:00:00" 0 0
rubbish
3: ("b") 5, line 0
4: ("\") 5, line 0
5: (" ") 0, line 1
-6: (" ") 5, line 0
+6: ("%tab%") 5, line 0
7: ("
") 5, line 0
8: ("") 5, line 0
<protocol crlf="yes">
MOOO /that.site.com/%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
-User-Agent: agent007 license to drill
+User-Agent: agent007 license to drill%tab%
Accept: */*
</protocol>
OK
</data>
<data1>
-HTTP/1.1 200 OK
+HTTP/1.1 200 OK%spc%
Connection: close
Content-Length: 15
Content-Range: bytes 50-
Location: /%TESTNUMBER
Content-Length: 3
-HTTP/1.1 200 OK
+HTTP/1.1 200 OK%spc%
Connection: close
Content-Length: 15
Content-Range: bytes 50-
OK
</data>
<data1>
-HTTP/1.1 200 OK
+HTTP/1.1 200 OK%spc%
Connection: close
Content-Length: 15
Location: /%TESTNUMBER
Content-Length: 3
-HTTP/1.1 200 OK
+HTTP/1.1 200 OK%spc%
Connection: close
Content-Length: 15
<data nocheck="yes">
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
-Server: test with trailing space
+Server: test with trailing space%repeat[5 x ]%
Content-Type: text/html
Fold: is
- folding a
+ folding a%repeat[5 x ]%
line
Content-Length: 0
Set-Cookie: onecookie=data;
- Set-Cookie == secondcookie=2data; (1/3)
- Set-Cookie == cookie3=data3; (2/3)
Fold == is folding a line
- Blank ==
- Blank2 ==
+ Blank ==%spc%
+ Blank2 ==%spc%
</stdout>
</verify>
</testcase>
<data nocheck="yes">
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
-Server: test with trailing space
+Server: test with trailing space%repeat[5 x ]%
Content-Type: text/html
Content-Length: 0
Set-Cookie: onecookie=data;
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
-Server: test with trailing space
+Server: test with trailing space%repeat[5 x ]%
Content-Type: text/html
Content-Length: 0
Set-Cookie: onecookie=data;
<data nocheck="yes">
HTTP/1.1 302 OK
Date: Thu, 01 Nov 2001 14:49:00 GMT
-Server: test with trailing space
+Server: test with trailing space%repeat[5 x ]%
Content-Type: text/html
Content-Length: 0
Set-Cookie: onecookie=data;
<data nocheck="yes">
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
-Server: test with trailing space
+Server: test with trailing space%repeat[5 x ]%
Content-Type: text/html
Content-Length: 0
Set-Cookie: onecookie=data;
<data nocheck="yes">
HTTP/1.1 302 OK
Date: Thu, 01 Nov 2001 14:49:00 GMT
-Server: test with trailing space
+Server: test with trailing space%repeat[5 x ]%
Content-Type: text/html
Content-Length: 0
Set-Cookie: onecookie=data;
<data nocheck="yes">
HTTP/1.1 302 OK
Date: Thu, 01 Nov 2001 14:49:00 GMT
-Server: test with trailing space
+Server: test with trailing space%repeat[5 x ]%
Content-Type: text/html
Content-Length: 0
Set-Cookie: onecookie=data;
X-Xxx-Date: 19700101T000000Z
test3: 1234
test2:
-test_space: t s m end
+test_space: t%tab%s m%tab% end%repeat[4 x ]%
tesMixCase: MixCase
</protocol>
Host: exam.ple.com:9000
Authorization: XXX4-HMAC-SHA256 Credential=xxx/19700101/ple/exam/xxx4_request, SignedHeaders=content-type;host;x-xxx-content-sha256;x-xxx-date, Signature=25b4cac711ea8f65010c485d3778885f5f3870d0b8ff0b3ab58a8d7eeab991ff
X-Xxx-Date: 19700101T000000Z
-X-Xxx-Content-Sha256: arbitrary
+X-Xxx-Content-Sha256: %tab%arbitrary%spc%
</protocol>
</verify>
%hex[%8a%808321]hex%
</protocol>
<stdout mode="text">
-68 65 6c 6c 6f
+68 65 6c 6c 6f%spc%
RECFLAGS: 1
</stdout>
<limits>
</data>
<data2 nocheck="yes">
HTTP/1.1 200 OK swsclose
- Access-Control-Allow-Origin: *
+%tab%Access-Control-Allow-Origin: *
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8
Date: Wed, 10 May 2023 14:58:08 GMT
# Verify data after the test has been "shot"
<verify>
<stdout crlf="yes">
-HTTP/2 200
+HTTP/2 200%spc%
date: Tue, 09 Nov 2010 14:49:00 GMT
content-length: 6
content-type: text/html
# Verify data after the test has been "shot"
<verify>
<stdout crlf="yes">
-HTTP/2 200
+HTTP/2 200%spc%
date: Tue, 09 Nov 2010 14:49:00 GMT
content-length: 6
content-type: text/html
# Verify data after the test has been "shot"
<verify>
<stdout crlf="yes">
-HTTP/2 404
+HTTP/2 404%spc%
date: Tue, 09 Nov 2010 14:49:00 GMT
content-length: 6
content-type: text/html
</protocol>
<stdout crlf="yes">
-HTTP/3 200
+HTTP/3 200%spc%
date: Tue, 09 Nov 2010 14:49:00 GMT
last-modified: Tue, 13 Jun 2000 12:10:00 GMT
etag: "21025-dc7-39462498"
# Verify data after the test has been "shot"
<verify>
<stdout crlf="yes">
-HTTP/3 200
+HTTP/3 200%spc%
date: Tue, 09 Nov 2010 14:49:00 GMT
content-length: 6
content-type: text/html
2
</errorcode>
<stderr mode="text">
-Warning: You can only select one HTTP request method! You asked for both PUT
+Warning: You can only select one HTTP request method! You asked for both PUT%spc%
Warning: (-T, --upload-file) and POST (-d, --data).
</stderr>
</verify>
extra-header: here
Accept: replaced
X-Custom-Header:
-X-Test: foo;
+X-Test: foo;%spc%
X-Test2: foo;
GET /%TESTNUMBER HTTP/1.1
extra-header: here
Accept: replaced
X-Custom-Header:
-X-Test: foo;
+X-Test: foo;%spc%
X-Test2: foo;
</protocol>
access-control-allow-methods: GET, POST, PUT, DELETE, OPTIONS
access-control-max-age: 1728000
access-control-allow-headers: Authorization, Content-Type, AuthorizationOauth, X-EARLY-ACCESS
-access-control-expose-headers:
+access-control-expose-headers:%spc%
vary: Accept
etag: W/"2678f9ab2ba550d164e7cc014aefd31e"
cache-control: max-age=0, private, must-revalidate
arg
</protocol>
<stderr mode="text">
-Warning: %LOGDIR/config:1: warning: 'data' uses unquoted whitespace. This may
+Warning: %LOGDIR/config:1: warning: 'data' uses unquoted whitespace. This may%spc%
Warning: cause side-effects. Consider double quotes.
</stderr>
</verify>
domain..tld FALSE / FALSE 2139150993 mooo indeed
#HttpOnly_domain..tld FALSE /want FALSE 2139150993 mooo2 indeed2
%endif
-domain..tld FALSE /want FALSE 0 empty
+domain..tld FALSE /want FALSE 0 empty%tab%
</file>
<features>
cookies
# This file was generated by libcurl! Edit at your own risk.
domain..tld FALSE /want/ FALSE 0 simplyhuge %repeat[3998 x z]%
-domain..tld FALSE / FALSE 0 justaname
+domain..tld FALSE / FALSE 0 justaname%tab%
domain..tld FALSE / FALSE 0 ASPSESSIONIDQGGQQSJJ GKNBDIFAAOFDPDAIEAKDIBKE
domain..tld FALSE / FALSE 0 ckySession temporary
domain..tld FALSE / FALSE %days[400] ckyPersistent permanent
%if large-time
-domain..tld FALSE /want FALSE 0 empty
+domain..tld FALSE /want FALSE 0 empty%tab%
#HttpOnly_domain..tld FALSE /want FALSE 22139150993 mooo2 indeed2
domain..tld FALSE / FALSE 22139150993 mooo indeed
www.loser.com FALSE / FALSE 22139150993 UID 99
www.fake.come FALSE / FALSE 22147483647 cookiecliente si
%else
-domain..tld FALSE /want FALSE 0 empty
+domain..tld FALSE /want FALSE 0 empty%tab%
#HttpOnly_domain..tld FALSE /want FALSE 2139150993 mooo2 indeed2
domain..tld FALSE / FALSE 2139150993 mooo indeed
www.loser.com FALSE / FALSE 2139150993 UID 99
<data>
HTTP/1.1 302 This is a weirdo text message swsclose
Connection: close
-Location:
+Location:%spc%
This server reply is for testing
</data>
<data nocheck="yes">
HTTP/1.1 200 OK swsclose
Funny-head: yesyes
-Content-Type: text/html; charset=ISO-8859-4
+Content-Type: text/html; charset=ISO-8859-4%repeat[3 x ]%
</data>
</reply>
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
-hej
+hej
</data>
</reply>
# Server-side
<reply>
<data>
-RTSP/1.0 786
+RTSP/1.0 786%repeat[10 x ]%
-RTSP/
+RTSP/%repeat[10 x ]%
</data>
<datacheck>
</datacheck>
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
ETag: "21025-dc7-39462498"
Accept-Ranges: bytes
-Content-Length: 6
+Content-Length: 6%repeat[5 x ]%
Connection: close
Content-Type: text/html
Funny-head: yesyes
<verify>
<protocol crlf="yes">
USER username
-PASS
+PASS%spc%
PWD
EPSV
TYPE I
<verify>
<protocol crlf="yes">
USER username
-PASS
+PASS%spc%
PWD
EPSV
TYPE I
$$thing =~ s/%%DAYS%%/%alternatives[$d,$d2]/;
}
+ $$thing =~ s/%spc%/ /g; # space
+ $$thing =~ s/%tab%/\t/g; # horizontal tab
+
# include a file
$$thing =~ s/%include ([^%]*)%[\n\r]+/includefile($1)/ge;
}