647: fixed quote/newline escaping in here documents

This commit is contained in:
satyr
2010-10-03 07:45:23 +09:00
parent 769870b493
commit ae55c70ac5
3 changed files with 44 additions and 25 deletions

View File

@@ -34,11 +34,27 @@ func = ->
ok func() is null
eq /\\/.source, "\\\\"
eq '(((dollars)))', '\(\(\(dollars\)\)\)'
eq 'one two three', "one
two
three"
eq "four five", 'four
str = "\\"
reg = /\\/
five'
#647
eq "''Hello, World\\''", '''
'\'Hello, World\\\''
'''
eq '""Hello, World\\""', """
"\"Hello, World\\\""
"""
eq 'Hello, World\n', '''
Hello, World\
'''
ok reg(str) and str is '\\'
trailingComma = [1, 2, 3,]
ok (trailingComma[0] is 1) and (trailingComma[2] is 3) and (trailingComma.length is 3)
@@ -54,18 +70,6 @@ trailingComma = {k1: "v1", k2: 4, k3: (-> true),}
ok trailingComma.k3() and (trailingComma.k2 is 4) and (trailingComma.k1 is "v1")
money$ = '(((dollars)))'
ok money$ is '\(\(\(dollars\)\)\)'
multiline = "one
two
three"
ok multiline is 'one two three'
ok {a: (num) -> num is 10 }.a 10
@@ -242,6 +246,6 @@ ok b is 100
# Inline JS
ok '\\`' is `
eq '\\`', `
"\\\`"
`