Removing usages of tuples from test data

(KT-2358 Drop tuples)
 #KT-2358 In progress
This commit is contained in:
Andrey Breslav
2012-09-18 13:48:20 +04:00
parent dee5152f9b
commit 5eaa5b396b
64 changed files with 172 additions and 330 deletions
@@ -1,6 +1,6 @@
data class A(val x: Unit)
fun box(): String {
val a = A(#())
return if ("$a" == "A{x=()}") "OK" else "$a"
val a = A(Unit.VALUE)
return if ("$a" == "A{x=Unit.VALUE}") "OK" else "$a"
}
@@ -1,6 +1,6 @@
data class A(val x: Unit)
fun box(): String {
val a = A(#())
val a = A(Unit.VALUE)
return if (a.component1() is Unit) "OK" else "Fail ${a.component1()}"
}
@@ -1,3 +1,18 @@
class T4(
val c1: Boolean,
val c2: Boolean,
val c3: Boolean,
val c4: String
) {
fun equals(o: Any?): Boolean {
if (o !is T4) return false;
return c1 == o.c1 &&
c2 == o.c2 &&
c3 == o.c3 &&
c4 == o.c4
}
}
fun reformat(
str : String,
normalizeCase : Boolean = true,
@@ -5,11 +20,11 @@ fun reformat(
divideByCamelHumps : Boolean = true,
wordSeparator : String = " "
) =
#(normalizeCase, uppercaseFirstLetter, divideByCamelHumps, wordSeparator)
T4(normalizeCase, uppercaseFirstLetter, divideByCamelHumps, wordSeparator)
fun box() : String {
val expected = #(true, true, true, " ")
val expected = T4(true, true, true, " ")
if(reformat("", true, true, true, " ") != expected) return "fail"
if(reformat("", true, true, true) != expected) return "fail"
if(reformat("", true, true) != expected) return "fail"
@@ -2,17 +2,17 @@ import java.util.HashMap
fun parseCatalogs(hashMap: Any?) {
val r = toHasMap(hashMap)
if (!r._1) {
if (!r.first) {
return
}
val nodes = r._2
val nodes = r.second
}
fun toHasMap(value: Any?): #(Boolean, HashMap<String, Any?>?) {
fun toHasMap(value: Any?): Pair<Boolean, HashMap<String, Any?>?> {
if(value is HashMap<*, *>) {
return #(true, value as HashMap<String, Any?>)
return Pair(true, value as HashMap<String, Any?>)
}
return #(false, null as HashMap<String, Any?>?)
return Pair(false, null as HashMap<String, Any?>?)
}
fun box() : String {
@@ -1,5 +1,5 @@
fun box(): String {
val a = if(true) {
}
return if (a.toString() == "()") "OK" else "fail"
return if (a.toString() == "Unit.VALUE") "OK" else "fail"
}
@@ -1,9 +1,9 @@
fun main(args: Array<String>?) {
val y: Unit = #() //do not compile
val y: Unit = Unit.VALUE //do not compile
A<Unit>() //do not compile
C<Unit>(#()) //do not compile
C<Unit>(Unit.VALUE) //do not compile
//do not compile
System.out?.println(fff<Unit>(#())) //do not compile
System.out?.println(fff<Unit>(Unit.VALUE)) //do not compile
System.out?.println(id<Unit>(y)) //do not compile
System.out?.println(fff<Unit>(id<Unit>(y)) == id<Unit>(foreach(Array<Int>(0,{0}),{(e : Int) : Unit -> }))) //do not compile
}
@@ -27,7 +27,7 @@ fun t1() : Boolean {
x = x + "45" + y
x = x.substring(3)
x += "aaa"
#()
Unit.VALUE
}
foo()
@@ -43,7 +43,7 @@ fun t2() : Boolean {
x = x + 5 + y
x += 5
x++
#()
Unit.VALUE
}
foo()
x -= 55
@@ -55,7 +55,7 @@ fun t3() : Boolean {
var x = true
val foo = {
x = false
#()
Unit.VALUE
}
foo()
return !x
@@ -67,7 +67,7 @@ fun t4() : Boolean {
val foo = {
x = x + 200.toFloat() + y
x += 18
#()
Unit.VALUE
}
foo()
System.out?.println(x)
@@ -80,7 +80,7 @@ fun t5() : Boolean {
val foo = {
x = x + 200.toDouble() + y
x -= 22
#()
Unit.VALUE
}
foo()
System.out?.println(x)
@@ -94,7 +94,7 @@ fun t6() : Boolean {
x = (x + 20.toByte() + y).toByte()
x += 2
x--
#()
Unit.VALUE
}
foo()
System.out?.println(x)
@@ -105,7 +105,7 @@ fun t7() : Boolean {
var x : Char = 'a'
val foo = {
x = 'b'
#()
Unit.VALUE
}
foo()
System.out?.println(x)
@@ -117,10 +117,10 @@ fun t8() : Boolean {
val foo = {
val bar = {
x = 30.toShort()
#()
Unit.VALUE
}
bar()
#()
Unit.VALUE
}
foo()
return x == 30.toShort()
@@ -1,6 +0,0 @@
fun box() : String {
val a = #(1, "2")
if (a._1 != 1) return "Fail 1: ${a._1}"
if (a._2 != "2") return "Fail 1: ${a._2}"
return "OK"
}