Scratch: add multifile tests

This commit is contained in:
Natalia Selezneva
2018-01-19 12:50:19 +03:00
parent 23ef50203e
commit a96cf147fc
23 changed files with 288 additions and 21 deletions
+8
View File
@@ -0,0 +1,8 @@
class GClass<T> { // RESULT: class GClass<T>
fun foo(t: T): T {
return t
}
}
val g = GClass<Int>() // RESULT: val g: Generics.GClass<Int>
g.foo(1) // RESULT: 1
+8
View File
@@ -0,0 +1,8 @@
class GClass<T> {
fun foo(t: T): T {
return t
}
}
val g = GClass<Int>()
g.foo(1)
+8
View File
@@ -0,0 +1,8 @@
class GClass<T> {
fun foo(t: T): T {
return t
}
}
val g = GClass<Int>()
g.foo(1) // RESULT: 1
+14
View File
@@ -0,0 +1,14 @@
class MyClass { // RESULT: class MyClass
fun foo() = 1
}
MyClass().foo() // RESULT: 1
interface I { // RESULT: interface I
fun foo(): Int
}
val i = object: I { // RESULT: val i: Klass.I
override fun foo(): Int = 1
}
i.foo() // RESULT: 1
+14
View File
@@ -0,0 +1,14 @@
class MyClass {
fun foo() = 1
}
MyClass().foo()
interface I {
fun foo(): Int
}
val i = object: I {
override fun foo(): Int = 1
}
i.foo()
+14
View File
@@ -0,0 +1,14 @@
class MyClass {
fun foo() = 1
}
MyClass().foo() // RESULT: 1
interface I {
fun foo(): Int
}
val i = object: I {
override fun foo(): Int = 1
}
i.foo() // RESULT: 1
@@ -0,0 +1,3 @@
import inlineFun.*
foo { 1 + 3 } // RESULT: 4
@@ -0,0 +1,3 @@
import inlineFun.*
foo { 1 + 3 }
@@ -0,0 +1,3 @@
import inlineFun.*
foo { 1 + 3 } // RESULT: 4
+3
View File
@@ -0,0 +1,3 @@
package inlineFun
inline fun foo(f: () -> Int): Int = f()
@@ -0,0 +1,3 @@
import myTest.MyJavaClass
MyJavaClass().test() // RESULT: 1
+3
View File
@@ -0,0 +1,3 @@
import myTest.MyJavaClass
MyJavaClass().test()
@@ -0,0 +1,3 @@
import myTest.MyJavaClass
MyJavaClass().test() // RESULT: 1
+3
View File
@@ -0,0 +1,3 @@
var a = 1 // RESULT: var a: Int
a++ // RESULT: 1
a // RESULT: 2
+3
View File
@@ -0,0 +1,3 @@
var a = 1
a++
a
+3
View File
@@ -0,0 +1,3 @@
var a = 1
a++ // RESULT: 1
a // RESULT: 2
+19
View File
@@ -0,0 +1,19 @@
val a = 1 // RESULT: val a: Int
when(a) { // OUTPUT: 1
1 -> println("1")
else -> println("2")
}
when(a) { // OUTPUT: 1
1 -> println("1")
}
when(a) { // OUTPUT: 1
2 -> println("2")
else -> println("1")
}
when(a) { // RESULT: 11
1 -> 11
else -> 12
}
+19
View File
@@ -0,0 +1,19 @@
val a = 1
when(a) {
1 -> println("1")
else -> println("2")
}
when(a) {
1 -> println("1")
}
when(a) {
2 -> println("2")
else -> println("1")
}
when(a) {
1 -> 11
else -> 12
}
+19
View File
@@ -0,0 +1,19 @@
val a = 1
when(a) { // OUTPUT: 1
1 -> println("1")
else -> println("2")
}
when(a) { // OUTPUT: 1
1 -> println("1")
}
when(a) { // OUTPUT: 1
2 -> println("2")
else -> println("1")
}
when(a) {
1 -> 11
else -> 12
}