-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding some tests for the quickfix, and fixing some quickfixes not wo…
…rking
- Loading branch information
Showing
5 changed files
with
119 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
...uqbar.project.wollok.tests/src/org/uqbar/project/wollok/tests/quickfix/QuickFixTest.xtend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package org.uqbar.project.wollok.tests.quickfix | ||
|
||
import org.junit.Test | ||
import org.uqbar.project.wollok.ui.Messages | ||
|
||
class QuickFixTest extends AbstractWollokQuickFixTestCase { | ||
@Test | ||
def changeDeclarationToVar(){ | ||
val initial = #[''' | ||
object myObj{ | ||
method someMethod(){ | ||
const x = 23 | ||
x = 25 | ||
} | ||
} | ||
'''] | ||
|
||
val result = #[''' | ||
object myObj{ | ||
method someMethod(){ | ||
var x = 23 | ||
x = 25 | ||
} | ||
} | ||
'''] | ||
assertQuickfix(initial, result, Messages.WollokDslQuickfixProvider_changeToVar_name) | ||
} | ||
|
||
@Test | ||
def addOverrideToMethod(){ | ||
val initial = #[''' | ||
class MyClass{ | ||
method someMethod(){ | ||
} | ||
} | ||
class MySubclass inherits MyClass { | ||
method someMethod(){ | ||
} | ||
} | ||
'''] | ||
|
||
val result = #[''' | ||
class MyClass{ | ||
method someMethod(){ | ||
} | ||
} | ||
class MySubclass inherits MyClass { | ||
override method someMethod(){ | ||
} | ||
} | ||
'''] | ||
assertQuickfix(initial, result, 'Add "override" keyword') | ||
} | ||
|
||
@Test | ||
def removeOverrideToMethod(){ | ||
val initial = #[''' | ||
class MyClass{ | ||
} | ||
class MySubclass inherits MyClass { | ||
override method someMethod(){ | ||
} | ||
} | ||
'''] | ||
|
||
val result = #[''' | ||
class MyClass{ | ||
} | ||
class MySubclass inherits MyClass { | ||
method someMethod(){ | ||
} | ||
} | ||
'''] | ||
assertQuickfix(initial, result, 'Remove override keyword') | ||
} | ||
@Test | ||
def addMethodToSuperclass(){ | ||
val initial = #[''' | ||
class MyClass{ | ||
} | ||
class MySubclass inherits MyClass { | ||
override method someMethod(){ | ||
} | ||
} | ||
'''] | ||
|
||
val result = #[''' | ||
class MyClass{ | ||
method someMethod(){ | ||
//TODO: Autogenerated Code ! | ||
} | ||
} | ||
class MySubclass inherits MyClass { | ||
override method someMethod(){ | ||
} | ||
} | ||
'''] | ||
assertQuickfix(initial, result, 'Create method in superclass') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters