diff options
author | sanine <sanine.not@pm.me> | 2022-08-15 16:51:41 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-08-15 16:51:41 -0500 |
commit | aaae95ae682f621bd17965147126bf5cf73d2df2 (patch) | |
tree | b7c1369c3d42c6c572ace6cfff8e591aff69c902 /test.lua | |
parent | 819d1ebb624c946f383bcea54f6b4363a1fa0153 (diff) |
add decode_query
Diffstat (limited to 'test.lua')
-rwxr-xr-x | test.lua | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -164,8 +164,19 @@ test("marigold.html correctly renders children", function() end) -test("marigold.percentDecode correctly decodes percent-encoded strings", function() +test("marigold.decode_percent correctly decodes percent-encoded strings", function() local str = '%20%21%23%24%25%26%27%28%29%2A%2B%2C%2F%3A%3B%3D%3F%40%5B%5D' - assert(marigold.percentDecode(str) == " !#$%&'()*+,/:;=?@[]") - assert(marigold.percentDecode('%25+%2b') == '%++') + assert(marigold.decode_percent(str) == " !#$%&'()*+,/:;=?@[]") + assert(marigold.decode_percent('%25+%2b') == '%++') +end) + + +test("marigold.decode_query correctly obtains data", function() + local tbl + tbl = marigold.decode_query('') + tbl = marigold.decode_query('name=john') + assert(tbl.name == 'john') + tbl = marigold.decode_query('string=hello%2C+world%21&name=jane') + assert(tbl.string == 'hello, world!') + assert(tbl.name == 'jane') end) |