Added more quickfixes; added tests

This commit is contained in:
svtk
2011-09-21 17:58:44 +04:00
parent e6c871aecc
commit 7f815176f6
96 changed files with 1357 additions and 147 deletions
@@ -0,0 +1,4 @@
// "Make 'foo' not abstract" "true"
class A() {
<caret>fun foo()
}
@@ -0,0 +1,4 @@
// "Remove function body" "true"
abstract class A() {
<caret>abstract fun foo()
}
@@ -0,0 +1,4 @@
// "Make 'A' abstract" "true"
abstract class A() {
<caret>abstract var i : Int
}
@@ -0,0 +1,4 @@
// "Make 'i' not abstract" "true"
class A() {
<caret>var i : Int
}
@@ -0,0 +1,2 @@
// "Make 'i' not abstract" "true"
class A(<caret>val i: Int) {}
@@ -0,0 +1,2 @@
// "Make 'i' not abstract" "true"
<caret>val i: Int = 1
@@ -0,0 +1,4 @@
// "Remove initializer from property" "true"
abstract class A {
abstract var i : Int<caret>
}
@@ -0,0 +1,4 @@
// "Remove initializer from property" "true"
abstract class A {
abstract var i : Int<caret>
}
@@ -0,0 +1,5 @@
// "Make 'i' not abstract" "true"
class B {
<caret>val i: Int
get() = $i
}
@@ -0,0 +1,5 @@
// "Remove getter and initializer from property" "true"
abstract class B {
abstract val i : <caret>Int
}
@@ -0,0 +1,4 @@
// "Make 'i' not abstract" "true"
class A {
<caret>var i = 0
}
@@ -0,0 +1,5 @@
// "Make 'j' not abstract" "true"
class B {
<caret>var j: Int
set(v: Int) {}
}
@@ -0,0 +1,4 @@
// "Make 'i' abstract" "true"
abstract class A() {
abstract var <caret>i : Int
}
@@ -0,0 +1,4 @@
// "Add function body" "true"
class A() {
fun <caret>foo() {}
}
@@ -0,0 +1,2 @@
// "Make 'abstract get' not abstract" "true"
val i : Int = 0; <caret>get
@@ -0,0 +1,2 @@
// "Make 'foo' not abstract" "true"
<caret>fun foo()
@@ -0,0 +1,4 @@
// "Add function body" "true"
namespace a {
fun <caret>foo() {}
}
@@ -0,0 +1,4 @@
// "Make 'foo' not abstract" "true"
trait A {
<caret>fun foo()
}
@@ -0,0 +1,4 @@
// "Make 'foo' abstract" "true"
abstract class B() {
abstract fun <caret>foo()
}
@@ -0,0 +1,4 @@
// "Make 'foo' not abstract" "true"
class A() {
<caret>abstract fun foo()
}
@@ -0,0 +1,4 @@
// "Remove function body" "true"
abstract class A() {
<caret>abstract fun foo() {}
}
@@ -0,0 +1,4 @@
// "Make 'A' abstract" "true"
class A() {
<caret>abstract var i : Int
}
@@ -0,0 +1,4 @@
// "Make 'i' not abstract" "true"
class A() {
<caret>abstract var i : Int
}
@@ -0,0 +1,2 @@
// "Make 'i' not abstract" "true"
class A(<caret>abstract val i: Int) {}
@@ -0,0 +1,2 @@
// "Make 'i' not abstract" "true"
<caret>abstract val i: Int = 1
@@ -0,0 +1,4 @@
// "Remove initializer from property" "true"
abstract class A {
abstract var i = 0<caret>
}
@@ -0,0 +1,4 @@
// "Remove initializer from property" "true"
abstract class A {
abstract var i : Int = 0<caret>
}
@@ -0,0 +1,5 @@
// "Make 'i' not abstract" "true"
class B {
<caret>abstract val i: Int
get() = $i
}
@@ -0,0 +1,5 @@
// "Remove getter and initializer from property" "true"
abstract class B {
abstract val i = <caret>0
get() = $i
}
@@ -0,0 +1,4 @@
// "Make 'i' not abstract" "true"
class A {
<caret>abstract var i = 0
}
@@ -0,0 +1,5 @@
// "Make 'j' not abstract" "true"
class B {
abstract<caret> var j: Int
set(v: Int) {}
}
@@ -0,0 +1,4 @@
// "Make 'foo' abstract" "false"
class B() {
final fun <caret>foo()
}
@@ -0,0 +1,4 @@
// "Make 'i' abstract" "true"
abstract class A() {
var <caret>i : Int
}
@@ -0,0 +1,4 @@
// "Add function body" "true"
class A() {
fun <caret>foo()
}
@@ -0,0 +1,2 @@
// "Make 'abstract get' not abstract" "true"
val i : Int = 0; <caret>abstract get
@@ -0,0 +1,2 @@
// "Make 'foo' not abstract" "true"
<caret>abstract fun foo()
@@ -0,0 +1,4 @@
// "Add function body" "true"
namespace a {
fun <caret>foo()
}
@@ -0,0 +1,4 @@
// "Make 'foo' not abstract" "true"
trait A {
<caret>abstract fun foo()
}
@@ -0,0 +1,4 @@
// "Make 'foo' abstract" "true"
abstract class B() {
open fun <caret>foo()
}
@@ -0,0 +1,5 @@
// "Make variable mutable" "true"
class A() {
var a: Int = 0
<caret>set(v: Int) {}
}
@@ -0,0 +1,5 @@
// "Make variable mutable" "true"
class A() {
val a: Int = 0
<caret>set(v: Int) {}
}
@@ -0,0 +1,4 @@
// "Replace to dot call" "true"
fun foo(a: Any) {
<caret>a.equals(0)
}
@@ -0,0 +1,7 @@
// "Replace to dot call" "true"
fun foo(a: Any) {
when (a) {
.equals(0) => true
else => false
}
}
@@ -0,0 +1,4 @@
// "Replace a cast with a static assert" "true"
fun foo(a: String) {
val b = a : Any
}
@@ -0,0 +1,4 @@
// "Remove cast" "true"
fun foo(a: Any) {
val b = a<caret>
}
@@ -0,0 +1,4 @@
// "Remove elvis operator" "true"
fun foo(a: String) {
val b : String = <caret>a
}
@@ -0,0 +1,4 @@
// "Replace to dot call" "true"
fun foo(a: Any) {
a<caret>?.equals(0)
}
@@ -0,0 +1,7 @@
// "Replace to dot call" "true"
fun foo(a: Any) {
when (a) {
<caret>?.equals(0) => true
else => false
}
}
@@ -0,0 +1,4 @@
// "Replace a cast with a static assert" "true"
fun foo(a: String) {
val b = a <caret>as Any
}
@@ -0,0 +1,4 @@
// "Remove cast" "true"
fun foo(a: Any) {
val b = a <caret>as Any
}
@@ -0,0 +1,4 @@
// "Remove elvis operator" "true"
fun foo(a: String) {
val b : String = <caret>a ?: "s"
}
@@ -0,0 +1,4 @@
// "Remove 'override' modifier" "true"
class A() {
<caret>fun foo() {}
}
@@ -0,0 +1,8 @@
// "Add 'override' modifier" "true"
open class A() {
fun foo() {}
}
class B() : A() {
override fun <caret>foo() {}
}
@@ -0,0 +1,4 @@
// "Remove 'override' modifier" "true"
class A() {
<caret>override fun foo() {}
}
@@ -0,0 +1,8 @@
// "Add 'override' modifier" "true"
open class A() {
fun foo() {}
}
class B() : A() {
fun <caret>foo() {}
}
@@ -0,0 +1,5 @@
// "Change getter type to Int" "true"
class A() {
val i: Int
get(): Int = 1
}
@@ -0,0 +1,5 @@
// "Change setter parameter type to Int" "true"
class A() {
var i: Int = 0
set(v: Int) {}
}
@@ -0,0 +1,5 @@
// "Change getter type to Int" "true"
class A() {
val i: Int
get(): <caret>Any = 1
}
@@ -0,0 +1,5 @@
// "Change setter parameter type to Int" "true"
class A() {
var i: Int = 0
set(v: <caret>Any) {}
}