KT-1385 support multi line strings with templates
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
fun box() : String {
|
||||
val s = "abc"
|
||||
val test1 = """$s"""
|
||||
if (test1 != "abc") return "Fail 1: $test1"
|
||||
|
||||
val test2 = """${s}"""
|
||||
if (test2 != "abc") return "Fail 2: $test2"
|
||||
|
||||
val test3 = """ "$s" """
|
||||
if (test3 != " \"abc\" ") return "Fail 3: $test3"
|
||||
|
||||
val test4 = """ "${s}" """
|
||||
if (test4 != " \"abc\" ") return "Fail 4: $test4"
|
||||
|
||||
val test5 =
|
||||
"""
|
||||
${s.length}
|
||||
"""
|
||||
if (test5 != "\n 3\n") return "Fail 5: $test5"
|
||||
|
||||
val test6 = """\n"""
|
||||
if (test6 != "\\n") return "Fail 6: $test6"
|
||||
|
||||
val test7 = """\${'$'}foo"""
|
||||
if (test7 != "\\\$foo") return "Fail 7: $test7"
|
||||
|
||||
val test8 = """$ foo"""
|
||||
if (test8 != "$ foo") return "Fail 8: $test8"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
fun box() : String {
|
||||
val s = "abc"
|
||||
val test1 = """$s"""
|
||||
if (test1 != "abc") return "Fail 1: $test1"
|
||||
|
||||
val test2 = """${s}"""
|
||||
if (test2 != "abc") return "Fail 2: $test2"
|
||||
|
||||
val test3 = """ "$s" """
|
||||
if (test3 != " \"abc\" ") return "Fail 3: $test3"
|
||||
|
||||
val test4 = """ "${s}" """
|
||||
if (test4 != " \"abc\" ") return "Fail 4: $test4"
|
||||
|
||||
val test5 =
|
||||
"""
|
||||
${s.length}
|
||||
"""
|
||||
if (test5 != "\n 3\n") return "Fail 5: $test5"
|
||||
|
||||
val test6 = """\n"""
|
||||
if (test6 != "\\n") return "Fail 6: $test6"
|
||||
|
||||
val test7 = """\${'$'}foo"""
|
||||
if (test7 != "\\\$foo") return "Fail 7: $test7"
|
||||
|
||||
val test8 = """$ foo"""
|
||||
if (test8 != "$ foo") return "Fail 8: $test8"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
|
||||
fun new() : String {
|
||||
return """
|
||||
sdfasdf
|
||||
${<!UNRESOLVED_REFERENCE!>a<!>}
|
||||
ds"asdfas
|
||||
$<!UNRESOLVED_REFERENCE!>b<!>
|
||||
asgfaf
|
||||
"""
|
||||
|
||||
}
|
||||
@@ -105,8 +105,11 @@ JetFile: SimpleExpressions.jet
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
STRING_CONSTANT
|
||||
PsiElement(RAW_STRING_LITERAL)('"""dsf"""')
|
||||
STRING_TEMPLATE
|
||||
PsiElement(OPEN_QUOTE)('"""')
|
||||
LITERAL_STRING_TEMPLATE_ENTRY
|
||||
PsiElement(REGULAR_STRING_PART)('dsf')
|
||||
PsiElement(CLOSING_QUOTE)('"""')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
VALUE_PARAMETER
|
||||
|
||||
@@ -259,8 +259,11 @@ JetFile: When.jet
|
||||
PsiElement(is)('is')
|
||||
PsiWhiteSpace(' ')
|
||||
EXPRESSION_PATTERN
|
||||
STRING_CONSTANT
|
||||
PsiElement(RAW_STRING_LITERAL)('"""ddd"""')
|
||||
STRING_TEMPLATE
|
||||
PsiElement(OPEN_QUOTE)('"""')
|
||||
LITERAL_STRING_TEMPLATE_ENTRY
|
||||
PsiElement(REGULAR_STRING_PART)('ddd')
|
||||
PsiElement(CLOSING_QUOTE)('"""')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
|
||||
Reference in New Issue
Block a user