summaryrefslogtreecommitdiff
path: root/test/files/run/boolexprs.scala
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2008-05-20 14:25:02 +0000
committermichelou <michelou@epfl.ch>2008-05-20 14:25:02 +0000
commit3a0b0d40d7be5fb100a1b061aab54a4d4a51ae60 (patch)
treeb8bae307ad9df5c04ff7a8d68a9be755a1a6a748 /test/files/run/boolexprs.scala
parentc1f07338ed21e551446a5c98d262d738a9b7b0ce (diff)
downloadscala-3a0b0d40d7be5fb100a1b061aab54a4d4a51ae60.tar.gz
scala-3a0b0d40d7be5fb100a1b061aab54a4d4a51ae60.tar.bz2
scala-3a0b0d40d7be5fb100a1b061aab54a4d4a51ae60.zip
int -> Int, etc..
Diffstat (limited to 'test/files/run/boolexprs.scala')
-rw-r--r--test/files/run/boolexprs.scala11
1 files changed, 5 insertions, 6 deletions
diff --git a/test/files/run/boolexprs.scala b/test/files/run/boolexprs.scala
index 7080f84b56..f92a358e26 100644
--- a/test/files/run/boolexprs.scala
+++ b/test/files/run/boolexprs.scala
@@ -5,13 +5,13 @@
class Counter {
private var n: Int = 0;
- def incrThen(b: Boolean) = if (b) n = n + 1;
+ def incrThen(b: Boolean) = if (b) n += 1;
def value = n;
}
object Test1 {
var flag = false;
- def flip: boolean = { val tmp = flag; flag = !flag; tmp }
+ def flip: Boolean = { val tmp = flag; flag = !flag; tmp }
def run: Int = {
val c = new Counter;
c.incrThen(flip || flip);
@@ -34,7 +34,7 @@ object Test2 {
// Test code
object Test {
- def check_success(name: String, closure: => Int, expected: Int): Unit = {
+ def check_success(name: String, closure: => Int, expected: Int) {
Console.print("test " + name);
try {
val actual: Int = closure;
@@ -44,14 +44,13 @@ object Test {
Console.print(" failed: expected "+ expected +", found "+ actual);
}
} catch {
- case exception: Throwable => {
+ case exception: Throwable =>
Console.print(" raised exception " + exception);
- }
}
Console.println;
}
- def main(args: Array[String]): Unit = {
+ def main(args: Array[String]) {
check_success("Test1", Test1.run, 1);
check_success("Test2", Test2.run, 0);
Console.println;