Tests for KT-2255,KT-3032
This commit is contained in:
committed by
Andrey Breslav
parent
8a7548bc84
commit
2201e63031
@@ -0,0 +1,6 @@
|
||||
class aClass(){
|
||||
var myF<caret>ield: Int = 0;
|
||||
set(value){
|
||||
$myField=value
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class aClass(){
|
||||
var renamed: Int = 0;
|
||||
set(value){
|
||||
$renamed =value
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class aClass(){
|
||||
var myField: Int = 0;
|
||||
set(value){
|
||||
$myFi<caret>eld=value
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class aClass(){
|
||||
var anotherRenamed: Int = 0;
|
||||
set(value){
|
||||
$anotherRenamed =value
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class AA {
|
||||
class B {
|
||||
fun Int.ba<caret>r() {
|
||||
val a = this@AA
|
||||
val b = this@B
|
||||
|
||||
val c = this
|
||||
val c1 = this@bar
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class AA {
|
||||
class B {
|
||||
fun Int.foo() {
|
||||
val a = this@AA
|
||||
val b = this@B
|
||||
|
||||
val c = this
|
||||
val c1 = this@foo
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class AA {
|
||||
class B {
|
||||
fun Int.bar() {
|
||||
val a = this@AA
|
||||
val b = this@B
|
||||
|
||||
val c = this
|
||||
val c1 = this@b<caret>ar
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class AA {
|
||||
class B {
|
||||
fun Int.anotherFoo() {
|
||||
val a = this@AA
|
||||
val b = this@B
|
||||
|
||||
val c = this
|
||||
val c1 = this@anotherFoo
|
||||
}
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2010-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.plugin.refactoring.rename;
|
||||
|
||||
import com.intellij.codeInsight.TargetElementUtilBase;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.refactoring.rename.RenameProcessor;
|
||||
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
|
||||
/**
|
||||
* @author Vladimir Rudev
|
||||
*/
|
||||
public class SimpleNameReferenceRenameTest extends LightCodeInsightTestCase {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PluginTestCaseBase.getTestDataPathBase() + "/refactoring/rename/simpleNameReference/";
|
||||
}
|
||||
|
||||
public void testRenameLabel() throws Exception {
|
||||
doTest("foo");
|
||||
}
|
||||
|
||||
public void testRenameLabel2() throws Exception {
|
||||
doTest("anotherFoo");
|
||||
}
|
||||
|
||||
public void testRenameField() throws Exception {
|
||||
doTest("renamed");
|
||||
}
|
||||
|
||||
public void testRenameFieldIdentifier() throws Exception {
|
||||
doTest("anotherRenamed");
|
||||
}
|
||||
|
||||
private void doTest(final String newName) throws Exception {
|
||||
configureByFile(getTestName(true) + ".kt");
|
||||
PsiElement element = TargetElementUtilBase
|
||||
.findTargetElement(myEditor,
|
||||
TargetElementUtilBase.ELEMENT_NAME_ACCEPTED | TargetElementUtilBase.REFERENCED_ELEMENT_ACCEPTED);
|
||||
assertNotNull(element);
|
||||
new RenameProcessor(getProject(), element, newName, true, true).run();
|
||||
checkResultByFile(getTestName(true) + ".kt.after");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user