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

Unified Diff: pkg/analysis_testing/lib/abstract_single_unit.dart

Issue 533243002: Merge analysis_testing package into analysis_server. (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
« no previous file with comments | « pkg/analysis_testing/lib/abstract_context.dart ('k') | pkg/analysis_testing/lib/mock_sdk.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_testing/lib/abstract_single_unit.dart
diff --git a/pkg/analysis_testing/lib/abstract_single_unit.dart b/pkg/analysis_testing/lib/abstract_single_unit.dart
deleted file mode 100644
index 15e70d6a1fe17542228fd8ea202e7eb8916a5170..0000000000000000000000000000000000000000
--- a/pkg/analysis_testing/lib/abstract_single_unit.dart
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library test.services.src.index.abstract_single_file;
-
-import 'package:analysis_testing/abstract_context.dart';
-import 'package:analyzer/src/generated/ast.dart';
-import 'package:analyzer/src/generated/element.dart';
-import 'package:analyzer/src/generated/error.dart';
-import 'package:analyzer/src/generated/java_engine.dart';
-import 'package:analyzer/src/generated/source.dart';
-import 'package:unittest/unittest.dart';
-
-
-class AbstractSingleUnitTest extends AbstractContextTest {
- bool verifyNoTestUnitErrors = true;
-
- String testCode;
- String testFile = '/test.dart';
- Source testSource;
- CompilationUnit testUnit;
- CompilationUnitElement testUnitElement;
- LibraryElement testLibraryElement;
-
- void assertNoErrorsInSource(Source source) {
- List<AnalysisError> errors = context.getErrors(source).errors;
- expect(errors, isEmpty);
- }
-
- Element findElement(String name, [ElementKind kind]) {
- return findChildElement(testUnitElement, name, kind);
- }
-
- /**
- * Returns the [SimpleIdentifier] at the given search pattern.
- */
- SimpleIdentifier findIdentifier(String search) {
- return findNodeAtString(search, (node) => node is SimpleIdentifier);
- }
-
- AstNode findNodeAtOffset(int offset, [Predicate<AstNode> predicate]) {
- AstNode result = new NodeLocator.con1(offset).searchWithin(testUnit);
- if (result != null && predicate != null) {
- result = result.getAncestor(predicate);
- }
- return result;
- }
-
- AstNode findNodeAtString(String search, [Predicate<AstNode> predicate]) {
- int offset = findOffset(search);
- return findNodeAtOffset(offset, predicate);
- }
-
- Element findNodeElementAtString(String search,
- [Predicate<AstNode> predicate]) {
- AstNode node = findNodeAtString(search, predicate);
- if (node == null) {
- return null;
- }
- 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");
- return offset;
- }
-
- int getLeadingIdentifierLength(String search) {
- int length = 0;
- while (length < search.length) {
- int c = search.codeUnitAt(length);
- if (c >= 'a'.codeUnitAt(0) && c <= 'z'.codeUnitAt(0)) {
- length++;
- continue;
- }
- if (c >= 'A'.codeUnitAt(0) && c <= 'Z'.codeUnitAt(0)) {
- length++;
- continue;
- }
- if (c >= '0'.codeUnitAt(0) && c <= '9'.codeUnitAt(0)) {
- length++;
- continue;
- }
- break;
- }
- return length;
- }
-
- void resolveTestUnit(String code) {
- testCode = code;
- testSource = addSource(testFile, code);
- testUnit = resolveLibraryUnit(testSource);
- if (verifyNoTestUnitErrors) {
- assertNoErrorsInSource(testSource);
- }
- testUnitElement = testUnit.element;
- testLibraryElement = testUnitElement.library;
- }
-}
« no previous file with comments | « pkg/analysis_testing/lib/abstract_context.dart ('k') | pkg/analysis_testing/lib/mock_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698