Create From Usage: Move "Create function"-related tests to separate directory

This commit is contained in:
Alexey Sedunov
2014-09-29 16:36:57 +04:00
parent 0f43d4d07c
commit a6ba3a569d
138 changed files with 526 additions and 504 deletions
@@ -0,0 +1,12 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T) {
fun foo(arg: T, s: String, function: Function1<T, T>): A<T> {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
fun test() {
val a: A<Int> = A(1).foo(2, "2") { (p: Int) -> p + 1 }
}
@@ -0,0 +1,12 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T) {
fun foo(function: Function1<T, T>): A<T> {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
fun test() {
val a: A<Int> = A(1).foo { (p: Int) -> p + 1 }
}
@@ -0,0 +1,13 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T) {
fun foo(a: Int): A<T> = throw Exception()
fun foo(arg: T, s: String): A<T> {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
fun test() {
val a: A<Int> = A(1).foo(2, "2")
}
@@ -0,0 +1,13 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T) {
fun foo(i: Int, s: String): A<T> = throw Exception()
fun foo(arg: T): A<T> {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
fun test() {
val a: A<Int> = A(1).foo(2)
}
@@ -0,0 +1,14 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T) {
class object {
fun foo(i: Int): Int {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
}
fun test() {
val a: Int = A.foo(2)
}
@@ -0,0 +1,9 @@
// "Create function 'foo' from usage" "true"
fun test() {
val a: Int = Unit.foo(2)
}
fun Unit.foo(i: Int): Int {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -0,0 +1,11 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T)
fun test() {
val a: A<Int> = 2.foo(A(1))
}
fun Int.foo(A: A<Int>): A<Int> {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -0,0 +1,11 @@
// "Create function 'foo' from usage" "true"
object A {
fun foo(i: Int): Int {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
fun test() {
val a: Int = A.foo(2)
}
@@ -0,0 +1,11 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T) {
fun foo(arg: T): A<T> {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
fun test() {
val a: A<Int> = A(1).foo(2)
}
@@ -0,0 +1,11 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T) {
fun foo(u: T): A<T> {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
fun test<U>(u: U) {
val a: A<U> = A(u).foo(u)
}
@@ -0,0 +1,11 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T) {
fun foo(abc: T, ghi: A<T>, def: String): A<T> {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
fun test() {
val a: A<Int> = A(1).foo(abc = 1, ghi = A(2), def = "s")
}
@@ -0,0 +1,12 @@
// "Create function 'foo' from usage" "true"
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>kotlin.Int</td></tr><tr><td>Found:</td><td>A&lt;kotlin.Int&gt;</td></tr></table></html>
class A<T>(val n: T) {
fun foo(s: String, arg: T): Any {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
fun test(): Int {
return A(1).foo("s", 1) as A<Int>
}
@@ -0,0 +1,11 @@
// "Create function 'foo' from usage" "true"
fun test() {
fun foo(i: Int, s: String): Int {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
fun nestedTest(): Int {
return foo(2, "2")
}
}
@@ -0,0 +1,13 @@
// "Create function 'foo' from usage" "true"
class A {
class B {
fun test(): Int {
return foo(2, "2")
}
fun foo(i: Int, s: String): Int {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
}
@@ -0,0 +1,13 @@
// "Create function 'foo' from usage" "true"
class A {
object B {
fun test(): Int {
return foo(2, "2")
}
fun foo(i: Int, s: String): Int {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
}
@@ -0,0 +1,11 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T) {
fun test(): A<Int> {
return this.foo(2, "2")
}
fun foo(i: Int, s: String): A<Int> {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -0,0 +1,11 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T) {
fun foo(i: Int, s: String): A<Int> {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
fun <U> A<U>.test(): A<Int> {
return this.foo(2, "2")
}
@@ -0,0 +1,13 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T) {
inner class B<U>(val m: U) {
fun test(): A<Int> {
return this.foo(2, "2")
}
fun foo(i: Int, s: String): A<Int> {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
}
@@ -0,0 +1,13 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T) {
inner class B<U>(val m: U) {
fun test(): A<Int> {
return this@A.foo(2, "2")
}
}
fun foo(i: Int, s: String): A<Int> {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -0,0 +1,9 @@
// "Create function 'foo' from usage" "true"
fun test(): Int {
return foo(2, "2")
}
fun foo(i: Int, s: String): Int {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -0,0 +1,12 @@
// "Create function 'foo' from usage" "true"
// ERROR: Unresolved reference: s
class A<T>(val n: T) {
fun foo(s: Any, arg: T): T {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
fun test(): Int {
return A(1).foo(s, 1)
}
@@ -0,0 +1,9 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T) {
}
fun test() {
val a: A<Int> = A(1).<caret>foo(2, "2") { (p: Int) -> p + 1 }
}
@@ -0,0 +1,9 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T) {
}
fun test() {
val a: A<Int> = A(1).<caret>foo { (p: Int) -> p + 1 }
}
@@ -0,0 +1,9 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T) {
fun foo(a: Int): A<T> = throw Exception()
}
fun test() {
val a: A<Int> = A(1).foo(2, <caret>"2")
}
@@ -0,0 +1,9 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T) {
fun foo(i: Int, s: String): A<T> = throw Exception()
}
fun test() {
val a: A<Int> = A(1).foo(2<caret>)
}
@@ -0,0 +1,11 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T) {
class object {
}
}
fun test() {
val a: Int = A.<caret>foo(2)
}
@@ -0,0 +1,5 @@
// "Create function 'foo' from usage" "true"
fun test() {
val a: Int = Unit.<caret>foo(2)
}
@@ -0,0 +1,7 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T)
fun test() {
val a: A<Int> = 2.<caret>foo(A(1))
}
@@ -0,0 +1,7 @@
// "Create function 'foo' from usage" "true"
object A
fun test() {
val a: Int = A.<caret>foo(2)
}
@@ -0,0 +1,7 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T)
fun test() {
val a: A<Int> = A(1).<caret>foo(2)
}
@@ -0,0 +1,7 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T)
fun test<U>(u: U) {
val a: A<U> = A(u).<caret>foo(u)
}
@@ -0,0 +1,7 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T)
fun test() {
val a: A<Int> = A(1).<caret>foo(abc = 1, ghi = A(2), def = "s")
}
@@ -0,0 +1,8 @@
// "Create function 'foo' from usage" "true"
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>kotlin.Int</td></tr><tr><td>Found:</td><td>A&lt;kotlin.Int&gt;</td></tr></table></html>
class A<T>(val n: T)
fun test(): Int {
return A(1).<caret>foo("s", 1) as A<Int>
}
@@ -0,0 +1,7 @@
// "Create function 'foo' from usage" "true"
fun test() {
fun nestedTest(): Int {
return <caret>foo(2, "2")
}
}
@@ -0,0 +1,9 @@
// "Create function 'foo' from usage" "true"
class A {
class B {
fun test(): Int {
return <caret>foo(2, "2")
}
}
}
@@ -0,0 +1,9 @@
// "Create function 'foo' from usage" "true"
class A {
object B {
fun test(): Int {
return <caret>foo(2, "2")
}
}
}
@@ -0,0 +1,7 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T) {
fun test(): A<Int> {
return this.<caret>foo(2, "2")
}
}
@@ -0,0 +1,7 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T)
fun <U> A<U>.test(): A<Int> {
return this.<caret>foo(2, "2")
}
@@ -0,0 +1,9 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T) {
inner class B<U>(val m: U) {
fun test(): A<Int> {
return this.<caret>foo(2, "2")
}
}
}
@@ -0,0 +1,9 @@
// "Create function 'foo' from usage" "true"
class A<T>(val n: T) {
inner class B<U>(val m: U) {
fun test(): A<Int> {
return this@A.<caret>foo(2, "2")
}
}
}
@@ -0,0 +1,5 @@
// "Create function 'foo' from usage" "true"
fun test(): Int {
return <caret>foo(2, "2")
}
@@ -0,0 +1,8 @@
// "Create function 'foo' from usage" "true"
// ERROR: Unresolved reference: s
class A<T>(val n: T)
fun test(): Int {
return A(1).<caret>foo(s, 1)
}