added quotes in custom map printing
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 30 Dec 2021 00:52:59 +0000 (18:52 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 30 Dec 2021 00:52:59 +0000 (18:52 -0600)
core/container/map.onyx
tests/i32map

index d1df1e700e53918ae93216baf5d6f95224233c29..af0d335d95da07db527754845249cc56afe58cb7 100644 (file)
@@ -146,6 +146,10 @@ empty :: (use map: ^Map($K, $V)) -> bool {
 }
 
 format_map :: (output: ^conv.Format_Output, format: ^conv.Format, x: ^Map($K, $V)) {
+    old_quote_strings := format.quote_strings;    
+    format.quote_strings = true;
+    defer format.quote_strings = old_quote_strings;
+
     output->write("{\n");
     for^ e: x.entries {
         output->write("    ");
index 0e86e6ab24b60300b7766ccb1701035828363ee5..319435bcf8f8eef7a543de6b991bf691f2600b39 100644 (file)
@@ -2,8 +2,8 @@ true
 false
 Hello World!
 {
-    50 => Hello 
-    1234 => World!
+    50 => "Hello "
+    1234 => "World!"
 }
 false
 false