Tcl Library Source Code

Artifact [89cb352bbc]
Login
EuroTcl/OpenACS 11 - 12 JULY 2024, VIENNA

Artifact 89cb352bbcf4a00e06044249bc6fdd3401007b7c:

Attachment "huddle.patch" to ticket [e4cfcc0f96] added by anonymous 2017-05-10 18:56:09. (unpublished)
Index: modules/yaml/huddle.tcl
==================================================================
--- modules/yaml/huddle.tcl
+++ modules/yaml/huddle.tcl
@@ -487,14 +487,17 @@
 
     set type [huddle type $huddle_object]
 
     switch -- $type {
         boolean -
-        number -
-        null {
+        number {
             return [huddle get_stripped $huddle_object]
         }
+
+        null {
+            return null
+        }
 
         string {
             set data [huddle get_stripped $huddle_object]
 
             # JSON permits only oneline string

Index: modules/yaml/huddle.test
==================================================================
--- modules/yaml/huddle.test
+++ modules/yaml/huddle.test
@@ -219,10 +219,21 @@
     
     set data [json::json2dict $json1]
     set data [huddle compile {dict dd {dict * dict} ee {dict k number * string}}  $data]
     huddle equal $huddle1 $data
 } -result {1}
+
+test huddle-3.5 "test of huddle jsondump" -body {
+    huddle jsondump {HUDDLE null}
+} -result {null}
+
+test huddle-3.6 "test of huddle jsondump" -body {
+    huddle jsondump {HUDDLE {D {a {s foo} b null}}}
+} -result {{
+  "a": "foo",
+  "b": null
+}}
 
 # ... Tests of addStrings ...
 #     (Requires introspection of parser state)
 
 test huddle-4.1 "test of huddle set" -body {