Sha256: fca1b7085f94af2fafe131d61febdc4b0d6f03df30bdf4fb14c9cf915e1d7514

Contents?: true

Size: 1.48 KB

Versions: 10

Compression:

Stored size: 1.48 KB

Contents

# String Literals
# ---------------

# TODO: refactor string literal tests
# TODO: add indexing and method invocation tests: "string"["toString"] is String::toString, "string".toString() is "string"

# * Strings
# * Heredocs

test "backslash escapes", ->
  eq "\\/\\\\", /\/\\/.source

eq '(((dollars)))', '\(\(\(dollars\)\)\)'
eq 'one two three', "one
 two
 three"
eq "four five", 'four

 five'

#647
eq "''Hello, World\\''", '''
'\'Hello, World\\\''
'''
eq '""Hello, World\\""', """
"\"Hello, World\\\""
"""
eq 'Hello, World\n', '''
Hello, World\

'''

a = """
    basic heredoc
    on two lines
    """
ok a is "basic heredoc\non two lines"

a = '''
    a
      "b
    c
    '''
ok a is "a\n  \"b\nc"

a = """
a
 b
  c
"""
ok a is "a\n b\n  c"

a = '''one-liner'''
ok a is 'one-liner'

a = """
      out
      here
"""
ok a is "out\nhere"

a = '''
       a
     b
   c
    '''
ok a is "    a\n  b\nc"

a = '''
a


b c
'''
ok a is "a\n\n\nb c"

a = '''more"than"one"quote'''
ok a is 'more"than"one"quote'

a = '''here's an apostrophe'''
ok a is "here's an apostrophe"

# The indentation detector ignores blank lines without trailing whitespace
a = """
    one
    two

    """
ok a is "one\ntwo\n"

eq ''' line 0
  should not be relevant
    to the indent level
''', '
 line 0\n
should not be relevant\n
  to the indent level
'

eq ''' '\\\' ''', " '\\' "
eq """ "\\\" """, ' "\\" '

eq '''  <- keep these spaces ->  ''', '  <- keep these spaces ->  '


test "#1046, empty string interpolations", ->
  eq "#{ }", ''

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
guard-mthaml-0.4.0 vendor/coffeescript/coffeescript/tests/cases/strings.coffee
guard-mthaml-0.3.1 vendor/coffeescript/coffeescript/tests/cases/strings.coffee
guard-mthaml-0.3.0 vendor/coffeescript/coffeescript/tests/cases/strings.coffee
guard-mthaml-0.2.5 vendor/coffeescript/coffeescript/tests/cases/strings.coffee
guard-mthaml-0.2.4 vendor/coffeescript/coffeescript/tests/cases/strings.coffee
guard-mthaml-0.2.3 vendor/coffeescript/coffeescript/tests/cases/strings.coffee
guard-mthaml-0.2.2 vendor/coffeescript/coffeescript/tests/cases/strings.coffee
guard-mthaml-0.2.1 vendor/coffeescript/coffeescript/tests/cases/strings.coffee
guard-mthaml-0.2.0 vendor/coffeescript/coffeescript/tests/cases/strings.coffee
guard-mthaml-0.1.0 vendor/coffeescript/coffeescript/tests/cases/strings.coffee