summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2014-01-15 14:11:26 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2014-01-15 14:11:26 -0800
commit0f784a53bcce67c760c8c1041d0f4c632fc3e5b3 (patch)
treefd3bee2bc874b8418ecb3127adcf6d33d23f50fc /test
parent0e8984100709658588c67d097452b8606c12d750 (diff)
parentf606d8176e57fbb61495b693bf3cd4e77373fcfb (diff)
downloadscala-0f784a53bcce67c760c8c1041d0f4c632fc3e5b3.tar.gz
scala-0f784a53bcce67c760c8c1041d0f4c632fc3e5b3.tar.bz2
scala-0f784a53bcce67c760c8c1041d0f4c632fc3e5b3.zip
Merge pull request #3285 from som-snytt/issue/8015-FF-NLs
Count lines by EOLs
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/t8015-ffa.check6
-rw-r--r--test/files/neg/t8015-ffa.scala8
-rw-r--r--test/files/neg/t8015-ffb.check6
-rw-r--r--test/files/neg/t8015-ffb.flags1
-rw-r--r--test/files/neg/t8015-ffb.scala11
-rw-r--r--test/files/run/t8015-ffc.scala7
6 files changed, 39 insertions, 0 deletions
diff --git a/test/files/neg/t8015-ffa.check b/test/files/neg/t8015-ffa.check
new file mode 100644
index 0000000000..0f28be7fe7
--- /dev/null
+++ b/test/files/neg/t8015-ffa.check
@@ -0,0 +1,6 @@
+t8015-ffa.scala:7: error: type mismatch;
+ found : String("3")
+ required: Int
+ val i: Int = "3" // error line 7 (was 8)
+ ^
+one error found
diff --git a/test/files/neg/t8015-ffa.scala b/test/files/neg/t8015-ffa.scala
new file mode 100644
index 0000000000..60876d9139
--- /dev/null
+++ b/test/files/neg/t8015-ffa.scala
@@ -0,0 +1,8 @@
+
+package foo
+
+//------- object Next
+
+trait F {
+ val i: Int = "3" // error line 7 (was 8)
+}
diff --git a/test/files/neg/t8015-ffb.check b/test/files/neg/t8015-ffb.check
new file mode 100644
index 0000000000..9b2171ea47
--- /dev/null
+++ b/test/files/neg/t8015-ffb.check
@@ -0,0 +1,6 @@
+t8015-ffb.scala:10: warning: side-effecting nullary methods are discouraged: suggest defining as `def w()` instead
+ def w = { x\u000c() } // ^L is colored blue on this screen, hardly visible
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/t8015-ffb.flags b/test/files/neg/t8015-ffb.flags
new file mode 100644
index 0000000000..7949c2afa2
--- /dev/null
+++ b/test/files/neg/t8015-ffb.flags
@@ -0,0 +1 @@
+-Xlint -Xfatal-warnings
diff --git a/test/files/neg/t8015-ffb.scala b/test/files/neg/t8015-ffb.scala
new file mode 100644
index 0000000000..dbdd942555
--- /dev/null
+++ b/test/files/neg/t8015-ffb.scala
@@ -0,0 +1,11 @@
+
+trait G {
+ val c: Char = '\u000a' // disallowed!
+ def x\u000d\u000a = 9 // as nl
+ def y() = x
+ def z() = {
+ y()\u000a() // was Int does not take parameters
+ }
+ def v = y()\u000c() // was Int does not take parameters
+ def w = { x () } // ^L is colored blue on this screen, hardly visible
+}
diff --git a/test/files/run/t8015-ffc.scala b/test/files/run/t8015-ffc.scala
new file mode 100644
index 0000000000..fe6781be42
--- /dev/null
+++ b/test/files/run/t8015-ffc.scala
@@ -0,0 +1,7 @@
+
+object Test extends App {
+ val ms = """This is a long multiline string
+ with \u000d\u000a CRLF embedded."""
+ assert(ms.lines.size == 3, s"lines.size ${ms.lines.size}")
+ assert(ms contains "\r\n CRLF", "no CRLF")
+}