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

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/ExtractLocalRefactoringTest.java

Issue 11305007: Getter with parameters is error. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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/refactoring/ExtractLocalRefactoringTest.java
diff --git a/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/ExtractLocalRefactoringTest.java b/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/ExtractLocalRefactoringTest.java
index 9fc660063b4cb8ac2d20ab56826328e66c43ed96..d7095eb4467df7a116a3ed2c990738f9bf2ec9a4 100644
--- a/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/ExtractLocalRefactoringTest.java
+++ b/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/ExtractLocalRefactoringTest.java
@@ -39,6 +39,56 @@ public final class ExtractLocalRefactoringTest extends RefactoringTest {
private ExtractLocalRefactoring refactoring;
private RefactoringStatus refactoringStatus;
+ /**
+ * Asserts that {@link refactoringStatus} has fatal error caused by selection.
+ */
+ private void assert_fatalError_selection() {
+ assertTrue(refactoringStatus.hasFatalError());
+ assertEquals(
+ "An expression must be selected to activate this refactoring.",
+ refactoringStatus.getMessageMatchingSeverity(RefactoringStatus.FATAL));
+ }
+
+ private void assert_warning_alreadyDefined() {
+ assertTrue(refactoringStatus.hasWarning());
+ assertEquals(
+ "A variable with name 'res' is already defined in the visible scope.",
+ refactoringStatus.getMessageMatchingSeverity(RefactoringStatus.WARNING));
+ }
+
+ /**
+ * Creates refactoring and checks all conditions.
+ */
+ private void createRefactoring(String name) throws Exception {
+ int selectionLength = selectionEnd - selectionStart;
+ refactoring = new ExtractLocalRefactoring(testUnit, selectionStart, selectionLength);
+ refactoring.setLocalName(name);
+ refactoring.setReplaceAllOccurrences(replaceAllOccurences);
+ refactoringStatus = refactoring.checkAllConditions(pm);
+ }
+
+ private void doSuccessfullRefactoring() throws Exception {
+ // create refactoring
+ createRefactoring("res");
+ // OK status
+ if (!refactoringStatus.isOK()) {
+ fail(refactoringStatus.toString());
+ }
+ // perform change
+ performRefactoringChange();
+ }
+
+ private void performRefactoringChange() throws Exception {
+ ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
+ @Override
+ public void run(IProgressMonitor monitor) throws CoreException {
+ Change change = refactoring.createChange(pm);
+ change.initializeValidationData(pm);
+ new PerformChangeOperation(change).run(pm);
+ }
+ }, null);
+ }
+
public void test_access() throws Exception {
setTestUnitContent();
createRefactoring("res");
@@ -416,7 +466,7 @@ public final class ExtractLocalRefactoringTest extends RefactoringTest {
setTestUnitContent(
"// filler filler filler filler filler filler filler filler filler filler",
"class A {",
- " int get foo() => 42;",
+ " int get foo => 42;",
"}",
"main() {",
" A a = new A();",
@@ -428,7 +478,7 @@ public final class ExtractLocalRefactoringTest extends RefactoringTest {
assertTestUnitContent(
"// filler filler filler filler filler filler filler filler filler filler",
"class A {",
- " int get foo() => 42;",
+ " int get foo => 42;",
"}",
"main() {",
" A a = new A();",
@@ -535,54 +585,4 @@ public final class ExtractLocalRefactoringTest extends RefactoringTest {
" int a = res; // marker",
"}");
}
-
- /**
- * Asserts that {@link refactoringStatus} has fatal error caused by selection.
- */
- private void assert_fatalError_selection() {
- assertTrue(refactoringStatus.hasFatalError());
- assertEquals(
- "An expression must be selected to activate this refactoring.",
- refactoringStatus.getMessageMatchingSeverity(RefactoringStatus.FATAL));
- }
-
- private void assert_warning_alreadyDefined() {
- assertTrue(refactoringStatus.hasWarning());
- assertEquals(
- "A variable with name 'res' is already defined in the visible scope.",
- refactoringStatus.getMessageMatchingSeverity(RefactoringStatus.WARNING));
- }
-
- /**
- * Creates refactoring and checks all conditions.
- */
- private void createRefactoring(String name) throws Exception {
- int selectionLength = selectionEnd - selectionStart;
- refactoring = new ExtractLocalRefactoring(testUnit, selectionStart, selectionLength);
- refactoring.setLocalName(name);
- refactoring.setReplaceAllOccurrences(replaceAllOccurences);
- refactoringStatus = refactoring.checkAllConditions(pm);
- }
-
- private void doSuccessfullRefactoring() throws Exception {
- // create refactoring
- createRefactoring("res");
- // OK status
- if (!refactoringStatus.isOK()) {
- fail(refactoringStatus.toString());
- }
- // perform change
- performRefactoringChange();
- }
-
- private void performRefactoringChange() throws Exception {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- Change change = refactoring.createChange(pm);
- change.initializeValidationData(pm);
- new PerformChangeOperation(change).run(pm);
- }
- }, null);
- }
}

Powered by Google App Engine
This is Rietveld 408576698