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

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/cleanup/AbstractCleanUpTest.java

Issue 10913112: Clean ups for trailing whitespace and block style (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/cleanup/AbstractCleanUpTest.java
diff --git a/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/cleanup/AbstractCleanUpTest.java b/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/cleanup/AbstractCleanUpTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..9eb49cade63499db54493f2073d0ebc836463b9c
--- /dev/null
+++ b/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/cleanup/AbstractCleanUpTest.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2012, the Dart project authors.
+ *
+ * Licensed under the Eclipse Public License v1.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.eclipse.org/legal/epl-v10.html
+ *
+ * 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 com.google.dart.tools.ui.cleanup;
+
+import com.google.dart.compiler.ast.DartUnit;
+import com.google.dart.tools.core.refactoring.CompilationUnitChange;
+import com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities;
+import com.google.dart.tools.ui.internal.cleanup.migration.AbstractMigrateCleanUp;
+import com.google.dart.tools.ui.refactoring.AbstractDartTest;
+
+/**
+ * Test for {@link AbstractMigrateCleanUp}.
+ */
+public abstract class AbstractCleanUpTest extends AbstractDartTest {
+
+ protected final void assertCleanUp(ICleanUp cleanUp, String initial, String expected)
+ throws Exception {
+ ICleanUpFix fix = prepareFix(cleanUp, initial);
+ assertNotNull(fix);
+ // assert result
+ CompilationUnitChange unitChange = fix.createChange(null);
+ String result = unitChange.getPreviewContent(null);
+ assertEquals(expected, result);
+ }
+
+ protected final void assertNoFix(ICleanUp cleanUp, String initial) throws Exception {
+ ICleanUpFix fix = prepareFix(cleanUp, initial);
+ assertNull(fix);
+ }
+
+ private ICleanUpFix prepareFix(ICleanUp cleanUp, String initial) throws Exception {
+ setTestUnitContent(initial);
+ // prepare CleanUpContext
+ CleanUpContext context;
+ {
+ DartUnit ast = DartCompilerUtilities.resolveUnit(testUnit);
+ context = new CleanUpContext(testUnit, ast);
+ }
+ // check requirements
+ {
+ CleanUpRequirements requirements = cleanUp.getRequirements();
+ assertTrue(requirements.requiresAST());
+ }
+ // prepare ICleanUpFix
+ ICleanUpFix fix = cleanUp.createFix(context);
+ return fix;
+ }
+
+}

Powered by Google App Engine
This is Rietveld 408576698