Skip to content

Commit 00c415f

Browse files
committed
introduce 'excludes' option for tests, address hexadecimal changes from libcurl
Thanks @charles2910 for reporting this bug fixes: #394
1 parent a4d8ba2 commit 00c415f

File tree

3 files changed

+134
-2
lines changed

3 files changed

+134
-2
lines changed

test.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,16 @@ def main(argc, argv):
250250
print(f"Missing feature, skipping test {testIndex + 1}.")
251251
numTestsSkipped += 1
252252
continue
253+
excludes = allTests[testIndex].get("excludes", None)
254+
if excludes and set(excludes).issubset(set(features)):
255+
print(f"Test not compatible, skipping test {testIndex + 1}")
256+
numTestsSkipped += 1
257+
continue
253258
encoding = allTests[testIndex].get("encoding", None)
254259
if encoding and encoding != getcharmap():
255260
print(f"Invalid locale, skipping test {testIndex + 1}.")
256261
numTestsSkipped += 1
257-
continue;
262+
continue
258263

259264
test = TestCase(testIndex + 1, runnerCmd, baseCmd, **allTests[testIndex])
260265

tests.json

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,7 @@
702702
"user=:hej:"
703703
]
704704
},
705+
"excludes": ["uppercase-hex"],
705706
"expected": {
706707
"stdout": "https://%3ahej%3a@curl.se/hello\n",
707708
"stderr": "",
@@ -2030,6 +2031,7 @@
20302031
"localhost"
20312032
]
20322033
},
2034+
"excludes": ["uppercase-hex"],
20332035
"expected": {
20342036
"stdout": "/\\\\\n/%5c%5c\n",
20352037
"returncode": 0,
@@ -2045,6 +2047,7 @@
20452047
"localhost"
20462048
]
20472049
},
2050+
"excludes": ["uppercase-hex"],
20482051
"expected": {
20492052
"stdout": [
20502053
{
@@ -2071,6 +2074,7 @@
20712074
"localhost"
20722075
]
20732076
},
2077+
"excludes": ["uppercase-hex"],
20742078
"expected": {
20752079
"stdout": "/%5c%5c\n/%5c%5c\n",
20762080
"returncode": 0,
@@ -2089,6 +2093,7 @@
20892093
"localhost"
20902094
]
20912095
},
2096+
"excludes": ["uppercase-hex"],
20922097
"expected": {
20932098
"stdout": [
20942099
{
@@ -3318,5 +3323,124 @@
33183323
"stdout": "http://e/?e&a\n",
33193324
"returncode": 0
33203325
}
3326+
},
3327+
{
3328+
"input": {
3329+
"arguments": [
3330+
"-s",
3331+
"path=\\\\",
3332+
"--json",
3333+
"localhost"
3334+
]
3335+
},
3336+
"required": ["uppercase-hex"],
3337+
"expected": {
3338+
"stdout": [
3339+
{
3340+
"url": "http://localhost/%5C%5C",
3341+
"parts": {
3342+
"scheme": "http",
3343+
"host": "localhost",
3344+
"path": "/\\\\"
3345+
}
3346+
}
3347+
],
3348+
"returncode": 0,
3349+
"stderr": ""
3350+
}
3351+
},
3352+
{
3353+
"input": {
3354+
"arguments": [
3355+
"-s",
3356+
"path=\\\\",
3357+
"-g",
3358+
"{path}\\n{:path}",
3359+
"--urlencode",
3360+
"localhost"
3361+
]
3362+
},
3363+
"required": ["uppercase-hex"],
3364+
"expected": {
3365+
"stdout": "/%5C%5C\n/%5C%5C\n",
3366+
"returncode": 0,
3367+
"stderr": ""
3368+
}
3369+
},
3370+
{
3371+
"input": {
3372+
"arguments": [
3373+
"-s",
3374+
"path=abc\\\\",
3375+
"-s",
3376+
"query:=a&b&a%26b",
3377+
"--urlencode",
3378+
"--json",
3379+
"localhost"
3380+
]
3381+
},
3382+
"required": ["uppercase-hex"],
3383+
"expected": {
3384+
"stdout": [
3385+
{
3386+
"url": "http://localhost/abc%5C%5C?a&b&a%26b",
3387+
"parts": {
3388+
"scheme": "http",
3389+
"host": "localhost",
3390+
"path": "/abc%5C%5C",
3391+
"query": "a&b&a%26b"
3392+
},
3393+
"params": [
3394+
{
3395+
"key": "a",
3396+
"value": ""
3397+
},
3398+
{
3399+
"key": "b",
3400+
"value": ""
3401+
},
3402+
{
3403+
"key": "a&b",
3404+
"value": ""
3405+
}
3406+
]
3407+
}
3408+
],
3409+
"returncode": 0,
3410+
"stderr": ""
3411+
}
3412+
},
3413+
{
3414+
"input": {
3415+
"arguments": [
3416+
"--url",
3417+
"https://curl.se/hello",
3418+
"--set",
3419+
"user=:hej:"
3420+
]
3421+
},
3422+
"requires": ["uppercase-hex"],
3423+
"expected": {
3424+
"stdout": "https://%3Ahej%3A@curl.se/hello\n",
3425+
"stderr": "",
3426+
"returncode": 0
3427+
}
3428+
},
3429+
{
3430+
"input": {
3431+
"arguments": [
3432+
"-s",
3433+
"path=\\\\",
3434+
"-g",
3435+
"{path}\\n{:path}",
3436+
"localhost"
3437+
]
3438+
},
3439+
"requires": ["uppercase-hex"],
3440+
"expected": {
3441+
"stdout": "/\\\\\n/%5C%5C\n",
3442+
"returncode": 0,
3443+
"stderr": ""
3444+
}
33213445
}
33223446
]

trurl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,10 @@ static void show_version(void)
316316
#ifdef SUPPORTS_ZONEID
317317
fprintf(stdout, " zone-id");
318318
#endif
319-
319+
#if CURL_AT_LEAST_VERSION(8,15,0)
320+
fprintf(stdout, " uppercase-hex");
321+
#endif
322+
320323
fprintf(stdout, "\n");
321324
exit(0);
322325
}

0 commit comments

Comments
 (0)