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

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

Issue 10996036: Quick fixes 'Create class' and 'Create constructor' (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 3741d8286d1ca415ab087ec28971d87acff04ea8..694a6618b694525368c450b64a717be2769f9b45 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
@@ -43,6 +43,90 @@ public final class QuickFixProcessorTest extends AbstractDartTest {
private int proposalsExpectedNumber = 1;
private int proposalsIndexToCheck = 0;
+ public void test_createClass() throws Exception {
+ setTestUnitContent(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "main() {",
+ " new Test();",
+ "}",
+ "");
+ assertQuickFix(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "main() {",
+ " new Test();",
+ "}",
+ "",
+ "class Test {",
+ "}",
+ "");
+ }
+
+ public void test_createClass_privateName() throws Exception {
+ setTestUnitContent(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "main() {",
+ " _Test t = null;",
+ "}",
+ "");
+ assertQuickFix(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "main() {",
+ " _Test t = null;",
+ "}",
+ "",
+ "class _Test {",
+ "}",
+ "");
+ }
+
+ public void test_createConstructor_default() throws Exception {
+ setTestUnitContent(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "main() {",
+ " new Test(1, 2.0);",
+ "}",
+ "class Test {",
+ " someExistingMethod() {}",
+ "}",
+ "");
+ assertQuickFix(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "main() {",
+ " new Test(1, 2.0);",
+ "}",
+ "class Test {",
+ " Test(int i, double d) {",
+ " }",
+ "",
+ " someExistingMethod() {}",
+ "}",
+ "");
+ }
+
+ public void test_createConstructor_named() throws Exception {
+ setTestUnitContent(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "main() {",
+ " new Test.name(1, 2.0);",
+ "}",
+ "class Test {",
+ " someExistingMethod() {}",
+ "}",
+ "");
+ assertQuickFix(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "main() {",
+ " new Test.name(1, 2.0);",
+ "}",
+ "class Test {",
+ " Test.name(int i, double d) {",
+ " }",
+ "",
+ " someExistingMethod() {}",
+ "}",
+ "");
+ }
+
public void test_createFunction_hasParameters() throws Exception {
setTestUnitContent(
"// filler filler filler filler filler filler filler filler filler filler",
@@ -335,6 +419,8 @@ public final class QuickFixProcessorTest extends AbstractDartTest {
" TableElement t = null;",
"}",
"");
+ proposalsExpectedNumber = 2;
+ proposalsIndexToCheck = 0;
assertQuickFix(
"import 'dart:html';",
"// filler filler filler filler filler filler filler filler filler filler",
@@ -364,6 +450,8 @@ public final class QuickFixProcessorTest extends AbstractDartTest {
"}",
"");
// we have "fix", note that preview is for library
+ proposalsExpectedNumber = 2;
+ proposalsIndexToCheck = 0;
assertQuickFix(
"// filler filler filler filler filler filler filler filler filler filler",
"library App;",
@@ -395,7 +483,7 @@ public final class QuickFixProcessorTest extends AbstractDartTest {
"}",
"");
// do check
- proposalsExpectedNumber = 2;
+ proposalsExpectedNumber = 3;
proposalsIndexToCheck = 0;
assertQuickFix(
"// filler filler filler filler filler filler filler filler filler filler",
@@ -418,6 +506,8 @@ public final class QuickFixProcessorTest extends AbstractDartTest {
" Test t = null;",
"}",
"");
+ proposalsExpectedNumber = 2;
+ proposalsIndexToCheck = 0;
assertQuickFix(
"import 'Lib.dart';",
"// filler filler filler filler filler filler filler filler filler filler",
@@ -427,16 +517,6 @@ public final class QuickFixProcessorTest extends AbstractDartTest {
"");
}
- public void test_importLibrary_withType_privateName() throws Exception {
- setTestUnitContent(
- "// filler filler filler filler filler filler filler filler filler filler",
- "main() {",
- " _Test t = null;",
- "}",
- "");
- assertNoQuickFix();
- }
-
public void test_useStaticAccess_method() throws Exception {
setTestUnitContent(
"// filler filler filler filler filler filler filler filler filler filler",
@@ -494,6 +574,7 @@ public final class QuickFixProcessorTest extends AbstractDartTest {
/**
* Asserts that there are no quick fixes for {@link IProblemLocation} using "problem*" fields.
*/
+ @SuppressWarnings("unused")
private void assertNoQuickFix() throws CoreException {
IDartCompletionProposal[] proposals = prepareQuickFixes();
assertThat(proposals).isEmpty();

Powered by Google App Engine
This is Rietveld 408576698