Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1196)

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/correction/QuickFixProcessorTest.java

Issue 10828389: Enhance 'Create Method' Quick Fix. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/correction/QuickFixProcessorTest.java
diff --git a/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/correction/QuickFixProcessorTest.java b/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/correction/QuickFixProcessorTest.java
index 29574b5237449f850b10bdabceee88e68760b0fd..396bf419902ddd382ce9739400d33d4411d26df0 100644
--- a/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/correction/QuickFixProcessorTest.java
+++ b/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/correction/QuickFixProcessorTest.java
@@ -149,6 +149,116 @@ public final class QuickFixProcessorTest extends AbstractDartTest {
"");
}
+ public void test_createMethod_qualified() throws Exception {
+ setTestUnitContent(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " foo() {",
+ " }",
+ "}",
+ "main() {",
+ " A a = new A();",
+ " a.test();",
+ "}",
+ "");
+ problemCode = TypeErrorCode.INTERFACE_HAS_NO_METHOD_NAMED;
+ problemOffset = findOffset("test(");
+ problemLength = "foo".length();
+ assertQuickFix(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " foo() {",
+ " }",
+ "",
+ " test() {",
+ " }",
+ "}",
+ "main() {",
+ " A a = new A();",
+ " a.test();",
+ "}",
+ "");
+ }
+
+ public void test_createMethod_qualified_static() throws Exception {
+ setTestUnitContent(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " foo() {",
+ " }",
+ "}",
+ "main() {",
+ " A.test();",
+ "}",
+ "");
+ problemCode = ResolverErrorCode.CANNOT_RESOLVE_METHOD_IN_CLASS;
+ problemOffset = findOffset("test(");
+ problemLength = "foo".length();
+ assertQuickFix(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " foo() {",
+ " }",
+ "",
+ " static test() {",
+ " }",
+ "}",
+ "main() {",
+ " A.test();",
+ "}",
+ "");
+ }
+
+ public void test_createMethod_unqualified() throws Exception {
+ setTestUnitContent(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " foo() {",
+ " test();",
+ " }",
+ "}",
+ "");
+ problemCode = TypeErrorCode.INTERFACE_HAS_NO_METHOD_NAMED;
+ problemOffset = findOffset("test(");
+ problemLength = "test".length();
+ assertQuickFix(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " foo() {",
+ " test();",
+ " }",
+ "",
+ " test() {",
+ " }",
+ "}",
+ "");
+ }
+
+ public void test_createMethod_unqualified_static() throws Exception {
+ setTestUnitContent(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " static foo() {",
+ " test();",
+ " }",
+ "}",
+ "");
+ problemCode = ResolverErrorCode.CANNOT_RESOLVE_METHOD;
+ problemOffset = findOffset("test(");
+ problemLength = "test".length();
+ assertQuickFix(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " static foo() {",
+ " test();",
+ " }",
+ "",
+ " static test() {",
+ " }",
+ "}",
+ "");
+ }
+
public void test_importLibrary_withType_fromSDK() throws Exception {
setTestUnitContent(
"// filler filler filler filler filler filler filler filler filler filler",

Powered by Google App Engine
This is Rietveld 408576698