mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 19:34:27 -05:00
647: fixed quote/newline escaping in here documents
This commit is contained in:
@@ -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 '\\`', `
|
||||
"\\\`"
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user