[build-path-prefix-map-spec] 12/50: More test cases and behaviour normalisation
Ximin Luo
infinity0 at debian.org
Fri Mar 10 15:17:19 UTC 2017
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository build-path-prefix-map-spec.
commit 520d30a06b4da1e8d4a9a3721759e2ad9061258e
Author: Ximin Luo <infinity0 at debian.org>
Date: Mon Jan 23 20:45:04 2017 +0100
More test cases and behaviour normalisation
---
consume/hexsplit.c | 2 +-
consume/hexsplit.js | 2 +-
consume/testcases/0.allbytes-ok.hexsplit.env | 1 +
consume/testcases/{0.empty-ok.in => 0.allbytes-ok.in} | 0
consume/testcases/{0.empty-ok.in => 0.allbytes-ok.out} | 0
consume/testcases/1.invalid-hex.hexsplit.env | 1 +
consume/testcases/{0.empty-ok.in => 1.invalid-hex.in} | 0
consume/testcases/{1.many-=-not-ok.out => 1.invalid-hex.out} | 0
consume/testcases/1.short-hex.hexsplit.env | 1 +
consume/testcases/{0.empty-ok.in => 1.short-hex.in} | 0
consume/testcases/{1.many-=-not-ok.out => 1.short-hex.out} | 0
consume/testcases/README | 3 +++
12 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/consume/hexsplit.c b/consume/hexsplit.c
index c6e6912..eee9532 100644
--- a/consume/hexsplit.c
+++ b/consume/hexsplit.c
@@ -21,7 +21,7 @@ unquote (char *src)
if (!(x[0] = *++src) || !(x[1] = *++src))
return 0; // invalid, past end of string
sscanf(x, "%2hhx", &c);
- if (errno != 0)
+ if (errno != 0 || !c)
return 0; // invalid, not valid hex
*dest = c;
break;
diff --git a/consume/hexsplit.js b/consume/hexsplit.js
index 6ceb3f3..cda20da 100755
--- a/consume/hexsplit.js
+++ b/consume/hexsplit.js
@@ -1,7 +1,7 @@
#!/usr/bin/nodejs
var unquote = function(x) {
- var parts = x.split(/=/g).map(unescape);
+ var parts = x.split(/=/g).map(decodeURIComponent);
if (parts.length !== 2) throw "invalid value: " + x;
return parts;
};
diff --git a/consume/testcases/0.allbytes-ok.hexsplit.env b/consume/testcases/0.allbytes-ok.hexsplit.env
new file mode 100644
index 0000000..70e3333
--- /dev/null
+++ b/consume/testcases/0.allbytes-ok.hexsplit.env
@@ -0,0 +1 @@
+
!"#$&'()*+,-./0123456789;<>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~�������������������������������������������������������������������������������������������������������������������������������=
diff --git a/consume/testcases/0.empty-ok.in b/consume/testcases/0.allbytes-ok.in
similarity index 100%
copy from consume/testcases/0.empty-ok.in
copy to consume/testcases/0.allbytes-ok.in
diff --git a/consume/testcases/0.empty-ok.in b/consume/testcases/0.allbytes-ok.out
similarity index 100%
copy from consume/testcases/0.empty-ok.in
copy to consume/testcases/0.allbytes-ok.out
diff --git a/consume/testcases/1.invalid-hex.hexsplit.env b/consume/testcases/1.invalid-hex.hexsplit.env
new file mode 100644
index 0000000..d34b41f
--- /dev/null
+++ b/consume/testcases/1.invalid-hex.hexsplit.env
@@ -0,0 +1 @@
+/a/b%zzyyy=ERROR:/a=lol:/b=foo:/a/b%3dyyy=secreteh
diff --git a/consume/testcases/0.empty-ok.in b/consume/testcases/1.invalid-hex.in
similarity index 100%
copy from consume/testcases/0.empty-ok.in
copy to consume/testcases/1.invalid-hex.in
diff --git a/consume/testcases/1.many-=-not-ok.out b/consume/testcases/1.invalid-hex.out
similarity index 100%
copy from consume/testcases/1.many-=-not-ok.out
copy to consume/testcases/1.invalid-hex.out
diff --git a/consume/testcases/1.short-hex.hexsplit.env b/consume/testcases/1.short-hex.hexsplit.env
new file mode 100644
index 0000000..bb571ed
--- /dev/null
+++ b/consume/testcases/1.short-hex.hexsplit.env
@@ -0,0 +1 @@
+/a/b%3dyyy=ERROR%:/a=lol:/b=foo:/a/b%3dyyy=secreteh
diff --git a/consume/testcases/0.empty-ok.in b/consume/testcases/1.short-hex.in
similarity index 100%
copy from consume/testcases/0.empty-ok.in
copy to consume/testcases/1.short-hex.in
diff --git a/consume/testcases/1.many-=-not-ok.out b/consume/testcases/1.short-hex.out
similarity index 100%
copy from consume/testcases/1.many-=-not-ok.out
copy to consume/testcases/1.short-hex.out
diff --git a/consume/testcases/README b/consume/testcases/README
index 423857e..d60a9e9 100644
--- a/consume/testcases/README
+++ b/consume/testcases/README
@@ -3,3 +3,6 @@ Naming convention is like:
<expected return code>.<unique name>.in
<expected return code>.<unique name>.out
<expected return code>.<unique name>.<format-name>.env
+
+0.allbytes-ok.hexsplit.env was created by running in python:
+>>> open("testcases/0.allbytes-ok.hexsplit.env", "wb").write(bytes(i for i in range(1, 255) if chr(i) not in "%=:\n") + b"=\n")
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/build-path-prefix-map-spec.git
More information about the Reproducible-commits
mailing list