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

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

Issue 849863002: Replace @ReflectiveTestCase() with @reflectiveTest. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 unified diff | Download patch | Annotate | Revision Log
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.all_the_rest_test; 8 library engine.all_the_rest_test;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 buffer.write(start); 442 buffer.write(start);
443 buffer.write(", "); 443 buffer.write(", ");
444 } 444 }
445 fail(buffer.toString()); 445 fail(buffer.toString());
446 } 446 }
447 return firstToken; 447 return firstToken;
448 } 448 }
449 } 449 }
450 450
451 451
452 @ReflectiveTestCase() 452 @reflectiveTest
453 class ConstantEvaluatorTest extends ResolverTestCase { 453 class ConstantEvaluatorTest extends ResolverTestCase {
454 void fail_constructor() { 454 void fail_constructor() {
455 EvaluationResult result = _getExpressionValue("?"); 455 EvaluationResult result = _getExpressionValue("?");
456 expect(result.isValid, isTrue); 456 expect(result.isValid, isTrue);
457 DartObject value = result.value; 457 DartObject value = result.value;
458 expect(value, null); 458 expect(value, null);
459 } 459 }
460 460
461 void fail_identifier_class() { 461 void fail_identifier_class() {
462 EvaluationResult result = _getExpressionValue("?"); 462 EvaluationResult result = _getExpressionValue("?");
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 (declaration as TopLevelVariableDeclaration).variables.variables; 827 (declaration as TopLevelVariableDeclaration).variables.variables;
828 expect(variables, hasLength(1)); 828 expect(variables, hasLength(1));
829 ConstantEvaluator evaluator = new ConstantEvaluator( 829 ConstantEvaluator evaluator = new ConstantEvaluator(
830 source, 830 source,
831 (analysisContext as AnalysisContextImpl).typeProvider); 831 (analysisContext as AnalysisContextImpl).typeProvider);
832 return evaluator.evaluate(variables[0].initializer); 832 return evaluator.evaluate(variables[0].initializer);
833 } 833 }
834 } 834 }
835 835
836 836
837 @ReflectiveTestCase() 837 @reflectiveTest
838 class ConstantFinderTest extends EngineTestCase { 838 class ConstantFinderTest extends EngineTestCase {
839 AstNode _node; 839 AstNode _node;
840 840
841 /** 841 /**
842 * Test an annotation that consists solely of an identifier (and hence 842 * Test an annotation that consists solely of an identifier (and hence
843 * represents a reference to a compile-time constant variable). 843 * represents a reference to a compile-time constant variable).
844 */ 844 */
845 void test_visitAnnotation_constantVariable() { 845 void test_visitAnnotation_constantVariable() {
846 _node = AstFactory.annotation(AstFactory.identifier3('x')); 846 _node = AstFactory.annotation(AstFactory.identifier3('x'));
847 expect(_findAnnotations(), contains(_node)); 847 expect(_findAnnotations(), contains(_node));
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 identifier.staticElement = element; 963 identifier.staticElement = element;
964 AstFactory.variableDeclarationList2( 964 AstFactory.variableDeclarationList2(
965 isConst ? Keyword.CONST : null, 965 isConst ? Keyword.CONST : null,
966 [variableDeclaration]); 966 [variableDeclaration]);
967 _node = variableDeclaration; 967 _node = variableDeclaration;
968 return element; 968 return element;
969 } 969 }
970 } 970 }
971 971
972 972
973 @ReflectiveTestCase() 973 @reflectiveTest
974 class ConstantValueComputerTest extends ResolverTestCase { 974 class ConstantValueComputerTest extends ResolverTestCase {
975 void test_annotation_constConstructor() { 975 void test_annotation_constConstructor() {
976 CompilationUnit compilationUnit = resolveSource(r''' 976 CompilationUnit compilationUnit = resolveSource(r'''
977 class A { 977 class A {
978 final int i; 978 final int i;
979 const A(this.i); 979 const A(this.i);
980 } 980 }
981 981
982 class C { 982 class C {
983 @A(5) 983 @A(5)
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
2197 super.beforeGetEvaluationResult(node); 2197 super.beforeGetEvaluationResult(node);
2198 // If we are getting the evaluation result for a node in the graph, 2198 // If we are getting the evaluation result for a node in the graph,
2199 // make sure we properly recorded the dependency. 2199 // make sure we properly recorded the dependency.
2200 if (_referenceGraph.nodes.contains(node)) { 2200 if (_referenceGraph.nodes.contains(node)) {
2201 expect(_referenceGraph.containsPath(_nodeBeingEvaluated, node), isTrue); 2201 expect(_referenceGraph.containsPath(_nodeBeingEvaluated, node), isTrue);
2202 } 2202 }
2203 } 2203 }
2204 } 2204 }
2205 2205
2206 2206
2207 @ReflectiveTestCase() 2207 @reflectiveTest
2208 class ConstantVisitorTest extends ResolverTestCase { 2208 class ConstantVisitorTest extends ResolverTestCase {
2209 void test_visitConditionalExpression_false() { 2209 void test_visitConditionalExpression_false() {
2210 Expression thenExpression = AstFactory.integer(1); 2210 Expression thenExpression = AstFactory.integer(1);
2211 Expression elseExpression = AstFactory.integer(0); 2211 Expression elseExpression = AstFactory.integer(0);
2212 ConditionalExpression expression = AstFactory.conditionalExpression( 2212 ConditionalExpression expression = AstFactory.conditionalExpression(
2213 AstFactory.booleanLiteral(false), 2213 AstFactory.booleanLiteral(false),
2214 thenExpression, 2214 thenExpression,
2215 elseExpression); 2215 elseExpression);
2216 GatheringErrorListener errorListener = new GatheringErrorListener(); 2216 GatheringErrorListener errorListener = new GatheringErrorListener();
2217 ErrorReporter errorReporter = 2217 ErrorReporter errorReporter =
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2369 GatheringErrorListener errorListener = new GatheringErrorListener(); 2369 GatheringErrorListener errorListener = new GatheringErrorListener();
2370 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); 2370 ErrorReporter errorReporter = new ErrorReporter(errorListener, source);
2371 DartObjectImpl result = expression.accept( 2371 DartObjectImpl result = expression.accept(
2372 new ConstantVisitor.con2(typeProvider, lexicalEnvironment, errorReporter )); 2372 new ConstantVisitor.con2(typeProvider, lexicalEnvironment, errorReporter ));
2373 errorListener.assertNoErrors(); 2373 errorListener.assertNoErrors();
2374 return result; 2374 return result;
2375 } 2375 }
2376 } 2376 }
2377 2377
2378 2378
2379 @ReflectiveTestCase() 2379 @reflectiveTest
2380 class ContentCacheTest { 2380 class ContentCacheTest {
2381 void test_setContents() { 2381 void test_setContents() {
2382 Source source = new TestSource(); 2382 Source source = new TestSource();
2383 ContentCache cache = new ContentCache(); 2383 ContentCache cache = new ContentCache();
2384 expect(cache.getContents(source), isNull); 2384 expect(cache.getContents(source), isNull);
2385 expect(cache.getModificationStamp(source), isNull); 2385 expect(cache.getModificationStamp(source), isNull);
2386 String contents = "library lib;"; 2386 String contents = "library lib;";
2387 expect(cache.setContents(source, contents), isNull); 2387 expect(cache.setContents(source, contents), isNull);
2388 expect(cache.getContents(source), contents); 2388 expect(cache.getContents(source), contents);
2389 expect(cache.getModificationStamp(source), isNotNull); 2389 expect(cache.getModificationStamp(source), isNotNull);
2390 expect(cache.setContents(source, contents), contents); 2390 expect(cache.setContents(source, contents), contents);
2391 expect(cache.setContents(source, null), contents); 2391 expect(cache.setContents(source, null), contents);
2392 expect(cache.getContents(source), isNull); 2392 expect(cache.getContents(source), isNull);
2393 expect(cache.getModificationStamp(source), isNull); 2393 expect(cache.getModificationStamp(source), isNull);
2394 expect(cache.setContents(source, null), isNull); 2394 expect(cache.setContents(source, null), isNull);
2395 } 2395 }
2396 } 2396 }
2397 2397
2398 2398
2399 @ReflectiveTestCase() 2399 @reflectiveTest
2400 class DartObjectImplTest extends EngineTestCase { 2400 class DartObjectImplTest extends EngineTestCase {
2401 TypeProvider _typeProvider = new TestTypeProvider(); 2401 TypeProvider _typeProvider = new TestTypeProvider();
2402 2402
2403 void fail_add_knownString_knownString() { 2403 void fail_add_knownString_knownString() {
2404 fail("New constant semantics are not yet enabled"); 2404 fail("New constant semantics are not yet enabled");
2405 _assertAdd(_stringValue("ab"), _stringValue("a"), _stringValue("b")); 2405 _assertAdd(_stringValue("ab"), _stringValue("a"), _stringValue("b"));
2406 } 2406 }
2407 2407
2408 void fail_add_knownString_unknownString() { 2408 void fail_add_knownString_unknownString() {
2409 fail("New constant semantics are not yet enabled"); 2409 fail("New constant semantics are not yet enabled");
(...skipping 2228 matching lines...) Expand 10 before | Expand all | Expand 10 after
4638 new StringState(value)); 4638 new StringState(value));
4639 } 4639 }
4640 } 4640 }
4641 4641
4642 DartObjectImpl _symbolValue(String value) { 4642 DartObjectImpl _symbolValue(String value) {
4643 return new DartObjectImpl(_typeProvider.symbolType, new SymbolState(value)); 4643 return new DartObjectImpl(_typeProvider.symbolType, new SymbolState(value));
4644 } 4644 }
4645 } 4645 }
4646 4646
4647 4647
4648 @ReflectiveTestCase() 4648 @reflectiveTest
4649 class DartUriResolverTest { 4649 class DartUriResolverTest {
4650 void test_creation() { 4650 void test_creation() {
4651 JavaFile sdkDirectory = DirectoryBasedDartSdk.defaultSdkDirectory; 4651 JavaFile sdkDirectory = DirectoryBasedDartSdk.defaultSdkDirectory;
4652 expect(sdkDirectory, isNotNull); 4652 expect(sdkDirectory, isNotNull);
4653 DartSdk sdk = new DirectoryBasedDartSdk(sdkDirectory); 4653 DartSdk sdk = new DirectoryBasedDartSdk(sdkDirectory);
4654 expect(new DartUriResolver(sdk), isNotNull); 4654 expect(new DartUriResolver(sdk), isNotNull);
4655 } 4655 }
4656 4656
4657 void test_isDartUri_null_scheme() { 4657 void test_isDartUri_null_scheme() {
4658 Uri uri = parseUriWithException("foo.dart"); 4658 Uri uri = parseUriWithException("foo.dart");
(...skipping 25 matching lines...) Expand all
4684 expect(sdkDirectory, isNotNull); 4684 expect(sdkDirectory, isNotNull);
4685 DartSdk sdk = new DirectoryBasedDartSdk(sdkDirectory); 4685 DartSdk sdk = new DirectoryBasedDartSdk(sdkDirectory);
4686 UriResolver resolver = new DartUriResolver(sdk); 4686 UriResolver resolver = new DartUriResolver(sdk);
4687 Source result = 4687 Source result =
4688 resolver.resolveAbsolute(parseUriWithException("package:some/file.dart") ); 4688 resolver.resolveAbsolute(parseUriWithException("package:some/file.dart") );
4689 expect(result, isNull); 4689 expect(result, isNull);
4690 } 4690 }
4691 } 4691 }
4692 4692
4693 4693
4694 @ReflectiveTestCase() 4694 @reflectiveTest
4695 class DeclaredVariablesTest extends EngineTestCase { 4695 class DeclaredVariablesTest extends EngineTestCase {
4696 void test_getBool_false() { 4696 void test_getBool_false() {
4697 TestTypeProvider typeProvider = new TestTypeProvider(); 4697 TestTypeProvider typeProvider = new TestTypeProvider();
4698 String variableName = "var"; 4698 String variableName = "var";
4699 DeclaredVariables variables = new DeclaredVariables(); 4699 DeclaredVariables variables = new DeclaredVariables();
4700 variables.define(variableName, "false"); 4700 variables.define(variableName, "false");
4701 DartObject object = variables.getBool(typeProvider, variableName); 4701 DartObject object = variables.getBool(typeProvider, variableName);
4702 expect(object, isNotNull); 4702 expect(object, isNotNull);
4703 expect(object.boolValue, false); 4703 expect(object.boolValue, false);
4704 } 4704 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
4786 } 4786 }
4787 4787
4788 void _assertUnknownDartObject(ParameterizedType expectedType, 4788 void _assertUnknownDartObject(ParameterizedType expectedType,
4789 DartObject result) { 4789 DartObject result) {
4790 expect((result as DartObjectImpl).isUnknown, isTrue); 4790 expect((result as DartObjectImpl).isUnknown, isTrue);
4791 expect(result.type, expectedType); 4791 expect(result.type, expectedType);
4792 } 4792 }
4793 } 4793 }
4794 4794
4795 4795
4796 @ReflectiveTestCase() 4796 @reflectiveTest
4797 class DirectoryBasedDartSdkTest { 4797 class DirectoryBasedDartSdkTest {
4798 void fail_getDocFileFor() { 4798 void fail_getDocFileFor() {
4799 DirectoryBasedDartSdk sdk = _createDartSdk(); 4799 DirectoryBasedDartSdk sdk = _createDartSdk();
4800 JavaFile docFile = sdk.getDocFileFor("html"); 4800 JavaFile docFile = sdk.getDocFileFor("html");
4801 expect(docFile, isNotNull); 4801 expect(docFile, isNotNull);
4802 } 4802 }
4803 4803
4804 void test_creation() { 4804 void test_creation() {
4805 DirectoryBasedDartSdk sdk = _createDartSdk(); 4805 DirectoryBasedDartSdk sdk = _createDartSdk();
4806 expect(sdk, isNotNull); 4806 expect(sdk, isNotNull);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
4899 expect( 4899 expect(
4900 sdkDirectory, 4900 sdkDirectory,
4901 isNotNull, 4901 isNotNull,
4902 reason: 4902 reason:
4903 "No SDK configured; set the property 'com.google.dart.sdk' on the co mmand line"); 4903 "No SDK configured; set the property 'com.google.dart.sdk' on the co mmand line");
4904 return new DirectoryBasedDartSdk(sdkDirectory); 4904 return new DirectoryBasedDartSdk(sdkDirectory);
4905 } 4905 }
4906 } 4906 }
4907 4907
4908 4908
4909 @ReflectiveTestCase() 4909 @reflectiveTest
4910 class DirectoryBasedSourceContainerTest { 4910 class DirectoryBasedSourceContainerTest {
4911 void test_contains() { 4911 void test_contains() {
4912 JavaFile dir = FileUtilities2.createFile("/does/not/exist"); 4912 JavaFile dir = FileUtilities2.createFile("/does/not/exist");
4913 JavaFile file1 = FileUtilities2.createFile("/does/not/exist/some.dart"); 4913 JavaFile file1 = FileUtilities2.createFile("/does/not/exist/some.dart");
4914 JavaFile file2 = 4914 JavaFile file2 =
4915 FileUtilities2.createFile("/does/not/exist/folder/some2.dart"); 4915 FileUtilities2.createFile("/does/not/exist/folder/some2.dart");
4916 JavaFile file3 = FileUtilities2.createFile("/does/not/exist3/some3.dart"); 4916 JavaFile file3 = FileUtilities2.createFile("/does/not/exist3/some3.dart");
4917 FileBasedSource source1 = new FileBasedSource.con1(file1); 4917 FileBasedSource source1 = new FileBasedSource.con1(file1);
4918 FileBasedSource source2 = new FileBasedSource.con1(file2); 4918 FileBasedSource source2 = new FileBasedSource.con1(file2);
4919 FileBasedSource source3 = new FileBasedSource.con1(file3); 4919 FileBasedSource source3 = new FileBasedSource.con1(file3);
4920 DirectoryBasedSourceContainer container = 4920 DirectoryBasedSourceContainer container =
4921 new DirectoryBasedSourceContainer.con1(dir); 4921 new DirectoryBasedSourceContainer.con1(dir);
4922 expect(container.contains(source1), isTrue); 4922 expect(container.contains(source1), isTrue);
4923 expect(container.contains(source2), isTrue); 4923 expect(container.contains(source2), isTrue);
4924 expect(container.contains(source3), isFalse); 4924 expect(container.contains(source3), isFalse);
4925 } 4925 }
4926 } 4926 }
4927 4927
4928 4928
4929 @ReflectiveTestCase() 4929 @reflectiveTest
4930 class ElementBuilderTest extends EngineTestCase { 4930 class ElementBuilderTest extends EngineTestCase {
4931 void test_visitCatchClause() { 4931 void test_visitCatchClause() {
4932 ElementHolder holder = new ElementHolder(); 4932 ElementHolder holder = new ElementHolder();
4933 ElementBuilder builder = new ElementBuilder(holder); 4933 ElementBuilder builder = new ElementBuilder(holder);
4934 String exceptionParameterName = "e"; 4934 String exceptionParameterName = "e";
4935 String stackParameterName = "s"; 4935 String stackParameterName = "s";
4936 CatchClause clause = 4936 CatchClause clause =
4937 AstFactory.catchClause2(exceptionParameterName, stackParameterName); 4937 AstFactory.catchClause2(exceptionParameterName, stackParameterName);
4938 clause.accept(builder); 4938 clause.accept(builder);
4939 List<LocalVariableElement> variables = holder.localVariables; 4939 List<LocalVariableElement> variables = holder.localVariables;
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after
6176 null, 6176 null,
6177 null, 6177 null,
6178 null, 6178 null,
6179 AstFactory.identifier3("main"), 6179 AstFactory.identifier3("main"),
6180 AstFactory.formalParameterList([formalParameter]), 6180 AstFactory.formalParameterList([formalParameter]),
6181 body); 6181 body);
6182 } 6182 }
6183 } 6183 }
6184 6184
6185 6185
6186 @ReflectiveTestCase() 6186 @reflectiveTest
6187 class ElementLocatorTest extends ResolverTestCase { 6187 class ElementLocatorTest extends ResolverTestCase {
6188 void fail_locate_ExportDirective() { 6188 void fail_locate_ExportDirective() {
6189 AstNode id = _findNodeIn("export", "export 'dart:core';"); 6189 AstNode id = _findNodeIn("export", "export 'dart:core';");
6190 Element element = ElementLocator.locate(id); 6190 Element element = ElementLocator.locate(id);
6191 EngineTestCase.assertInstanceOf( 6191 EngineTestCase.assertInstanceOf(
6192 (obj) => obj is ImportElement, 6192 (obj) => obj is ImportElement,
6193 ImportElement, 6193 ImportElement,
6194 element); 6194 element);
6195 } 6195 }
6196 6196
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
6647 CompilationUnit _resolveContents(String code) { 6647 CompilationUnit _resolveContents(String code) {
6648 Source source = addSource(code); 6648 Source source = addSource(code);
6649 LibraryElement library = resolve(source); 6649 LibraryElement library = resolve(source);
6650 assertNoErrors(source); 6650 assertNoErrors(source);
6651 verify([source]); 6651 verify([source]);
6652 return analysisContext.resolveCompilationUnit(source, library); 6652 return analysisContext.resolveCompilationUnit(source, library);
6653 } 6653 }
6654 } 6654 }
6655 6655
6656 6656
6657 @ReflectiveTestCase() 6657 @reflectiveTest
6658 class EnumMemberBuilderTest extends EngineTestCase { 6658 class EnumMemberBuilderTest extends EngineTestCase {
6659 void test_visitEnumDeclaration_multiple() { 6659 void test_visitEnumDeclaration_multiple() {
6660 String firstName = "ONE"; 6660 String firstName = "ONE";
6661 String secondName = "TWO"; 6661 String secondName = "TWO";
6662 String thirdName = "THREE"; 6662 String thirdName = "THREE";
6663 EnumDeclaration enumDeclaration = 6663 EnumDeclaration enumDeclaration =
6664 AstFactory.enumDeclaration2("E", [firstName, secondName, thirdName]); 6664 AstFactory.enumDeclaration2("E", [firstName, secondName, thirdName]);
6665 6665
6666 ClassElement enumElement = _buildElement(enumDeclaration); 6666 ClassElement enumElement = _buildElement(enumDeclaration);
6667 List<FieldElement> fields = enumElement.fields; 6667 List<FieldElement> fields = enumElement.fields;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
6730 EnumMemberBuilder memberBuilder = 6730 EnumMemberBuilder memberBuilder =
6731 new EnumMemberBuilder(new TestTypeProvider()); 6731 new EnumMemberBuilder(new TestTypeProvider());
6732 enumDeclaration.accept(memberBuilder); 6732 enumDeclaration.accept(memberBuilder);
6733 List<ClassElement> enums = holder.enums; 6733 List<ClassElement> enums = holder.enums;
6734 expect(enums, hasLength(1)); 6734 expect(enums, hasLength(1));
6735 return enums[0]; 6735 return enums[0];
6736 } 6736 }
6737 } 6737 }
6738 6738
6739 6739
6740 @ReflectiveTestCase() 6740 @reflectiveTest
6741 class ErrorReporterTest extends EngineTestCase { 6741 class ErrorReporterTest extends EngineTestCase {
6742 /** 6742 /**
6743 * Create a type with the given name in a compilation unit with the given name . 6743 * Create a type with the given name in a compilation unit with the given name .
6744 * 6744 *
6745 * @param fileName the name of the compilation unit containing the class 6745 * @param fileName the name of the compilation unit containing the class
6746 * @param typeName the name of the type to be created 6746 * @param typeName the name of the type to be created
6747 * @return the type that was created 6747 * @return the type that was created
6748 */ 6748 */
6749 InterfaceType createType(String fileName, String typeName) { 6749 InterfaceType createType(String fileName, String typeName) {
6750 CompilationUnitElementImpl unit = ElementFactory.compilationUnit(fileName); 6750 CompilationUnitElementImpl unit = ElementFactory.compilationUnit(fileName);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
6783 reporter.reportTypeErrorForNode( 6783 reporter.reportTypeErrorForNode(
6784 StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, 6784 StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE,
6785 AstFactory.identifier3("x"), 6785 AstFactory.identifier3("x"),
6786 [firstType, secondType]); 6786 [firstType, secondType]);
6787 AnalysisError error = listener.errors[0]; 6787 AnalysisError error = listener.errors[0];
6788 expect(error.message.indexOf("(") >= 0, isTrue); 6788 expect(error.message.indexOf("(") >= 0, isTrue);
6789 } 6789 }
6790 } 6790 }
6791 6791
6792 6792
6793 @ReflectiveTestCase() 6793 @reflectiveTest
6794 class ErrorSeverityTest extends EngineTestCase { 6794 class ErrorSeverityTest extends EngineTestCase {
6795 void test_max_error_error() { 6795 void test_max_error_error() {
6796 expect( 6796 expect(
6797 ErrorSeverity.ERROR.max(ErrorSeverity.ERROR), 6797 ErrorSeverity.ERROR.max(ErrorSeverity.ERROR),
6798 same(ErrorSeverity.ERROR)); 6798 same(ErrorSeverity.ERROR));
6799 } 6799 }
6800 6800
6801 void test_max_error_none() { 6801 void test_max_error_none() {
6802 expect( 6802 expect(
6803 ErrorSeverity.ERROR.max(ErrorSeverity.NONE), 6803 ErrorSeverity.ERROR.max(ErrorSeverity.NONE),
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
6841 } 6841 }
6842 6842
6843 void test_max_warning_warning() { 6843 void test_max_warning_warning() {
6844 expect( 6844 expect(
6845 ErrorSeverity.WARNING.max(ErrorSeverity.WARNING), 6845 ErrorSeverity.WARNING.max(ErrorSeverity.WARNING),
6846 same(ErrorSeverity.WARNING)); 6846 same(ErrorSeverity.WARNING));
6847 } 6847 }
6848 } 6848 }
6849 6849
6850 6850
6851 @ReflectiveTestCase() 6851 @reflectiveTest
6852 class ExitDetectorTest extends ParserTestCase { 6852 class ExitDetectorTest extends ParserTestCase {
6853 void fail_doStatement_continue_with_label() { 6853 void fail_doStatement_continue_with_label() {
6854 _assertFalse("{ x: do { continue x; } while(true); }"); 6854 _assertFalse("{ x: do { continue x; } while(true); }");
6855 } 6855 }
6856 6856
6857 void fail_whileStatement_continue_with_label() { 6857 void fail_whileStatement_continue_with_label() {
6858 _assertFalse("{ x: while (true) { continue x; } }"); 6858 _assertFalse("{ x: while (true) { continue x; } }");
6859 } 6859 }
6860 6860
6861 void fail_whileStatement_doStatement_scopeRequired() { 6861 void fail_whileStatement_doStatement_scopeRequired() {
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
7331 Statement statement = ParserTestCase.parseStatement(source); 7331 Statement statement = ParserTestCase.parseStatement(source);
7332 expect(statement.accept(detector), same(expectedResult)); 7332 expect(statement.accept(detector), same(expectedResult));
7333 } 7333 }
7334 7334
7335 void _assertTrue(String source) { 7335 void _assertTrue(String source) {
7336 _assertHasReturn(true, source); 7336 _assertHasReturn(true, source);
7337 } 7337 }
7338 } 7338 }
7339 7339
7340 7340
7341 @ReflectiveTestCase() 7341 @reflectiveTest
7342 class FileBasedSourceTest { 7342 class FileBasedSourceTest {
7343 void test_equals_false_differentFiles() { 7343 void test_equals_false_differentFiles() {
7344 JavaFile file1 = FileUtilities2.createFile("/does/not/exist1.dart"); 7344 JavaFile file1 = FileUtilities2.createFile("/does/not/exist1.dart");
7345 JavaFile file2 = FileUtilities2.createFile("/does/not/exist2.dart"); 7345 JavaFile file2 = FileUtilities2.createFile("/does/not/exist2.dart");
7346 FileBasedSource source1 = new FileBasedSource.con1(file1); 7346 FileBasedSource source1 = new FileBasedSource.con1(file1);
7347 FileBasedSource source2 = new FileBasedSource.con1(file2); 7347 FileBasedSource source2 = new FileBasedSource.con1(file2);
7348 expect(source1 == source2, isFalse); 7348 expect(source1 == source2, isFalse);
7349 } 7349 }
7350 7350
7351 void test_equals_false_null() { 7351 void test_equals_false_null() {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
7548 JavaFile file = FileUtilities2.createFile("/does/not/exist.dart"); 7548 JavaFile file = FileUtilities2.createFile("/does/not/exist.dart");
7549 FileBasedSource source = 7549 FileBasedSource source =
7550 new FileBasedSource.con2(parseUriWithException("dart:core"), file); 7550 new FileBasedSource.con2(parseUriWithException("dart:core"), file);
7551 expect(source, isNotNull); 7551 expect(source, isNotNull);
7552 expect(source.fullName, file.getAbsolutePath()); 7552 expect(source.fullName, file.getAbsolutePath());
7553 expect(source.isInSystemLibrary, isTrue); 7553 expect(source.isInSystemLibrary, isTrue);
7554 } 7554 }
7555 } 7555 }
7556 7556
7557 7557
7558 @ReflectiveTestCase() 7558 @reflectiveTest
7559 class FileUriResolverTest { 7559 class FileUriResolverTest {
7560 void test_creation() { 7560 void test_creation() {
7561 expect(new FileUriResolver(), isNotNull); 7561 expect(new FileUriResolver(), isNotNull);
7562 } 7562 }
7563 7563
7564 void test_resolve_file() { 7564 void test_resolve_file() {
7565 UriResolver resolver = new FileUriResolver(); 7565 UriResolver resolver = new FileUriResolver();
7566 Source result = 7566 Source result =
7567 resolver.resolveAbsolute(parseUriWithException("file:/does/not/exist.dar t")); 7567 resolver.resolveAbsolute(parseUriWithException("file:/does/not/exist.dar t"));
7568 expect(result, isNotNull); 7568 expect(result, isNotNull);
7569 expect( 7569 expect(
7570 result.fullName, 7570 result.fullName,
7571 FileUtilities2.createFile("/does/not/exist.dart").getAbsolutePath()); 7571 FileUtilities2.createFile("/does/not/exist.dart").getAbsolutePath());
7572 } 7572 }
7573 7573
7574 void test_resolve_nonFile() { 7574 void test_resolve_nonFile() {
7575 UriResolver resolver = new FileUriResolver(); 7575 UriResolver resolver = new FileUriResolver();
7576 Source result = 7576 Source result =
7577 resolver.resolveAbsolute(parseUriWithException("dart:core")); 7577 resolver.resolveAbsolute(parseUriWithException("dart:core"));
7578 expect(result, isNull); 7578 expect(result, isNull);
7579 } 7579 }
7580 } 7580 }
7581 7581
7582 7582
7583 @ReflectiveTestCase() 7583 @reflectiveTest
7584 class HtmlParserTest extends EngineTestCase { 7584 class HtmlParserTest extends EngineTestCase {
7585 /** 7585 /**
7586 * The name of the 'script' tag in an HTML file. 7586 * The name of the 'script' tag in an HTML file.
7587 */ 7587 */
7588 static String _TAG_SCRIPT = "script"; 7588 static String _TAG_SCRIPT = "script";
7589 void fail_parse_scriptWithComment() { 7589 void fail_parse_scriptWithComment() {
7590 String scriptBody = r''' 7590 String scriptBody = r'''
7591 /** 7591 /**
7592 * <editable-label bind-value="dartAsignableValue"> 7592 * <editable-label bind-value="dartAsignableValue">
7593 * </editable-label> 7593 * </editable-label>
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
7757 new XmlValidator_Tag(tag, new XmlValidator_Attributes(), null, children); 7757 new XmlValidator_Tag(tag, new XmlValidator_Attributes(), null, children);
7758 void _validate(ht.HtmlUnit htmlUnit, List<XmlValidator_Tag> expectedTags) { 7758 void _validate(ht.HtmlUnit htmlUnit, List<XmlValidator_Tag> expectedTags) {
7759 XmlValidator validator = new XmlValidator(); 7759 XmlValidator validator = new XmlValidator();
7760 validator.expectTags(expectedTags); 7760 validator.expectTags(expectedTags);
7761 htmlUnit.accept(validator); 7761 htmlUnit.accept(validator);
7762 validator.assertValid(); 7762 validator.assertValid();
7763 } 7763 }
7764 } 7764 }
7765 7765
7766 7766
7767 @ReflectiveTestCase() 7767 @reflectiveTest
7768 class HtmlTagInfoBuilderTest extends HtmlParserTest { 7768 class HtmlTagInfoBuilderTest extends HtmlParserTest {
7769 void test_builder() { 7769 void test_builder() {
7770 HtmlTagInfoBuilder builder = new HtmlTagInfoBuilder(); 7770 HtmlTagInfoBuilder builder = new HtmlTagInfoBuilder();
7771 ht.HtmlUnit unit = parse(r''' 7771 ht.HtmlUnit unit = parse(r'''
7772 <html> 7772 <html>
7773 <body> 7773 <body>
7774 <div id="x"></div> 7774 <div id="x"></div>
7775 <p class='c'></p> 7775 <p class='c'></p>
7776 <div class='c'></div> 7776 <div class='c'></div>
7777 </body> 7777 </body>
7778 </html>'''); 7778 </html>''');
7779 unit.accept(builder); 7779 unit.accept(builder);
7780 HtmlTagInfo info = builder.getTagInfo(); 7780 HtmlTagInfo info = builder.getTagInfo();
7781 expect(info, isNotNull); 7781 expect(info, isNotNull);
7782 List<String> allTags = info.allTags; 7782 List<String> allTags = info.allTags;
7783 expect(allTags, hasLength(4)); 7783 expect(allTags, hasLength(4));
7784 expect(info.getTagWithId("x"), "div"); 7784 expect(info.getTagWithId("x"), "div");
7785 List<String> tagsWithClass = info.getTagsWithClass("c"); 7785 List<String> tagsWithClass = info.getTagsWithClass("c");
7786 expect(tagsWithClass, hasLength(2)); 7786 expect(tagsWithClass, hasLength(2));
7787 } 7787 }
7788 } 7788 }
7789 7789
7790 7790
7791 @ReflectiveTestCase() 7791 @reflectiveTest
7792 class HtmlUnitBuilderTest extends EngineTestCase { 7792 class HtmlUnitBuilderTest extends EngineTestCase {
7793 AnalysisContextImpl _context; 7793 AnalysisContextImpl _context;
7794 @override 7794 @override
7795 void setUp() { 7795 void setUp() {
7796 _context = AnalysisContextFactory.contextWithCore(); 7796 _context = AnalysisContextFactory.contextWithCore();
7797 } 7797 }
7798 @override 7798 @override
7799 void tearDown() { 7799 void tearDown() {
7800 _context = null; 7800 _context = null;
7801 super.tearDown(); 7801 super.tearDown();
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
7919 void validate(int scriptIndex, TopLevelVariableElement variable) { 7919 void validate(int scriptIndex, TopLevelVariableElement variable) {
7920 expect(variable, isNotNull, reason: "script $scriptIndex"); 7920 expect(variable, isNotNull, reason: "script $scriptIndex");
7921 expect(variable.name, _expectedName, reason: "script $scriptIndex"); 7921 expect(variable.name, _expectedName, reason: "script $scriptIndex");
7922 } 7922 }
7923 } 7923 }
7924 7924
7925 7925
7926 /** 7926 /**
7927 * Instances of the class `HtmlWarningCodeTest` test the generation of HTML warn ing codes. 7927 * Instances of the class `HtmlWarningCodeTest` test the generation of HTML warn ing codes.
7928 */ 7928 */
7929 @ReflectiveTestCase() 7929 @reflectiveTest
7930 class HtmlWarningCodeTest extends EngineTestCase { 7930 class HtmlWarningCodeTest extends EngineTestCase {
7931 /** 7931 /**
7932 * The source factory used to create the sources to be resolved. 7932 * The source factory used to create the sources to be resolved.
7933 */ 7933 */
7934 SourceFactory _sourceFactory; 7934 SourceFactory _sourceFactory;
7935 7935
7936 /** 7936 /**
7937 * The analysis context used to resolve the HTML files. 7937 * The analysis context used to resolve the HTML files.
7938 */ 7938 */
7939 AnalysisContextImpl _context; 7939 AnalysisContextImpl _context;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
8030 Source fromFileUri(Uri uri) => null; 8030 Source fromFileUri(Uri uri) => null;
8031 8031
8032 @override 8032 @override
8033 SdkLibrary getSdkLibrary(String dartUri) => null; 8033 SdkLibrary getSdkLibrary(String dartUri) => null;
8034 8034
8035 @override 8035 @override
8036 Source mapDartUri(String dartUri) => null; 8036 Source mapDartUri(String dartUri) => null;
8037 } 8037 }
8038 8038
8039 8039
8040 @ReflectiveTestCase() 8040 @reflectiveTest
8041 class ReferenceFinderTest extends EngineTestCase { 8041 class ReferenceFinderTest extends EngineTestCase {
8042 DirectedGraph<AstNode> _referenceGraph; 8042 DirectedGraph<AstNode> _referenceGraph;
8043 Map<VariableElement, VariableDeclaration> _variableDeclarationMap; 8043 Map<VariableElement, VariableDeclaration> _variableDeclarationMap;
8044 Map<ConstructorElement, ConstructorDeclaration> _constructorDeclarationMap; 8044 Map<ConstructorElement, ConstructorDeclaration> _constructorDeclarationMap;
8045 VariableDeclaration _head; 8045 VariableDeclaration _head;
8046 AstNode _tail; 8046 AstNode _tail;
8047 @override 8047 @override
8048 void setUp() { 8048 void setUp() {
8049 _referenceGraph = new DirectedGraph<AstNode>(); 8049 _referenceGraph = new DirectedGraph<AstNode>();
8050 _variableDeclarationMap = 8050 _variableDeclarationMap =
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
8193 SimpleIdentifier identifier = AstFactory.identifier3(name); 8193 SimpleIdentifier identifier = AstFactory.identifier3(name);
8194 identifier.staticElement = variableElement; 8194 identifier.staticElement = variableElement;
8195 return identifier; 8195 return identifier;
8196 } 8196 }
8197 void _visitNode(AstNode node) { 8197 void _visitNode(AstNode node) {
8198 node.accept(_createReferenceFinder(_head)); 8198 node.accept(_createReferenceFinder(_head));
8199 } 8199 }
8200 } 8200 }
8201 8201
8202 8202
8203 @ReflectiveTestCase() 8203 @reflectiveTest
8204 class SDKLibrariesReaderTest extends EngineTestCase { 8204 class SDKLibrariesReaderTest extends EngineTestCase {
8205 void test_readFrom_dart2js() { 8205 void test_readFrom_dart2js() {
8206 LibraryMap libraryMap = new SdkLibrariesReader( 8206 LibraryMap libraryMap = new SdkLibrariesReader(
8207 true).readFromFile(FileUtilities2.createFile("/libs.dart"), r''' 8207 true).readFromFile(FileUtilities2.createFile("/libs.dart"), r'''
8208 final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> { 8208 final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
8209 'first' : const LibraryInfo( 8209 'first' : const LibraryInfo(
8210 'first/first.dart', 8210 'first/first.dart',
8211 category: 'First', 8211 category: 'First',
8212 documented: true, 8212 documented: true,
8213 platforms: VM_PLATFORM, 8213 platforms: VM_PLATFORM,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
8265 expect(second.path, "second/second.dart"); 8265 expect(second.path, "second/second.dart");
8266 expect(second.shortName, "dart:second"); 8266 expect(second.shortName, "dart:second");
8267 expect(second.isDart2JsLibrary, false); 8267 expect(second.isDart2JsLibrary, false);
8268 expect(second.isDocumented, false); 8268 expect(second.isDocumented, false);
8269 expect(second.isImplementation, true); 8269 expect(second.isImplementation, true);
8270 expect(second.isVmLibrary, false); 8270 expect(second.isVmLibrary, false);
8271 } 8271 }
8272 } 8272 }
8273 8273
8274 8274
8275 @ReflectiveTestCase() 8275 @reflectiveTest
8276 class SourceFactoryTest { 8276 class SourceFactoryTest {
8277 void test_creation() { 8277 void test_creation() {
8278 expect(new SourceFactory([]), isNotNull); 8278 expect(new SourceFactory([]), isNotNull);
8279 } 8279 }
8280 void test_fromEncoding_invalidUri() { 8280 void test_fromEncoding_invalidUri() {
8281 SourceFactory factory = new SourceFactory([]); 8281 SourceFactory factory = new SourceFactory([]);
8282 try { 8282 try {
8283 factory.fromEncoding("<:&%>"); 8283 factory.fromEncoding("<:&%>");
8284 fail("Expected IllegalArgumentException"); 8284 fail("Expected IllegalArgumentException");
8285 } on IllegalArgumentException catch (exception) { 8285 } on IllegalArgumentException catch (exception) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
8333 Source source2 = new FileBasedSource.con1(file2); 8333 Source source2 = new FileBasedSource.con1(file2);
8334 Uri expected1 = parseUriWithException("file:///my_file.dart"); 8334 Uri expected1 = parseUriWithException("file:///my_file.dart");
8335 SourceFactory factory = 8335 SourceFactory factory =
8336 new SourceFactory([new UriResolver_restoreUri(source1, expected1)]); 8336 new SourceFactory([new UriResolver_restoreUri(source1, expected1)]);
8337 expect(factory.restoreUri(source1), same(expected1)); 8337 expect(factory.restoreUri(source1), same(expected1));
8338 expect(factory.restoreUri(source2), same(null)); 8338 expect(factory.restoreUri(source2), same(null));
8339 } 8339 }
8340 } 8340 }
8341 8341
8342 8342
8343 @ReflectiveTestCase() 8343 @reflectiveTest
8344 class StringScannerTest extends AbstractScannerTest { 8344 class StringScannerTest extends AbstractScannerTest {
8345 @override 8345 @override
8346 ht.AbstractScanner newScanner(String input) { 8346 ht.AbstractScanner newScanner(String input) {
8347 return new ht.StringScanner(null, input); 8347 return new ht.StringScanner(null, input);
8348 } 8348 }
8349 } 8349 }
8350 8350
8351 8351
8352 /** 8352 /**
8353 * Instances of the class `ToSourceVisitorTest` 8353 * Instances of the class `ToSourceVisitorTest`
8354 */ 8354 */
8355 @ReflectiveTestCase() 8355 @reflectiveTest
8356 class ToSourceVisitorTest extends EngineTestCase { 8356 class ToSourceVisitorTest extends EngineTestCase {
8357 void fail_visitHtmlScriptTagNode_attributes_content() { 8357 void fail_visitHtmlScriptTagNode_attributes_content() {
8358 _assertSource( 8358 _assertSource(
8359 "<script type='application/dart'>f() {}</script>", 8359 "<script type='application/dart'>f() {}</script>",
8360 HtmlFactory.scriptTagWithContent( 8360 HtmlFactory.scriptTagWithContent(
8361 "f() {}", 8361 "f() {}",
8362 [HtmlFactory.attribute("type", "'application/dart'")])); 8362 [HtmlFactory.attribute("type", "'application/dart'")]));
8363 } 8363 }
8364 8364
8365 void fail_visitHtmlScriptTagNode_noAttributes_content() { 8365 void fail_visitHtmlScriptTagNode_noAttributes_content() {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
8400 * @param node the AST node being visited to produce the actual source 8400 * @param node the AST node being visited to produce the actual source
8401 */ 8401 */
8402 void _assertSource(String expectedSource, ht.XmlNode node) { 8402 void _assertSource(String expectedSource, ht.XmlNode node) {
8403 PrintStringWriter writer = new PrintStringWriter(); 8403 PrintStringWriter writer = new PrintStringWriter();
8404 node.accept(new ht.ToSourceVisitor(writer)); 8404 node.accept(new ht.ToSourceVisitor(writer));
8405 expect(writer.toString(), expectedSource); 8405 expect(writer.toString(), expectedSource);
8406 } 8406 }
8407 } 8407 }
8408 8408
8409 8409
8410 @ReflectiveTestCase() 8410 @reflectiveTest
8411 class UriKindTest { 8411 class UriKindTest {
8412 void test_fromEncoding() { 8412 void test_fromEncoding() {
8413 expect(UriKind.fromEncoding(0x64), same(UriKind.DART_URI)); 8413 expect(UriKind.fromEncoding(0x64), same(UriKind.DART_URI));
8414 expect(UriKind.fromEncoding(0x66), same(UriKind.FILE_URI)); 8414 expect(UriKind.fromEncoding(0x66), same(UriKind.FILE_URI));
8415 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI)); 8415 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI));
8416 expect(UriKind.fromEncoding(0x58), same(null)); 8416 expect(UriKind.fromEncoding(0x58), same(null));
8417 } 8417 }
8418 8418
8419 void test_getEncoding() { 8419 void test_getEncoding() {
8420 expect(UriKind.DART_URI.encoding, 0x64); 8420 expect(UriKind.DART_URI.encoding, 0x64);
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
8825 } else { 8825 } else {
8826 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); 8826 expect(scriptSource, isNotNull, reason: "script $scriptIndex");
8827 String actualExternalScriptName = scriptSource.shortName; 8827 String actualExternalScriptName = scriptSource.shortName;
8828 expect( 8828 expect(
8829 actualExternalScriptName, 8829 actualExternalScriptName,
8830 _expectedExternalScriptName, 8830 _expectedExternalScriptName,
8831 reason: "script $scriptIndex"); 8831 reason: "script $scriptIndex");
8832 } 8832 }
8833 } 8833 }
8834 } 8834 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698