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

Unified Diff: pkg/analysis_server/test/abstract_single_unit.dart

Issue 585803002: Move file refactoring implementation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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: pkg/analysis_server/test/abstract_single_unit.dart
diff --git a/pkg/analysis_server/test/abstract_single_unit.dart b/pkg/analysis_server/test/abstract_single_unit.dart
index 4239161a65806acc19a624a50a4212424f1e83d8..458eac0818edaf95a886316de1b2c59e5d1494fe 100644
--- a/pkg/analysis_server/test/abstract_single_unit.dart
+++ b/pkg/analysis_server/test/abstract_single_unit.dart
@@ -4,7 +4,6 @@
library test.services.src.index.abstract_single_file;
-import 'abstract_context.dart';
import 'package:analyzer/src/generated/ast.dart';
import 'package:analyzer/src/generated/element.dart';
import 'package:analyzer/src/generated/error.dart';
@@ -12,6 +11,8 @@ import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:unittest/unittest.dart';
+import 'abstract_context.dart';
+
class AbstractSingleUnitTest extends AbstractContextTest {
bool verifyNoTestUnitErrors = true;
@@ -23,6 +24,11 @@ class AbstractSingleUnitTest extends AbstractContextTest {
CompilationUnitElement testUnitElement;
LibraryElement testLibraryElement;
+ void addTestSource(String code) {
+ testCode = code;
+ testSource = addSource(testFile, code);
+ }
+
void assertNoErrorsInSource(Source source) {
List<AnalysisError> errors = context.getErrors(source).errors;
expect(errors, isEmpty);
@@ -32,6 +38,10 @@ class AbstractSingleUnitTest extends AbstractContextTest {
return findChildElement(testUnitElement, name, kind);
}
+ int findEnd(String search) {
+ return findOffset(search) + search.length;
+ }
+
/**
* Returns the [SimpleIdentifier] at the given search pattern.
*/
@@ -61,10 +71,6 @@ class AbstractSingleUnitTest extends AbstractContextTest {
return ElementLocator.locate(node);
}
- int findEnd(String search) {
- return findOffset(search) + search.length;
- }
-
int findOffset(String search) {
int offset = testCode.indexOf(search);
expect(offset, isNonNegative, reason: "Not found '$search' in\n$testCode");
@@ -93,8 +99,7 @@ class AbstractSingleUnitTest extends AbstractContextTest {
}
void resolveTestUnit(String code) {
- testCode = code;
- testSource = addSource(testFile, code);
+ addTestSource(code);
testUnit = resolveLibraryUnit(testSource);
if (verifyNoTestUnitErrors) {
assertNoErrorsInSource(testSource);

Powered by Google App Engine
This is Rietveld 408576698