1
0
forked from Mirror/wren

Raw strings now ignore whitespace on both ends for consistency and clarity

added more tests, updated documentation
This commit is contained in:
ruby0x1
2021-04-04 22:28:57 -07:00
parent 8304fd5ecc
commit e3c76a3e76
3 changed files with 62 additions and 16 deletions

View File

@ -6,6 +6,8 @@ System.print("A~¶Þॐஃ") // expect: A~¶Þॐஃ
// Raw strings.
System.print("""A raw string""") // expect: A raw string
System.print(""" A raw string""") // expect: A raw string
System.print("""A raw string """) // expect: A raw string
var long = "
A
@ -27,4 +29,31 @@ var raw = """
System.print(raw) // expect: A if*(<invalid>)*
// expect: multi line /{}()
// expect: raw string [\]/
// expect: "json": "value"
// expect: "json": "value"
// Raw strings ignore whitespace on the line with the """
var noNewlines = """
no newlines
"""
System.print(noNewlines) // expect: no newlines
// Spaces after the """ but before the \n
var noLeadingSpaces = """
no leading spaces
"""
System.print(noLeadingSpaces) // expect: no leading spaces
// Spaces before the end """ after the \n
var noTrailingSpaces = """
no trailing spaces
"""
System.print(noTrailingSpaces) // expect: no trailing spaces
var newlineBefore = """
newline before"""
System.print(newlineBefore) // expect: newline before
var newlineAfter = """newline after
"""
System.print(newlineAfter) // expect: newline after