diff --git a/core-lib/TestSuite/StringTests.som b/core-lib/TestSuite/StringTests.som index 9c91cd368..22f5f9211 100644 --- a/core-lib/TestSuite/StringTests.som +++ b/core-lib/TestSuite/StringTests.som @@ -131,6 +131,14 @@ class StringTests usingPlatform: platform testFramework: minitest = ( 1234567890 1234567890' ) + + public testMultLineStringPreserveNewlines = ( + | str | + str := '123 +567'. + assert: '\n' equals: (str charAt: 4). + assert: 7 equals: str length. + ) public testEscapeSequences = ( (* Tests for escape sequences, not all of them are reliable represented diff --git a/src/som/compiler/Lexer.java b/src/som/compiler/Lexer.java index 12c19b1fa..24be1a4d0 100644 --- a/src/som/compiler/Lexer.java +++ b/src/som/compiler/Lexer.java @@ -293,6 +293,7 @@ private void lexString() { if (fillBuffer() == -1) { return; } + state.text.append('\n'); } }