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

Side by Side Diff: pkg/analyzer/test/generated/test_support.dart

Issue 1150863007: Remove many explicit references to AnalysisContextImpl and enable testing of the new task model (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.test_support; 8 library engine.test_support;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
11 11
12 import 'package:analyzer/src/generated/ast.dart' show AstNode, NodeLocator; 12 import 'package:analyzer/src/generated/ast.dart' show AstNode, NodeLocator;
13 import 'package:analyzer/src/generated/element.dart'; 13 import 'package:analyzer/src/generated/element.dart';
14 import 'package:analyzer/src/generated/engine.dart'; 14 import 'package:analyzer/src/generated/engine.dart';
15 import 'package:analyzer/src/generated/error.dart'; 15 import 'package:analyzer/src/generated/error.dart';
16 import 'package:analyzer/src/generated/java_core.dart'; 16 import 'package:analyzer/src/generated/java_core.dart';
17 import 'package:analyzer/src/generated/java_engine.dart'; 17 import 'package:analyzer/src/generated/java_engine.dart';
18 import 'package:analyzer/src/generated/source.dart'; 18 import 'package:analyzer/src/generated/source.dart';
19 import 'package:unittest/unittest.dart'; 19 import 'package:unittest/unittest.dart';
20 20
21 import 'resolver_test.dart';
22
21 /** 23 /**
22 * The class `EngineTestCase` defines utility methods for making assertions. 24 * The class `EngineTestCase` defines utility methods for making assertions.
23 */ 25 */
24 class EngineTestCase { 26 class EngineTestCase {
25 /** 27 /**
26 * Assert that the given collection has the same number of elements as the num ber of specified 28 * Assert that the given collection has the same number of elements as the num ber of specified
27 * names, and that for each specified name, a corresponding element can be fou nd in the given 29 * names, and that for each specified name, a corresponding element can be fou nd in the given
28 * collection with that name. 30 * collection with that name.
29 * 31 *
30 * @param elements the elements 32 * @param elements the elements
(...skipping 16 matching lines...) Expand all
47 for (Element elem in elements) { 49 for (Element elem in elements) {
48 buffer.write(elem.name); 50 buffer.write(elem.name);
49 buffer.write(", "); 51 buffer.write(", ");
50 } 52 }
51 fail(buffer.toString()); 53 fail(buffer.toString());
52 } 54 }
53 } 55 }
54 expect(elements, hasLength(names.length)); 56 expect(elements, hasLength(names.length));
55 } 57 }
56 58
57 AnalysisContextImpl createAnalysisContext() { 59 AnalysisContext createAnalysisContext() {
58 AnalysisContextImpl context = new AnalysisContextImpl(); 60 return AnalysisContextFactory.contextWithCore();
59 context.sourceFactory = new SourceFactory([]);
60 return context;
61 } 61 }
62 62
63 /** 63 /**
64 * Return the getter in the given type with the given name. Inherited getters are ignored. 64 * Return the getter in the given type with the given name. Inherited getters are ignored.
65 * 65 *
66 * @param type the type in which the getter is declared 66 * @param type the type in which the getter is declared
67 * @param getterName the name of the getter to be returned 67 * @param getterName the name of the getter to be returned
68 * @return the property accessor element representing the getter with the give n name 68 * @return the property accessor element representing the getter with the give n name
69 */ 69 */
70 PropertyAccessorElement getGetter(InterfaceType type, String getterName) { 70 PropertyAccessorElement getGetter(InterfaceType type, String getterName) {
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 } 587 }
588 String get shortName { 588 String get shortName {
589 return _name; 589 return _name;
590 } 590 }
591 Uri get uri { 591 Uri get uri {
592 throw new UnsupportedOperationException(); 592 throw new UnsupportedOperationException();
593 } 593 }
594 UriKind get uriKind { 594 UriKind get uriKind {
595 throw new UnsupportedOperationException(); 595 throw new UnsupportedOperationException();
596 } 596 }
597 @override
598 String toString() => '$_name';
599 bool operator ==(Object other) { 597 bool operator ==(Object other) {
600 if (other is TestSource) { 598 if (other is TestSource) {
601 return other._name == _name; 599 return other._name == _name;
602 } 600 }
603 return false; 601 return false;
604 } 602 }
605 bool exists() => exists2; 603 bool exists() => exists2;
606 void getContentsToReceiver(Source_ContentReceiver receiver) { 604 void getContentsToReceiver(Source_ContentReceiver receiver) {
607 throw new UnsupportedOperationException(); 605 throw new UnsupportedOperationException();
608 } 606 }
609 Source resolve(String uri) { 607 Source resolve(String uri) {
610 throw new UnsupportedOperationException(); 608 throw new UnsupportedOperationException();
611 } 609 }
612 Uri resolveRelativeUri(Uri uri) { 610 Uri resolveRelativeUri(Uri uri) {
613 return new Uri(scheme: 'file', path: _name).resolveUri(uri); 611 return new Uri(scheme: 'file', path: _name).resolveUri(uri);
614 } 612 }
615 void setContents(String value) { 613 void setContents(String value) {
616 modificationStamp = new DateTime.now().millisecondsSinceEpoch; 614 modificationStamp = new DateTime.now().millisecondsSinceEpoch;
617 _contents = value; 615 _contents = value;
618 } 616 }
617 @override
618 String toString() => '$_name';
619 } 619 }
620 620
621 class TestSourceWithUri extends TestSource { 621 class TestSourceWithUri extends TestSource {
622 final Uri uri; 622 final Uri uri;
623 623
624 TestSourceWithUri(String path, this.uri, [String content]) 624 TestSourceWithUri(String path, this.uri, [String content])
625 : super(path, content); 625 : super(path, content);
626 626
627 UriKind get uriKind { 627 UriKind get uriKind {
628 if (uri == null) { 628 if (uri == null) {
(...skipping 10 matching lines...) Expand all
639 if (other is TestSource) { 639 if (other is TestSource) {
640 return other.uri == uri; 640 return other.uri == uri;
641 } 641 }
642 return false; 642 return false;
643 } 643 }
644 644
645 Uri resolveRelativeUri(Uri uri) { 645 Uri resolveRelativeUri(Uri uri) {
646 return this.uri.resolveUri(uri); 646 return this.uri.resolveUri(uri);
647 } 647 }
648 } 648 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/resolver_test.dart ('k') | pkg/analyzer/test/task/task_dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698