summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNathan Gass2017-11-28 16:27:52 +0100
committerNathan Gass2017-11-28 16:27:52 +0100
commit80157030ad338d7a207b163bb9c8e0716d9068b3 (patch)
treecd0f832578f85c4d75e9e90dd7c518c459037b1e /tests
parentfdafbf02b626b5d0cf47ca982bbf5cf64e27084f (diff)
downloaditools-80157030ad338d7a207b163bb9c8e0716d9068b3.tar.gz
itools-80157030ad338d7a207b163bb9c8e0716d9068b3.tar.bz2
itools-80157030ad338d7a207b163bb9c8e0716d9068b3.zip
add more tests with fixes
Diffstat (limited to 'tests')
-rw-r--r--tests/U_tests.json95
1 files changed, 95 insertions, 0 deletions
diff --git a/tests/U_tests.json b/tests/U_tests.json
index a8b5688..3e1d092 100644
--- a/tests/U_tests.json
+++ b/tests/U_tests.json
@@ -1,4 +1,39 @@
[
+ {
+ "args": ["/Zürich"],
+ "exp": "/Z%C3%BCrich",
+ "name": "U() with utf8 umlaut"
+ },
+
+ {
+ "args": ["/path#Zürich"],
+ "exp": "/path#Z%C3%BCrich",
+ "name": "U() with utf8 umlaut in fragment"
+ },
+
+ {
+ "args": ["/foo.html?"],
+ "exp": "/foo.html",
+ "name": "U() removes ? at end"
+ },
+
+ {
+ "args": ["/foo.html#"],
+ "exp": "/foo.html",
+ "name": "U() removes # at end"
+ },
+
+ {
+ "args": ["/foo.html?#"],
+ "exp": "/foo.html",
+ "name": "U() removes ?# at end"
+ },
+
+ {
+ "args": ["/foo.html#?"],
+ "exp": "/foo.html#?",
+ "name": "U() keeps #? at end"
+ },
{
"args": ["/foo.html", {"bar": {"gna": 42, "qux": {"quux": "<Zürich>", "gnöp": "fasel"}}}],
@@ -7,12 +42,30 @@
},
{
+ "args": ["/foo.html?", {"foo" : "bar[qux][gnöp]=fasel"}],
+ "exp": "/foo.html?foo=bar%5Bqux%5D%5Bgn%C3%B6p%5D%3Dfasel",
+ "name": "U() with array syntax in value and ? at end of base"
+ },
+
+ {
"args": ["/foo.html?a=b&bar=qux&c=d", {"bar": "baz"}],
"exp": "/foo.html?a=b&bar=baz&c=d",
"name": "U() args override get params in base url"
},
{
+ "args": ["/foo.html?a=b&bar=qux&c=d", {"bar": "baz", "gna": "gnaber"}],
+ "exp": "/foo.html?a=b&bar=baz&c=d&gna=gnaber",
+ "name": "U() args override get params in base url and appends remaining params"
+ },
+
+ {
+ "args": ["/foo.html?gna=g&a=b&bar=qux&c=d", {"bar": "baz", "gna": "gnaber"}],
+ "exp": "/foo.html?gna=gnaber&a=b&bar=baz&c=d",
+ "name": "U() args override get params in base url keeping same order"
+ },
+
+ {
"args": ["/foo.html?bar.qux=a.b", {"c.d": "e.f", "g h": "i j"}],
"exp": "/foo.html?bar.qux=a.b&c.d=e.f&g+h=i+j",
"name": "U() dots and spaces in arg names are preserved"
@@ -43,8 +96,50 @@
},
{
+ "args": ["path#%% %1%x %1x%x1%xx%11%ff%FF%0f%0F %"],
+ "exp": "path#%25%25%20%251%25x%20%251x%25x1%25xx%11%ff%FF%0f%0F%20%25",
+ "name": "U() quoting of % if not followed by 2 hex digits in fragment"
+ },
+
+ {
"args": ["a\\b"],
"exp": "a/b",
"name": "U() converting of \\ to /"
+ },
+
+ {
+ "args": ["path/#a\\b"],
+ "exp": "path/#a%5Cb",
+ "name": "U() encode \\ in fragment"
+ },
+
+ {
+ "args": ["foo.html?bar=\\gna"],
+ "exp": "foo.html?bar=%5Cgna",
+ "name": "U() encode \\ in url parameter"
+ },
+
+ {
+ "args": ["path/#?a=b"],
+ "exp": "path/#?a=b",
+ "name": "U() keep query syntax in fragment"
+ },
+
+ {
+ "args": ["path/#Jet d'eau"],
+ "exp": "path/#Jet%20d%27eau",
+ "name": "U() with single quotes in fragment"
+ },
+
+ {
+ "args": ["//gna.ch"],
+ "exp": "//gna.ch/",
+ "name": "U() add / for absolute url without path"
+ },
+
+ {
+ "args": ["http://gna.ch"],
+ "exp": "http://gna.ch/",
+ "name": "U() add / for absolute http url without path"
}
]