1
1
mirror of https://github.com/kanaka/mal.git synced 2024-08-16 17:20:23 +03:00

io: Fix unneeded escaping of forward slash

Instead of using Io's `asJson` method which escapes forward slashes,
implement our own string escaping code so it fits the Mal requirements.

The relevant step1 test was modified from soft to hard.
This commit is contained in:
Dov Murik 2019-07-23 10:21:27 +03:00
parent 92e1d438cd
commit 748df6f7bd
2 changed files with 5 additions and 4 deletions

View File

@ -7,7 +7,9 @@ Number malPrint := method(readable, self asString)
// Io strings are of type Sequence
Sequence malPrint := method(readable,
if(readable, self asString asJson, self asString)
if(readable,
"\"" .. (self asString asMutable replaceSeq("\\", "\\\\") replaceSeq("\"", "\\\"") replaceSeq("\n", "\\n")) .. "\"",
self asString)
)
MalMeta := Object clone do(

View File

@ -98,6 +98,8 @@ false
;=>","
"-"
;=>"-"
"/"
;=>"/"
":"
;=>":"
";"
@ -275,6 +277,3 @@ false
;; fantom fails this one
"!"
;=>"!"
;; io fails this one
"/"
;=>"/"