summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorgerald <gerald>2017-06-19 22:21:36 (GMT)
committergerald <gerald>2017-06-19 22:21:36 (GMT)
commit4ab539d0ac7409566a870b129f592b3b07ab7ec8 (patch)
tree612677ed840e7d26f82a024b5be8e3c9dbaeed0d /tests
parent0ba6baf0cf656ac33c2fb74ab8cdd18b7a5c6751 (diff)
downloadtcl-4ab539d0ac7409566a870b129f592b3b07ab7ec8.zip
tcl-4ab539d0ac7409566a870b129f592b3b07ab7ec8.tar.gz
tcl-4ab539d0ac7409566a870b129f592b3b07ab7ec8.tar.bz2
[4e5007ea1b285527] Added all code path tests for ::http::formatQuery.
Diffstat (limited to 'tests')
-rw-r--r--tests/http-tip-452.test82
1 files changed, 79 insertions, 3 deletions
diff --git a/tests/http-tip-452.test b/tests/http-tip-452.test
index d77e1c2..ca3a8c4 100644
--- a/tests/http-tip-452.test
+++ b/tests/http-tip-452.test
@@ -1906,17 +1906,93 @@ catch {unset data}
##
## Test http::formatQuery
##
-::tcltest::test http-3.1 {http::formatQuery} \
+::tcltest::test http-3.1 {http::formatQuery -- no arguments} \
-setup {
+ ::tcltest::testSetup {
+ ::http::mapReply {
+ * {
+ use {
+ prefix {return}
+ }
+ code {ok}
+ }
+ }
+ }
+ } \
+ -body {
+ set status [catch {::http::formatQuery} result]
+ list $status $result
+ } \
+ -cleanup {
+ ::tcltest::testCleanup
+ } \
+ -result {0 {}}
+::tcltest::test http-3.2 {http::formatQuery -- one set arguments} \
+ -setup {
+ ::tcltest::testSetup {
+ ::http::mapReply {
+ * {
+ use {
+ prefix {return}
+ }
+ code {ok}
+ }
+ }
+ }
} \
-body {
- list Test Not Yet Implemented
+ set status [catch {::http::formatQuery arg1 val1} result]
+ list $status $result
} \
-cleanup {
::tcltest::testCleanup
} \
- -result {}
+ -result {0 arg1=val1}
+
+::tcltest::test http-3.3 {http::formatQuery -- two set arguments} \
+ -setup {
+ ::tcltest::testSetup {
+ ::http::mapReply {
+ * {
+ use {
+ prefix {return}
+ }
+ code {ok}
+ }
+ }
+ }
+ } \
+ -body {
+ set status [catch {::http::formatQuery arg1 val1 arg2 val2} result]
+ list $status $result
+ } \
+ -cleanup {
+ ::tcltest::testCleanup
+ } \
+ -result {0 arg1=val1&arg2=val2}
+
+::tcltest::test http-3.4 {http::formatQuery -- odd set arguments (Ticket: 4e5007ea1b2855277b349964ef1512ad884edace (6970))} \
+ -setup {
+ ::tcltest::testSetup {
+ ::http::mapReply {
+ * {
+ use {
+ prefix {return}
+ }
+ code {ok}
+ }
+ }
+ }
+ } \
+ -body {
+ set status [catch {::http::formatQuery arg1 val1 arg2} result]
+ list $status $result
+ } \
+ -cleanup {
+ ::tcltest::testCleanup
+ } \
+ -result {1 {Incorrect number of arguments, must be an even number.}}
##