rename tests
authoralexey.ivanov <alexey.ivanov@jetbrains.com>
Thu, 28 Oct 2010 17:50:00 +0000 (21:50 +0400)
committeralexey.ivanov <alexey.ivanov@jetbrains.com>
Thu, 28 Oct 2010 17:50:00 +0000 (21:50 +0400)
testData/rename/renameClass.fx [new file with mode: 0644]
testData/rename/renameClass_after.fx [new file with mode: 0644]
testData/rename/renameFunction.fx [new file with mode: 0644]
testData/rename/renameFunction_after.fx [new file with mode: 0644]
testData/rename/renameParameter.fx [new file with mode: 0644]
testData/rename/renameParameter_after.fx [new file with mode: 0644]
testData/rename/renameVariable.fx [new file with mode: 0644]
testData/rename/renameVariable_after.fx [new file with mode: 0644]
testSrc/org/jetbrains/javafx/JavaFxRenameTest.java [new file with mode: 0644]

diff --git a/testData/rename/renameClass.fx b/testData/rename/renameClass.fx
new file mode 100644 (file)
index 0000000..1d2cf6c
--- /dev/null
@@ -0,0 +1,10 @@
+class A {
+  var a: Integer;
+}
+
+
+def a = A {
+  a: 3
+}
+
+def b = new A<caret>();
\ No newline at end of file
diff --git a/testData/rename/renameClass_after.fx b/testData/rename/renameClass_after.fx
new file mode 100644 (file)
index 0000000..e7c6afd
--- /dev/null
@@ -0,0 +1,10 @@
+class NewClassName {
+  var a: Integer;
+}
+
+
+def a = NewClassName {
+  a: 3
+}
+
+def b = new NewClassName();
\ No newline at end of file
diff --git a/testData/rename/renameFunction.fx b/testData/rename/renameFunction.fx
new file mode 100644 (file)
index 0000000..ac80d23
--- /dev/null
@@ -0,0 +1,7 @@
+function foo(a: Integer): Integer {
+    return a + 7
+}
+
+def f = foo;
+
+def r = foo<caret>(f(4));
\ No newline at end of file
diff --git a/testData/rename/renameFunction_after.fx b/testData/rename/renameFunction_after.fx
new file mode 100644 (file)
index 0000000..07022a6
--- /dev/null
@@ -0,0 +1,7 @@
+function bar(a: Integer): Integer {
+    return a + 7
+}
+
+def f = bar;
+
+def r = bar(f(4));
\ No newline at end of file
diff --git a/testData/rename/renameParameter.fx b/testData/rename/renameParameter.fx
new file mode 100644 (file)
index 0000000..6ee4eb3
--- /dev/null
@@ -0,0 +1,7 @@
+function foo(a<caret>: Integer): Integer {
+  return a * 3
+}
+
+var a = 5;
+
+def b = bind foo(a);
\ No newline at end of file
diff --git a/testData/rename/renameParameter_after.fx b/testData/rename/renameParameter_after.fx
new file mode 100644 (file)
index 0000000..e468445
--- /dev/null
@@ -0,0 +1,7 @@
+function foo(param: Integer): Integer {
+  return param * 3
+}
+
+var a = 5;
+
+def b = bind foo(a);
\ No newline at end of file
diff --git a/testData/rename/renameVariable.fx b/testData/rename/renameVariable.fx
new file mode 100644 (file)
index 0000000..4a56238
--- /dev/null
@@ -0,0 +1,5 @@
+var a = 3;
+
+var b = a;
+
+var c = b + 3 * a<caret>;
\ No newline at end of file
diff --git a/testData/rename/renameVariable_after.fx b/testData/rename/renameVariable_after.fx
new file mode 100644 (file)
index 0000000..4ccd523
--- /dev/null
@@ -0,0 +1,5 @@
+var newName = 3;
+
+var b = newName;
+
+var c = b + 3 * newName;
\ No newline at end of file
diff --git a/testSrc/org/jetbrains/javafx/JavaFxRenameTest.java b/testSrc/org/jetbrains/javafx/JavaFxRenameTest.java
new file mode 100644 (file)
index 0000000..c7e9a95
--- /dev/null
@@ -0,0 +1,32 @@
+package org.jetbrains.javafx;
+
+import org.jetbrains.javafx.testUtils.JavaFxLightFixtureTestCase;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @author: Alexey.Ivanov
+ */
+public class JavaFxRenameTest extends JavaFxLightFixtureTestCase {
+  private void doTest(final String newName) {
+    myFixture.configureByFile("rename/" + getTestName(true) + ".fx");
+    myFixture.renameElementAtCaret(newName);
+    myFixture.checkResultByFile("rename/" + getTestName(true) + "_after.fx");
+  }
+
+  public void testRenameVariable() {
+    doTest("newName");
+  }
+
+  public void testRenameClass() {
+    doTest("NewClassName");
+  }
+
+  public void testRenameFunction() {
+    doTest("bar");
+  }
+
+  public void testRenameParameter() {
+    doTest("param");
+  }
+}