This is an automated email from the ASF dual-hosted git repository.

mxmanghi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tcl-rivet.git

commit ccdcb2ea663ecbd756c71caeba775c435fbc04cc
Author: Massimo Manghi <mxman...@apache.org>
AuthorDate: Fri Aug 17 16:55:54 2018 +0200

    add tests for ::rivet::xml and fixed overlooked error
---
 tests/commands.tcl  | 26 ++++++++++++++++++++++++++
 tests/commands.test | 15 +++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/tests/commands.tcl b/tests/commands.tcl
new file mode 100644
index 0000000..265ab96
--- /dev/null
+++ b/tests/commands.tcl
@@ -0,0 +1,26 @@
+# -- commands.tcl
+#
+# testing the output of various commands that 
+# provide a swiss knife for formatting, generating, etc.etc.
+#
+
+
+if {[::rivet::var exists cmd]} {
+
+    set cmd [::rivet::var get cmd]
+    switch $cmd {
+        xml {
+            puts [::rivet::xml "" a [list b a1 v1 a2 v2] [list c a1 v1 a2 v2]]
+            puts [::rivet::xml "" [list b a1 v1 a2 v2] [list c a1 v1 a2 v2] a]
+            puts -nonewline [::rivet::xml "element text" a [list b a1 v1 a2 
v2] [list c a1 v1 a2 v2]]
+        }
+        default {
+            puts "invalid argument '$cmd'"
+        }
+    }
+
+} else {
+
+    puts "no cmd argument provided" 
+
+}
diff --git a/tests/commands.test b/tests/commands.test
new file mode 100644
index 0000000..2a5c1a1
--- /dev/null
+++ b/tests/commands.test
@@ -0,0 +1,15 @@
+# -- commands.test
+# 
+# Tcl commands suite tests
+#
+# Testing the output of various commands that 
+# provide a swiss knife for formatting, generating, etc.etc.
+#
+
+::tcltest::test tcl-xml-1.1 {::rivet::xml command} {
+    set page [::http::geturl "${urlbase}commands.tcl?cmd=xml"]
+    ::http::data $page
+} {<a><b a1="v1" a2="v2"><c a1="v1" a2="v2"/></b></a>
+<b a1="v1" a2="v2"><c a1="v1" a2="v2"><a /></c></b>
+<a><b a1="v1" a2="v2"><c a1="v1" a2="v2">element text</c></b></a>}
+


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@tcl.apache.org
For additional commands, e-mail: commits-h...@tcl.apache.org

Reply via email to