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

Unified Diff: pkg/analyzer/test/generated/all_the_rest_test.dart

Issue 1623673003: Oops, move ReferenceTest to constant_test.dart as well (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | pkg/analyzer/test/generated/constant_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/all_the_rest_test.dart
diff --git a/pkg/analyzer/test/generated/all_the_rest_test.dart b/pkg/analyzer/test/generated/all_the_rest_test.dart
index d7cff4e8d96a1208b6478cbdc5382e442799e953..2d8389d277b1da7e5cde51e4ea3a767f3a6cb9fd 100644
--- a/pkg/analyzer/test/generated/all_the_rest_test.dart
+++ b/pkg/analyzer/test/generated/all_the_rest_test.dart
@@ -26,9 +26,7 @@ import 'package:analyzer/src/generated/testing/ast_factory.dart';
import 'package:analyzer/src/generated/testing/element_factory.dart';
import 'package:analyzer/src/generated/testing/test_type_provider.dart';
import 'package:analyzer/src/generated/testing/token_factory.dart';
-import 'package:analyzer/src/generated/utilities_collection.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
-import 'package:analyzer/src/task/dart.dart';
import 'package:path/path.dart';
import 'package:source_span/source_span.dart';
import 'package:unittest/unittest.dart';
@@ -57,7 +55,6 @@ main() {
runReflectiveTests(ExitDetectorTest2);
runReflectiveTests(FileBasedSourceTest);
runReflectiveTests(FileUriResolverTest);
- runReflectiveTests(ReferenceFinderTest);
runReflectiveTests(SDKLibrariesReaderTest);
runReflectiveTests(UriKindTest);
}
@@ -5941,98 +5938,6 @@ class MockDartSdk implements DartSdk {
}
@reflectiveTest
-class ReferenceFinderTest {
- DirectedGraph<ConstantEvaluationTarget> _referenceGraph;
- VariableElement _head;
- Element _tail;
-
- void setUp() {
- _referenceGraph = new DirectedGraph<ConstantEvaluationTarget>();
- _head = ElementFactory.topLevelVariableElement2("v1");
- }
-
- void test_visitSimpleIdentifier_const() {
- _visitNode(_makeTailVariable("v2", true));
- _assertOneArc(_tail);
- }
-
- void test_visitSimpleIdentifier_nonConst() {
- _visitNode(_makeTailVariable("v2", false));
- _assertOneArc(_tail);
- }
-
- void test_visitSuperConstructorInvocation_const() {
- _visitNode(_makeTailSuperConstructorInvocation("A", true));
- _assertOneArc(_tail);
- }
-
- void test_visitSuperConstructorInvocation_nonConst() {
- _visitNode(_makeTailSuperConstructorInvocation("A", false));
- _assertOneArc(_tail);
- }
-
- void test_visitSuperConstructorInvocation_unresolved() {
- SuperConstructorInvocation superConstructorInvocation =
- AstFactory.superConstructorInvocation();
- _visitNode(superConstructorInvocation);
- _assertNoArcs();
- }
-
- void _assertNoArcs() {
- Set<ConstantEvaluationTarget> tails = _referenceGraph.getTails(_head);
- expect(tails, hasLength(0));
- }
-
- void _assertOneArc(Element tail) {
- Set<ConstantEvaluationTarget> tails = _referenceGraph.getTails(_head);
- expect(tails, hasLength(1));
- expect(tails.first, same(tail));
- }
-
- ReferenceFinder _createReferenceFinder(ConstantEvaluationTarget source) =>
- new ReferenceFinder((ConstantEvaluationTarget dependency) {
- _referenceGraph.addEdge(source, dependency);
- });
- SuperConstructorInvocation _makeTailSuperConstructorInvocation(
- String name, bool isConst) {
- List<ConstructorInitializer> initializers =
- new List<ConstructorInitializer>();
- ConstructorDeclaration constructorDeclaration =
- AstFactory.constructorDeclaration(AstFactory.identifier3(name), null,
- AstFactory.formalParameterList(), initializers);
- if (isConst) {
- constructorDeclaration.constKeyword = new KeywordToken(Keyword.CONST, 0);
- }
- ClassElementImpl classElement = ElementFactory.classElement2(name);
- SuperConstructorInvocation superConstructorInvocation =
- AstFactory.superConstructorInvocation();
- ConstructorElementImpl constructorElement =
- ElementFactory.constructorElement(classElement, name, isConst);
- _tail = constructorElement;
- superConstructorInvocation.staticElement = constructorElement;
- return superConstructorInvocation;
- }
-
- SimpleIdentifier _makeTailVariable(String name, bool isConst) {
- VariableDeclaration variableDeclaration =
- AstFactory.variableDeclaration(name);
- ConstLocalVariableElementImpl variableElement =
- ElementFactory.constLocalVariableElement(name);
- _tail = variableElement;
- variableElement.const3 = isConst;
- AstFactory.variableDeclarationList2(
- isConst ? Keyword.CONST : Keyword.VAR, [variableDeclaration]);
- SimpleIdentifier identifier = AstFactory.identifier3(name);
- identifier.staticElement = variableElement;
- return identifier;
- }
-
- void _visitNode(AstNode node) {
- node.accept(_createReferenceFinder(_head));
- }
-}
-
-@reflectiveTest
class SDKLibrariesReaderTest extends EngineTestCase {
void test_readFrom_dart2js() {
LibraryMap libraryMap = new SdkLibrariesReader(true).readFromFile(
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/constant_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698