summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2008-01-18 20:50:06 +0000
committermichelou <michelou@epfl.ch>2008-01-18 20:50:06 +0000
commit7e1a139a3545280101fb122e16028c60a9cfee01 (patch)
treed93ef895ef930db4c0c6be60d20dba893f1b091e
parent456729b845c3360f8d7b100b774b7432d2e4ed2f (diff)
downloadscala-7e1a139a3545280101fb122e16028c60a9cfee01.tar.gz
scala-7e1a139a3545280101fb122e16028c60a9cfee01.tar.bz2
scala-7e1a139a3545280101fb122e16028c60a9cfee01.zip
removed more warnings
-rw-r--r--test/files/jvm/xml01.scala22
-rw-r--r--test/files/run/bugs.scala81
-rw-r--r--test/files/run/map_test.scala64
-rw-r--r--test/files/run/tcpoly_parseridioms.scala4
4 files changed, 84 insertions, 87 deletions
diff --git a/test/files/jvm/xml01.scala b/test/files/jvm/xml01.scala
index 2804513ce0..7246c94c5b 100644
--- a/test/files/jvm/xml01.scala
+++ b/test/files/jvm/xml01.scala
@@ -1,10 +1,10 @@
import java.io.StringReader
import org.xml.sax.InputSource
-import scala.xml._
+import scala.testing.SUnit._
import scala.util.logging._
+import scala.xml._
-import scala.testing.SUnit._
object Test extends Application with Assert {
val e: scala.xml.MetaData = Null //Node.NoAttributes
@@ -31,12 +31,12 @@ object Test extends Application with Assert {
assertEquals(c, parsedxml11)
assertEquals(parsedxml1, parsedxml11)
assertSameElements(List(parsedxml1), List(parsedxml11))
- assertSameElements(Iterator.fromArray(Array(parsedxml1)).toList, List(parsedxml11))
+ assertSameElements(Array(parsedxml1).toList, List(parsedxml11))
val x2 = "<book><author>Peter Buneman</author><author>Dan Suciu</author><title>Data on ze web</title></book>";
- val i = new InputSource( new StringReader( x2 ));
- val x2p = XML.load( i );
+ val i = new InputSource(new StringReader(x2))
+ val x2p = XML.load(i)
assertEquals(x2p, Elem(null, "book" , e, sc,
Elem(null, "author", e, sc,Text("Peter Buneman")),
@@ -44,16 +44,16 @@ object Test extends Application with Assert {
Elem(null, "title" , e, sc,Text("Data on ze web"))));
val xmlFile2 = "<bib><book><author>Peter Buneman</author><author>Dan Suciu</author><title>Data on ze web</title></book><book><author>John Mitchell</author><title>Foundations of Programming Languages</title></book></bib>";
- val isrc2 = new InputSource( new StringReader( xmlFile2 ) );
- val parsedxml2 = XML.load( isrc2 );
+ val isrc2 = new InputSource(new StringReader(xmlFile2))
+ val parsedxml2 = XML.load(isrc2)
// xmlFile2/book -> book,book
- Console.println("xpath \\");
+ println("xpath \\")
- assertSameElements( parsedxml1 \ "_" , List( Elem(null,"world",e,sc) ) );
+ assertSameElements(parsedxml1 \ "_" , List(Elem(null,"world", e, sc)))
- assertSameElements( parsedxml1 \ "world", List( Elem(null,"world",e,sc) ) );
+ assertSameElements(parsedxml1 \ "world", List(Elem(null,"world", e, sc)))
/*
Console.println( parsedxml2 \ "_" );
@@ -143,7 +143,7 @@ object Test extends Application with Assert {
);
- Console.println(
+ println(
(parsedxml2 \\ "book" ){ n:Node => n \ "title" == "Data on ze web" }
);
diff --git a/test/files/run/bugs.scala b/test/files/run/bugs.scala
index ae23dc6b91..9339c1867f 100644
--- a/test/files/run/bugs.scala
+++ b/test/files/run/bugs.scala
@@ -7,9 +7,9 @@
// Bug 98
object Bug98Test {
- object MyCase { def name = "mycase" };
- def test(args: Array[String]) = {
- Console.println(MyCase.name);
+ object MyCase { def name = "mycase" }
+ def test(args: Array[String]) {
+ println(MyCase.name)
}
}
@@ -17,23 +17,24 @@ object Bug98Test {
// Bug 120
class Bug120A(x: Int) {
- Console.println("A");
+ println("A")
}
trait Bug120B {
- Console.println("B");
+ println("B")
}
class Bug120C(x: Int)
extends Bug120A(Bug120Test.print("one", 1))
with Bug120B {
- Console.println("C");
+ println("C")
}
object Bug120Test {
def print[A](str: String, res: A): A = {
- Console.println(str); res
+ println(str); res
}
- def test(args: Array[String]) = {
- val c = new Bug120C(1);
+ def test(args: Array[String]) {
+ val c = new Bug120C(1)
+ ()
}
}
@@ -42,12 +43,12 @@ object Bug120Test {
object Bug135Test {
- import scala.collection.immutable.TreeMap;
+ import scala.collection.immutable.TreeMap
- def test(args: Array[String]): Unit = {
- val myMap:TreeMap[int,String] = new TreeMap;
- val map1 = myMap + 42 -> "The answer";
- Console.println(map1.get(42));
+ def test(args: Array[String]) {
+ val myMap:TreeMap[Int, String] = new TreeMap
+ val map1 = myMap + Pair(42, "The answer")
+ println(map1.get(42))
}
}
@@ -65,17 +66,17 @@ trait Bug142Bar2 { type Inner; def foo: Inner; foo; }
trait Bug142Bar3 { class Inner; def foo: Inner = {Console.println("ok"); null}; }
trait Bug142Bar4 { class Inner; def foo: Inner; foo; }
-object Bug142Test1 extends Bug142Foo1 with Bug142Bar1 {def test(args:Array[String]):Unit=();}
-object Bug142Test2 extends Bug142Foo2 with Bug142Bar2 {def test(args:Array[String]):Unit=();}
-object Bug142Test3 extends Bug142Foo3 with Bug142Bar3 {def test(args:Array[String]):Unit=();}
-object Bug142Test4 extends Bug142Foo4 with Bug142Bar4 {def test(args:Array[String]):Unit=();}
-object Bug142Test5 extends Bug142Foo1 with Bug142Bar1 {def test(args:Array[String]):Unit=();}
-object Bug142Test6 extends Bug142Foo2 with Bug142Bar2 {def test(args:Array[String]):Unit=();}
-object Bug142Test7 extends Bug142Foo3 with Bug142Bar3 {def test(args:Array[String]):Unit=();}
-object Bug142Test8 extends Bug142Foo4 with Bug142Bar4 {def test(args:Array[String]):Unit=();}
+object Bug142Test1 extends Bug142Foo1 with Bug142Bar1 { def test(args: Array[String]) {} }
+object Bug142Test2 extends Bug142Foo2 with Bug142Bar2 { def test(args: Array[String]) {} }
+object Bug142Test3 extends Bug142Foo3 with Bug142Bar3 { def test(args: Array[String]) {} }
+object Bug142Test4 extends Bug142Foo4 with Bug142Bar4 { def test(args: Array[String]) {} }
+object Bug142Test5 extends Bug142Foo1 with Bug142Bar1 { def test(args: Array[String]) {} }
+object Bug142Test6 extends Bug142Foo2 with Bug142Bar2 { def test(args: Array[String]) {} }
+object Bug142Test7 extends Bug142Foo3 with Bug142Bar3 { def test(args: Array[String]) {} }
+object Bug142Test8 extends Bug142Foo4 with Bug142Bar4 { def test(args: Array[String]) {} }
object Bug142Test {
- def test(args:Array[String]): Unit = {
+ def test(args:Array[String]) {
Bug142Test1;
Bug142Test2;
Bug142Test3;
@@ -92,10 +93,10 @@ object Bug142Test {
// Bug 166
object Bug166Test {
- import scala.collection.mutable.HashMap ;
- def test(args:Array[String]) = {
- val m:HashMap[String,String] = new HashMap[String,String];
- m.update("foo","bar");
+ import scala.collection.mutable.HashMap
+ def test(args: Array[String]) {
+ val m: HashMap[String,String] = new HashMap[String, String]
+ m.update("foo","bar")
}
}
@@ -110,8 +111,8 @@ class Bug167Node(bar:Int) {
}
object Bug167Test {
- def test(args: Array[String]): Unit = {
- if (new Bug167Node(0).foo != 1) Console.println("bug 167");
+ def test(args: Array[String]) {
+ if (new Bug167Node(0).foo != 1) println("bug 167");
}
}
@@ -119,13 +120,13 @@ object Bug167Test {
// Bug 168
class Bug168Foo {
- class Bar;
- def foo = new Bar;
+ class Bar
+ def foo = new Bar
}
object Bug168Test {
- def test(args: Array[String]): Unit = {
- (new Bug168Foo).foo;
+ def test(args: Array[String]) {
+ (new Bug168Foo).foo
()
}
}
@@ -135,25 +136,25 @@ object Bug168Test {
class Bug174Foo[X] {
- class Tree;
- class Node extends Tree;
+ class Tree
+ class Node extends Tree
- val inner:Inner = new SubInner;
+ val inner: Inner = new SubInner
trait Inner {
- def test: Bug174Foo[X]#Tree ;
+ def test: Bug174Foo[X]#Tree
}
class SubInner extends Inner {
- def test = new Node;
+ def test = new Node
}
}
object Bug174Test {
- def test(args: Array[String]): Unit = {
- (new Bug174Foo[Int]).inner.test;
+ def test(args: Array[String]) {
+ (new Bug174Foo[Int]).inner.test
()
}
}
diff --git a/test/files/run/map_test.scala b/test/files/run/map_test.scala
index 53ee416367..4358878a81 100644
--- a/test/files/run/map_test.scala
+++ b/test/files/run/map_test.scala
@@ -1,42 +1,38 @@
-import scala.collection.immutable.Map;
-import scala.collection.immutable.TreeMap;
-import scala.collection.immutable.ListMap;
+import scala.collection.immutable.{ListMap, Map, TreeMap}
object Test extends Application {
- test1();
- test2();
- Console.println("OK");
+ test1()
+ test2()
+ println("OK")
+ def test1() {
+ val myMap: TreeMap[Int, String] = new TreeMap
+ test_map(myMap)
+ }
+ def test2() {
+ val myMap: ListMap[Int, String] = new ListMap
+ test_map(myMap)
+ }
- def test1() = {
- val myMap:TreeMap[int,String] = new TreeMap;
- test_map(myMap);
+ def test_map(myMap: Map[Int, String]) {
+ val map1 = myMap.update(42,"The answer")
+ val map2 = map1.update(17,"A small random number")
+ val map3 = map2.update(666,"A bigger random number")
+ val map4 = map3.update(4711,"A big random number")
+ map1 == myMap + Pair(42, "The answer")
+ var i = 0
+ var map = map4
+ while(i < 43) {
+ map = map.update(i,i.toString())
+ i += 1
}
-
- def test2() = {
- val myMap:ListMap[int,String] = new ListMap;
- test_map(myMap);
- }
-
- def test_map(myMap:Map[int,String]) = {
- val map1 = myMap.update(42,"The answer");
- val map2 = map1.update(17,"A small random number");
- val map3 = map2.update(666,"A bigger random number");
- val map4 = map3.update(4711,"A big random number");
- map1 == myMap + 42 -> "The answer";
- var i = 0;
- var map = map4;
- while(i < 43) {
- map = map.update(i,i.toString());
- i = i + 1;
- }
- i = 0;
- while(i < 4712) {
- if(map.isDefinedAt(i))
- Console.print(i + "->" + map(i) + " ");
- i = i + 1;
- }
- Console.println("");
+ i = 0
+ while(i < 4712) {
+ if (map.isDefinedAt(i))
+ print(i + "->" + map(i) + " ");
+ i += 1
}
+ println("")
+ }
}
diff --git a/test/files/run/tcpoly_parseridioms.scala b/test/files/run/tcpoly_parseridioms.scala
index 0e2512f5bc..6d7a0be0c2 100644
--- a/test/files/run/tcpoly_parseridioms.scala
+++ b/test/files/run/tcpoly_parseridioms.scala
@@ -1,5 +1,5 @@
trait Parsers {
- type Input=List[char]
+ type Input = List[Char]
sealed class ParseResult[+t](val next: Input)
case class Success[+t](override val next: Input, result: t) extends ParseResult[t](next)
@@ -105,5 +105,5 @@ trait ParserIdioms extends Parsers with Idioms {
}
object Test extends ParserIdioms with Application {
- Console.println(expr(List.fromString("12")))
+ println(expr("12".toList))
}