Don't escape multibyte characters (#7570)

This commit is contained in:
Oscar Nihlgård 2018-04-23 11:09:48 +02:00 • committed by Andreas Rumpf
commit 8caf257607
4 changed files with 60 additions and 42 deletions

View file

@ -85,14 +85,20 @@ block:
s.addQuoted('\0')
s.addQuoted('\31')
s.addQuoted('\127')
s.addQuoted('\255')
doAssert s == "'\\x00''\\x1F''\\x7F''\\xFF'"
doAssert s == "'\\x00''\\x1F''\\x7F'"
block:
var s = ""
s.addQuoted('\\')
s.addQuoted('\'')
s.addQuoted('\"')
doAssert s == """'\\''\'''\"'"""
block:
var s = ""
s.addQuoted("å")
s.addQuoted("ä")
s.addQuoted("ö")
s.addEscapedChar('\xFF')
doAssert s == """"å""ä""ö"\xFF"""
# Test customized element representation
type CustomString = object