[tor-commits] [flashproxy/master] Add more parse_query_string test vectors.

dcf at torproject.org dcf at torproject.org
Mon Apr 9 04:08:42 UTC 2012


commit f884810df178f765cc783e1e89baf66aa9c4a03c
Author: David Fifield <david at bamsoftware.com>
Date:   Mon Mar 12 22:21:30 2012 -0700

    Add more parse_query_string test vectors.
---
 flashproxy-test.js |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/flashproxy-test.js b/flashproxy-test.js
index 21ae756..e90d4b1 100755
--- a/flashproxy-test.js
+++ b/flashproxy-test.js
@@ -84,6 +84,29 @@ function test_parse_query_string()
           expected: { a: "b", c: "d" } },
         { qs: "client=&relay=1.2.3.4%3A9001",
           expected: { client: "", relay: "1.2.3.4:9001" } },
+        { qs: "a=b%26c=d",
+          expected: { a: "b&c=d" } },
+        { qs: "a%3db=d",
+          expected: { "a=b": "d" } },
+        { qs: "a=b+c%20d",
+          expected: { "a": "b c d" } },
+        { qs: "a=b+c%2bd",
+          expected: { "a": "b c+d" } },
+        { qs: "a+b=c",
+          expected: { "a b": "c" } },
+        /* First appearance wins. */
+        { qs: "a=b&c=d&a=e",
+          expected: { a: "b", c: "d" } },
+        { qs: "a",
+          expected: { a: "" } },
+        { qs: "=b",
+          expected: { "": "b" } },
+        { qs: "&a=b",
+          expected: { "": "", a: "b" } },
+        { qs: "a=b&",
+          expected: { "": "", a: "b" } },
+        { qs: "a=b&&c=d",
+          expected: { "": "", a: "b", c: "d" } },
     ];
 
     for (var i = 0; i < TESTS.length; i++) {





More information about the tor-commits mailing list