diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-01-29 13:54:31 -0800 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-01-29 13:54:31 -0800 |
commit | 0e578e693196f93b1ba4f972a2c96d468bef464a (patch) | |
tree | 0799014dfad40585af53663f2d0b09fe9949c5de /test/junit | |
parent | f0809f41149174634abc1034e4b17e944c491dcc (diff) | |
parent | f584f5b4b86be552bcba47309b8e63363a9904d9 (diff) | |
download | scala-0e578e693196f93b1ba4f972a2c96d468bef464a.tar.gz scala-0e578e693196f93b1ba4f972a2c96d468bef464a.tar.bz2 scala-0e578e693196f93b1ba4f972a2c96d468bef464a.zip |
Merge pull request #3429 from som-snytt/issue/8205
SI-8205 Don't include CR in line
Diffstat (limited to 'test/junit')
-rw-r--r-- | test/junit/scala/reflect/internal/util/SourceFileTest.scala | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/junit/scala/reflect/internal/util/SourceFileTest.scala b/test/junit/scala/reflect/internal/util/SourceFileTest.scala index bbd5685ef7..903e705ba2 100644 --- a/test/junit/scala/reflect/internal/util/SourceFileTest.scala +++ b/test/junit/scala/reflect/internal/util/SourceFileTest.scala @@ -30,4 +30,26 @@ class SourceFileTest { assertEquals("def", lineContentOf("abc\ndef", 6)) assertEquals("def", lineContentOf("abc\ndef\n", 7)) } + + @Test + def CRisEOL(): Unit = { + assertEquals("", lineContentOf("\r", 0)) + assertEquals("abc", lineContentOf("abc\rdef", 0)) + assertEquals("abc", lineContentOf("abc\rdef", 3)) + assertEquals("def", lineContentOf("abc\rdef", 4)) + assertEquals("def", lineContentOf("abc\rdef", 6)) + assertEquals("def", lineContentOf("abc\rdef\r", 7)) + } + + @Test + def CRNLisEOL(): Unit = { + assertEquals("", lineContentOf("\r\n", 0)) + assertEquals("abc", lineContentOf("abc\r\ndef", 0)) + assertEquals("abc", lineContentOf("abc\r\ndef", 3)) + assertEquals("abc", lineContentOf("abc\r\ndef", 4)) + assertEquals("def", lineContentOf("abc\r\ndef", 5)) + assertEquals("def", lineContentOf("abc\r\ndef", 7)) + assertEquals("def", lineContentOf("abc\r\ndef", 8)) + assertEquals("def", lineContentOf("abc\r\ndef\r\n", 9)) + } } |