make JS tests green again

This commit is contained in:
Andreas Rumpf 2018-04-14 00:54:15 +02:00
commit 6ae9341d48
2 changed files with 5 additions and 5 deletions

View file

@ -55,11 +55,11 @@ proc reprStrAux(result: var string, s: cstring, len: int) =
case c case c
of '"': add(result, "\\\"") of '"': add(result, "\\\"")
of '\\': add(result, "\\\\") of '\\': add(result, "\\\\")
of '\10': add(result, "\\10\"\n\"") #of '\10': add(result, "\\10\"\n\"")
of '\127'..'\255', '\0'..'\9', '\11'..'\31': of '\127'..'\255', '\0'..'\31':
add(result, "\\" & reprInt(ord(c))) add(result, "\\" & reprInt(ord(c)))
else: else:
add( result, reprInt(ord(c)) ) # Not sure about this. add(result, c)
add(result, "\"") add(result, "\"")
proc reprStr(s: string): string {.compilerRtl.} = proc reprStr(s: string): string {.compilerRtl.} =

View file

@ -103,7 +103,7 @@ block strings:
when defined js: # C prepends the pointer, JS does not. when defined js: # C prepends the pointer, JS does not.
doAssert(repr(a) == "\"12345\"") doAssert(repr(a) == "\"12345\"")
doAssert(repr(b) == "\"hello,repr\"") doAssert(repr(b) == "\"hello,repr\"")
doAssert(repr(c) == "\"hi\nthere\"") doAssert(repr(c) == "\"hi\\10there\"")
block sets: block sets:
let let