From 208678a0c1273d5746184b5980ec9674130fa63c Mon Sep 17 00:00:00 2001 From: michelou Date: Fri, 30 Mar 2007 11:59:49 +0000 Subject: removed Console, added 2 tests --- test/files/neg/checksensible.check | 42 ++++++++++++++++++++++---------------- test/files/neg/checksensible.scala | 20 +++++++++--------- 2 files changed, 34 insertions(+), 28 deletions(-) (limited to 'test/files/neg') diff --git a/test/files/neg/checksensible.check b/test/files/neg/checksensible.check index 442780f55c..112d101076 100644 --- a/test/files/neg/checksensible.check +++ b/test/files/neg/checksensible.check @@ -1,44 +1,50 @@ -checksensible.scala:2: error: class Test needs to be abstract, since method isabstract is not defined +checksensible.scala:1: error: class Test needs to be abstract, since method isabstract is not defined class Test { ^ -checksensible.scala:4: warning: comparing values of types scala.Ordered[scala.Unit] and scala.Unit using `>' will always yield false +checksensible.scala:3: warning: comparing values of types scala.Ordered[scala.Unit] and scala.Unit using `>' will always yield false println((c = 1) > 0) ^ -checksensible.scala:5: warning: comparing values of types scala.Ordered[scala.Unit] and scala.Unit using `<=' will always yield true +checksensible.scala:4: warning: comparing values of types scala.Ordered[scala.Unit] and scala.Unit using `<=' will always yield true println((c = 1) <= 0) ^ -checksensible.scala:6: warning: comparing values of types scala.Unit and scala.Int using `==' will always yield false +checksensible.scala:5: warning: comparing values of types scala.Unit and scala.Int using `==' will always yield false println((c = 1) == 0) ^ -checksensible.scala:8: warning: comparing values of types scala.Int and java.lang.String using `==' will always yield false +checksensible.scala:7: warning: comparing values of types scala.Int and java.lang.String using `==' will always yield false println(1 == "abc") ^ -checksensible.scala:9: warning: comparing values of types scala.Int and scala.Boolean using `!=' will always yield true +checksensible.scala:8: warning: comparing values of types scala.Int and scala.Boolean using `!=' will always yield true println(1 != true) ^ -checksensible.scala:11: warning: comparing a fresh object using `==' will always yield false +checksensible.scala:10: warning: comparing a fresh object using `==' will always yield false println(((x: int) => x + 1) == null) ^ -checksensible.scala:12: warning: comparing a fresh object using `==' will always yield false +checksensible.scala:11: warning: comparing a fresh object using `==' will always yield false println(new Object == new Object) ^ -checksensible.scala:13: warning: comparing a fresh object using `!=' will always yield true +checksensible.scala:12: warning: comparing a fresh object using `!=' will always yield true println(new Array(1) != new Array(1)) ^ -checksensible.scala:16: warning: comparing values of types scala.Int and scala.Null using `==' will always yield false - if( foo.length == null ) // == 0 makes more sense, but still +checksensible.scala:15: warning: comparing values of types scala.Int and scala.Null using `==' will always yield false + if (foo.length == null) // == 0 makes more sense, but still ^ -checksensible.scala:26: warning: comparing values of types scala.Unit and scala.Int using `!=' will always yield true - while((c = in.read) != -1) { - ^ -checksensible.scala:33: warning: comparing values of types scala.Unit and scala.Boolean using `==' will always yield false +checksensible.scala:24: warning: comparing values of types scala.Unit and scala.Int using `!=' will always yield true + while ((c = in.read) != -1) + ^ +checksensible.scala:30: warning: comparing values of types scala.Unit and scala.Boolean using `==' will always yield false println({} == true) ^ -checksensible.scala:35: warning: comparing a fresh object using `==' will always yield false +checksensible.scala:32: warning: comparing a fresh object using `==' will always yield false println(new Object == 1) ^ -checksensible.scala:36: warning: comparing values of types scala.Int and java.lang.Object using `==' will always yield false +checksensible.scala:33: warning: comparing values of types scala.Int and java.lang.Object using `==' will always yield false println(1 == (new Object)) ^ -13 warnings found +checksensible.scala:37: warning: comparing values of types scala.Int and scala.Unit using `!=' will always yield true + println(1 != println) + ^ +checksensible.scala:38: warning: comparing values of types scala.Int and scala.Symbol using `!=' will always yield true + println(1 != 'sym) + ^ +15 warnings found one error found diff --git a/test/files/neg/checksensible.scala b/test/files/neg/checksensible.scala index 7d0514396d..3a9fca2a08 100644 --- a/test/files/neg/checksensible.scala +++ b/test/files/neg/checksensible.scala @@ -1,4 +1,3 @@ -import java.io._ class Test { var c = 0 println((c = 1) > 0) @@ -12,20 +11,18 @@ class Test { println(new Object == new Object) println(new Array(1) != new Array(1)) - val foo: Array[String] = Array("1","2","3"); - if( foo.length == null ) // == 0 makes more sense, but still - Console.println("plante"); // this code leads to runtime crash + val foo: Array[String] = Array("1","2","3") + if (foo.length == null) // == 0 makes more sense, but still + println("plante") // this code leads to runtime crash else - Console.println("plante pas"); + println("plante pas") def main(args: Array[String]) = { - val in = new FileInputStream(args(0)) + val in = new java.io.FileInputStream(args(0)) var c = 0 - - while((c = in.read) != -1) { - Console.print(c.toChar) - } + while ((c = in.read) != -1) + print(c.toChar) in.close } @@ -37,4 +34,7 @@ class Test { def isabstract: int + println(1 != println) + println(1 != 'sym) + } -- cgit v1.2.3