test: Add two more urlDecode tests #29967
pull maflcko wants to merge 1 commits into bitcoin:master from maflcko:2404-test-urlDec- changing 1 files +3 −0-
maflcko commented at 6:35 am on April 26, 2024: memberTrivial follow-up after #29904 (review)
-
test: Add two more urlDecode tests fa55972a75
-
DrahtBot commented at 6:35 am on April 26, 2024: contributor
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Code Coverage
For detailed information about the code coverage, see the test coverage report.
Reviews
See the guideline for information on the review process.
Type Reviewers ACK laanwj, stickies-v, fjahr, Sjors If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
-
DrahtBot added the label Tests on Apr 26, 2024
-
maflcko requested review from fjahr on Apr 26, 2024
-
laanwj commented at 7:30 am on April 26, 2024: member
-
stickies-v approved
-
stickies-v commented at 7:44 am on April 26, 2024: contributorACK fa55972a758865a6bd0114afe72e51877896d495
-
fjahr commented at 7:48 am on April 26, 2024: contributor
ACK fa55972a758865a6bd0114afe72e51877896d495
super-mini-nit: In the commit message,
urlDecode
is nowUrlDecode
-
in src/test/common_url_tests.cpp:57 in fa55972a75
53@@ -54,6 +54,9 @@ BOOST_AUTO_TEST_CASE(decode_malformed_test) { 54 BOOST_CHECK_EQUAL(UrlDecode(" %Z "), " %Z "); 55 BOOST_CHECK_EQUAL(UrlDecode(" % X"), " % X"); 56 57+ BOOST_CHECK_EQUAL(UrlDecode("%%ffg"), "%\xffg");
Sjors commented at 8:31 am on April 26, 2024:I had to scratch my head on this one…
It iterates from left to right, the first thing it finds is
%
. It then tries if the next two characters are hex, which they are not, so it puts the literal%
in the result. Then it moves to the next%
which is followed by valid hexff
. Since0xff
is invalid unicode, we have to represent it with the escape sequence"\xff"
. And then there’s the regular characterg
.Sjors approvedSjors commented at 8:32 am on April 26, 2024: memberutACK fa55972a758865a6bd0114afe72e51877896d495fanquake merged this on Apr 26, 2024fanquake closed this on Apr 26, 2024
maflcko deleted the branch on Apr 26, 2024
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-06-29 07:13 UTC
More mirrored repositories can be found on mirror.b10c.me