about summary refs log tree commit diff
path: root/users/sterni/nix/url/tests
diff options
context:
space:
mode:
Diffstat (limited to 'users/sterni/nix/url/tests')
-rw-r--r--users/sterni/nix/url/tests/default.nix7
1 files changed, 7 insertions, 0 deletions
diff --git a/users/sterni/nix/url/tests/default.nix b/users/sterni/nix/url/tests/default.nix
index f58cf12a02b2..7cf53cde1555 100644
--- a/users/sterni/nix/url/tests/default.nix
+++ b/users/sterni/nix/url/tests/default.nix
@@ -16,6 +16,10 @@ let
     assertEq "encode ${builtins.toJSON left} == ${builtins.toJSON right}"
       (url.encode args left) right;
 
+  checkDecoding = { left, right }:
+  assertEq "${builtins.toJSON left} == decode ${builtins.toJSON right}"
+    (url.decode left) right;
+
   unreserved = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_~";
 
   encodeExpected = [
@@ -31,6 +35,9 @@ let
   testEncode = it "checks url.encode"
     (builtins.map (checkEncoding {}) encodeExpected);
 
+  testDecode = it "checks url.decode"
+    (builtins.map checkDecoding encodeExpected);
+
   testLeaveReserved = it "checks that leaveReserved is like id for valid URLs"
     (builtins.map (x: checkEncoding { leaveReserved = true; } { left = x; right = x; }) [
       "ftp://ftp.is.co.za/rfc/rfc1808.txt"