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

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

Issue 1487953002: Clean-up the registration of plugins (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years 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 library engine.all_the_rest_test; 5 library engine.all_the_rest_test;
6 6
7 import 'package:analyzer/file_system/physical_file_system.dart'; 7 import 'package:analyzer/file_system/physical_file_system.dart';
8 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; 8 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator;
9 import 'package:analyzer/src/generated/constant.dart'; 9 import 'package:analyzer/src/generated/constant.dart';
10 import 'package:analyzer/src/generated/element.dart'; 10 import 'package:analyzer/src/generated/element.dart';
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 (declaration as TopLevelVariableDeclaration).variables.variables; 870 (declaration as TopLevelVariableDeclaration).variables.variables;
871 expect(variables, hasLength(1)); 871 expect(variables, hasLength(1));
872 ConstantEvaluator evaluator = new ConstantEvaluator( 872 ConstantEvaluator evaluator = new ConstantEvaluator(
873 source, analysisContext.typeProvider, 873 source, analysisContext.typeProvider,
874 typeSystem: analysisContext.typeSystem); 874 typeSystem: analysisContext.typeSystem);
875 return evaluator.evaluate(variables[0].initializer); 875 return evaluator.evaluate(variables[0].initializer);
876 } 876 }
877 } 877 }
878 878
879 @reflectiveTest 879 @reflectiveTest
880 class ConstantFinderTest extends EngineTestCase { 880 class ConstantFinderTest {
881 AstNode _node; 881 AstNode _node;
882 TypeProvider _typeProvider; 882 TypeProvider _typeProvider;
883 AnalysisContext _context; 883 AnalysisContext _context;
884 Source _source; 884 Source _source;
885 885
886 void setUp() { 886 void setUp() {
887 super.setUp();
888 _typeProvider = new TestTypeProvider(); 887 _typeProvider = new TestTypeProvider();
889 _context = new TestAnalysisContext_ConstantFinderTest(); 888 _context = new TestAnalysisContext_ConstantFinderTest();
890 _source = new TestSource(); 889 _source = new TestSource();
891 } 890 }
892 891
893 /** 892 /**
894 * Test an annotation that consists solely of an identifier (and hence 893 * Test an annotation that consists solely of an identifier (and hence
895 * represents a reference to a compile-time constant variable). 894 * represents a reference to a compile-time constant variable).
896 */ 895 */
897 void test_visitAnnotation_constantVariable() { 896 void test_visitAnnotation_constantVariable() {
(...skipping 7744 matching lines...) Expand 10 before | Expand all | Expand 10 after
8642 expect(info, isNotNull); 8641 expect(info, isNotNull);
8643 List<String> allTags = info.allTags; 8642 List<String> allTags = info.allTags;
8644 expect(allTags, hasLength(4)); 8643 expect(allTags, hasLength(4));
8645 expect(info.getTagWithId("x"), "div"); 8644 expect(info.getTagWithId("x"), "div");
8646 List<String> tagsWithClass = info.getTagsWithClass("c"); 8645 List<String> tagsWithClass = info.getTagsWithClass("c");
8647 expect(tagsWithClass, hasLength(2)); 8646 expect(tagsWithClass, hasLength(2));
8648 } 8647 }
8649 } 8648 }
8650 8649
8651 @reflectiveTest 8650 @reflectiveTest
8652 class HtmlUnitBuilderTest extends EngineTestCase { 8651 class HtmlUnitBuilderTest {
8653 InternalAnalysisContext _context; 8652 InternalAnalysisContext _context;
8654 @override 8653
8655 void setUp() { 8654 void setUp() {
8656 _context = AnalysisContextFactory.contextWithCore(); 8655 _context = AnalysisContextFactory.contextWithCore();
8657 } 8656 }
8658 8657
8659 @override
8660 void tearDown() { 8658 void tearDown() {
8661 _context = null; 8659 _context = null;
8662 super.tearDown();
8663 } 8660 }
8664 8661
8665 void test_embedded_script() { 8662 void test_embedded_script() {
8666 HtmlElementImpl element = _build(r''' 8663 HtmlElementImpl element = _build(r'''
8667 <html> 8664 <html>
8668 <script type="application/dart">foo=2;</script> 8665 <script type="application/dart">foo=2;</script>
8669 </html>'''); 8666 </html>''');
8670 _validate(element, [ 8667 _validate(element, [
8671 _s(_l([_v("foo")])) 8668 _s(_l([_v("foo")]))
8672 ]); 8669 ]);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
8787 void validate(int scriptIndex, TopLevelVariableElement variable) { 8784 void validate(int scriptIndex, TopLevelVariableElement variable) {
8788 expect(variable, isNotNull, reason: "script $scriptIndex"); 8785 expect(variable, isNotNull, reason: "script $scriptIndex");
8789 expect(variable.name, _expectedName, reason: "script $scriptIndex"); 8786 expect(variable.name, _expectedName, reason: "script $scriptIndex");
8790 } 8787 }
8791 } 8788 }
8792 8789
8793 /** 8790 /**
8794 * Instances of the class `HtmlWarningCodeTest` test the generation of HTML warn ing codes. 8791 * Instances of the class `HtmlWarningCodeTest` test the generation of HTML warn ing codes.
8795 */ 8792 */
8796 @reflectiveTest 8793 @reflectiveTest
8797 class HtmlWarningCodeTest extends EngineTestCase { 8794 class HtmlWarningCodeTest {
8798 /** 8795 /**
8799 * The analysis context used to resolve the HTML files. 8796 * The analysis context used to resolve the HTML files.
8800 */ 8797 */
8801 InternalAnalysisContext _context; 8798 InternalAnalysisContext _context;
8802 8799
8803 /** 8800 /**
8804 * The contents of the 'test.html' file. 8801 * The contents of the 'test.html' file.
8805 */ 8802 */
8806 String _contents; 8803 String _contents;
8807 8804
8808 /** 8805 /**
8809 * The list of reported errors. 8806 * The list of reported errors.
8810 */ 8807 */
8811 List<AnalysisError> _errors; 8808 List<AnalysisError> _errors;
8812 @override 8809
8813 void setUp() { 8810 void setUp() {
8814 _context = AnalysisContextFactory.contextWithCore(); 8811 _context = AnalysisContextFactory.contextWithCore();
8815 } 8812 }
8816 8813
8817 @override
8818 void tearDown() { 8814 void tearDown() {
8819 _context = null; 8815 _context = null;
8820 _contents = null; 8816 _contents = null;
8821 _errors = null; 8817 _errors = null;
8822 super.tearDown();
8823 } 8818 }
8824 8819
8825 void test_invalidUri() { 8820 void test_invalidUri() {
8826 _verify( 8821 _verify(
8827 r''' 8822 r'''
8828 <html> 8823 <html>
8829 <script type='application/dart' src='ht:'/> 8824 <script type='application/dart' src='ht:'/>
8830 </html>''', 8825 </html>''',
8831 [HtmlWarningCode.INVALID_URI]); 8826 [HtmlWarningCode.INVALID_URI]);
8832 _assertErrorLocation2(_errors[0], "ht:"); 8827 _assertErrorLocation2(_errors[0], "ht:");
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
8889 Source fromFileUri(Uri uri) => null; 8884 Source fromFileUri(Uri uri) => null;
8890 8885
8891 @override 8886 @override
8892 SdkLibrary getSdkLibrary(String dartUri) => null; 8887 SdkLibrary getSdkLibrary(String dartUri) => null;
8893 8888
8894 @override 8889 @override
8895 Source mapDartUri(String dartUri) => null; 8890 Source mapDartUri(String dartUri) => null;
8896 } 8891 }
8897 8892
8898 @reflectiveTest 8893 @reflectiveTest
8899 class ReferenceFinderTest extends EngineTestCase { 8894 class ReferenceFinderTest {
8900 DirectedGraph<ConstantEvaluationTarget> _referenceGraph; 8895 DirectedGraph<ConstantEvaluationTarget> _referenceGraph;
8901 VariableElement _head; 8896 VariableElement _head;
8902 Element _tail; 8897 Element _tail;
8903 @override 8898
8904 void setUp() { 8899 void setUp() {
8905 _referenceGraph = new DirectedGraph<ConstantEvaluationTarget>(); 8900 _referenceGraph = new DirectedGraph<ConstantEvaluationTarget>();
8906 _head = ElementFactory.topLevelVariableElement2("v1"); 8901 _head = ElementFactory.topLevelVariableElement2("v1");
8907 } 8902 }
8908 8903
8909 void test_visitSimpleIdentifier_const() { 8904 void test_visitSimpleIdentifier_const() {
8910 _visitNode(_makeTailVariable("v2", true)); 8905 _visitNode(_makeTailVariable("v2", true));
8911 _assertOneArc(_tail); 8906 _assertOneArc(_tail);
8912 } 8907 }
8913 8908
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
9425 if (_expectedExternalScriptName == null) { 9420 if (_expectedExternalScriptName == null) {
9426 expect(scriptSource, isNull, reason: "script $scriptIndex"); 9421 expect(scriptSource, isNull, reason: "script $scriptIndex");
9427 } else { 9422 } else {
9428 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); 9423 expect(scriptSource, isNotNull, reason: "script $scriptIndex");
9429 String actualExternalScriptName = scriptSource.shortName; 9424 String actualExternalScriptName = scriptSource.shortName;
9430 expect(actualExternalScriptName, _expectedExternalScriptName, 9425 expect(actualExternalScriptName, _expectedExternalScriptName,
9431 reason: "script $scriptIndex"); 9426 reason: "script $scriptIndex");
9432 } 9427 }
9433 } 9428 }
9434 } 9429 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | pkg/analyzer/test/generated/element_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698