From: Brendan Hansen Date: Thu, 30 Dec 2021 00:52:59 +0000 (-0600) Subject: added quotes in custom map printing X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=0d2705b18a0a69303284488334e77499663b850e;p=onyx.git added quotes in custom map printing --- diff --git a/core/container/map.onyx b/core/container/map.onyx index d1df1e70..af0d335d 100644 --- a/core/container/map.onyx +++ b/core/container/map.onyx @@ -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(" "); diff --git a/tests/i32map b/tests/i32map index 0e86e6ab..319435bc 100644 --- a/tests/i32map +++ b/tests/i32map @@ -2,8 +2,8 @@ true false Hello World! { - 50 => Hello - 1234 => World! + 50 => "Hello " + 1234 => "World!" } false false