| OLD | NEW |
| 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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 buffer.write(start); | 445 buffer.write(start); |
| 446 buffer.write(", "); | 446 buffer.write(", "); |
| 447 } | 447 } |
| 448 fail(buffer.toString()); | 448 fail(buffer.toString()); |
| 449 } | 449 } |
| 450 return firstToken; | 450 return firstToken; |
| 451 } | 451 } |
| 452 } | 452 } |
| 453 | 453 |
| 454 | 454 |
| 455 @ReflectiveTestCase() |
| 455 class AngularCompilationUnitBuilderTest extends AngularTest { | 456 class AngularCompilationUnitBuilderTest extends AngularTest { |
| 456 void test_bad_notConstructorAnnotation() { | 457 void test_bad_notConstructorAnnotation() { |
| 457 String mainContent = r''' | 458 String mainContent = r''' |
| 458 const MY_ANNOTATION = null; | 459 const MY_ANNOTATION = null; |
| 459 @MY_ANNOTATION() | 460 @MY_ANNOTATION() |
| 460 class MyFilter { | 461 class MyFilter { |
| 461 }'''; | 462 }'''; |
| 462 resolveMainSource(mainContent); | 463 resolveMainSource(mainContent); |
| 463 // prepare AngularFilterElement | 464 // prepare AngularFilterElement |
| 464 ClassElement classElement = mainUnitElement.getType("MyFilter"); | 465 ClassElement classElement = mainUnitElement.getType("MyFilter"); |
| (...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1438 selector); | 1439 selector); |
| 1439 expect((selector as AngularTagSelectorElementImpl).name, name); | 1440 expect((selector as AngularTagSelectorElementImpl).name, name); |
| 1440 } | 1441 } |
| 1441 | 1442 |
| 1442 static String _createAngularSource(String code) { | 1443 static String _createAngularSource(String code) { |
| 1443 return "import 'angular.dart';\n" + code; | 1444 return "import 'angular.dart';\n" + code; |
| 1444 } | 1445 } |
| 1445 } | 1446 } |
| 1446 | 1447 |
| 1447 | 1448 |
| 1449 @ReflectiveTestCase() |
| 1448 class AngularHtmlUnitResolverTest extends AngularTest { | 1450 class AngularHtmlUnitResolverTest extends AngularTest { |
| 1449 void fail_analysisContext_changeDart_invalidateApplication() { | 1451 void fail_analysisContext_changeDart_invalidateApplication() { |
| 1450 addMainSource(r''' | 1452 addMainSource(r''' |
| 1451 | 1453 |
| 1452 import 'angular.dart'; | 1454 import 'angular.dart'; |
| 1453 | 1455 |
| 1454 @Component( | 1456 @Component( |
| 1455 templateUrl: 'my_template.html', cssUrl: 'my_styles.css', | 1457 templateUrl: 'my_template.html', cssUrl: 'my_styles.css', |
| 1456 publishAs: 'ctrl', | 1458 publishAs: 'ctrl', |
| 1457 selector: 'myComponent') | 1459 selector: 'myComponent') |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2345 resolveIndex2(content); | 2347 resolveIndex2(content); |
| 2346 assertNoErrors(); | 2348 assertNoErrors(); |
| 2347 verify([indexSource]); | 2349 verify([indexSource]); |
| 2348 } | 2350 } |
| 2349 } | 2351 } |
| 2350 | 2352 |
| 2351 | 2353 |
| 2352 /** | 2354 /** |
| 2353 * Tests for [HtmlUnitUtils] for Angular HTMLs. | 2355 * Tests for [HtmlUnitUtils] for Angular HTMLs. |
| 2354 */ | 2356 */ |
| 2357 @ReflectiveTestCase() |
| 2355 class AngularHtmlUnitUtilsTest extends AngularTest { | 2358 class AngularHtmlUnitUtilsTest extends AngularTest { |
| 2356 void test_getElement_forExpression() { | 2359 void test_getElement_forExpression() { |
| 2357 addMyController(); | 2360 addMyController(); |
| 2358 _resolveSimpleCtrlFieldHtml(); | 2361 _resolveSimpleCtrlFieldHtml(); |
| 2359 // prepare expression | 2362 // prepare expression |
| 2360 int offset = indexContent.indexOf("ctrl"); | 2363 int offset = indexContent.indexOf("ctrl"); |
| 2361 Expression expression = ht.HtmlUnitUtils.getExpression(indexUnit, offset); | 2364 Expression expression = ht.HtmlUnitUtils.getExpression(indexUnit, offset); |
| 2362 // get element | 2365 // get element |
| 2363 Element element = ht.HtmlUnitUtils.getElement(expression); | 2366 Element element = ht.HtmlUnitUtils.getElement(expression); |
| 2364 EngineTestCase.assertInstanceOf( | 2367 EngineTestCase.assertInstanceOf( |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2985 * not found. | 2988 * not found. |
| 2986 */ | 2989 */ |
| 2987 static int findOffset(String content, String search) { | 2990 static int findOffset(String content, String search) { |
| 2988 int offset = content.indexOf(search); | 2991 int offset = content.indexOf(search); |
| 2989 expect(offset, isNot(-1)); | 2992 expect(offset, isNot(-1)); |
| 2990 return offset; | 2993 return offset; |
| 2991 } | 2994 } |
| 2992 } | 2995 } |
| 2993 | 2996 |
| 2994 | 2997 |
| 2998 @ReflectiveTestCase() |
| 2995 class ConstantEvaluatorTest extends ResolverTestCase { | 2999 class ConstantEvaluatorTest extends ResolverTestCase { |
| 2996 void fail_constructor() { | 3000 void fail_constructor() { |
| 2997 EvaluationResult result = _getExpressionValue("?"); | 3001 EvaluationResult result = _getExpressionValue("?"); |
| 2998 expect(result.isValid, isTrue); | 3002 expect(result.isValid, isTrue); |
| 2999 DartObject value = result.value; | 3003 DartObject value = result.value; |
| 3000 expect(value, null); | 3004 expect(value, null); |
| 3001 } | 3005 } |
| 3002 | 3006 |
| 3003 void fail_identifier_class() { | 3007 void fail_identifier_class() { |
| 3004 EvaluationResult result = _getExpressionValue("?"); | 3008 EvaluationResult result = _getExpressionValue("?"); |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3369 (declaration as TopLevelVariableDeclaration).variables.variables; | 3373 (declaration as TopLevelVariableDeclaration).variables.variables; |
| 3370 expect(variables, hasLength(1)); | 3374 expect(variables, hasLength(1)); |
| 3371 ConstantEvaluator evaluator = new ConstantEvaluator( | 3375 ConstantEvaluator evaluator = new ConstantEvaluator( |
| 3372 source, | 3376 source, |
| 3373 (analysisContext as AnalysisContextImpl).typeProvider); | 3377 (analysisContext as AnalysisContextImpl).typeProvider); |
| 3374 return evaluator.evaluate(variables[0].initializer); | 3378 return evaluator.evaluate(variables[0].initializer); |
| 3375 } | 3379 } |
| 3376 } | 3380 } |
| 3377 | 3381 |
| 3378 | 3382 |
| 3383 @ReflectiveTestCase() |
| 3379 class ConstantFinderTest extends EngineTestCase { | 3384 class ConstantFinderTest extends EngineTestCase { |
| 3380 AstNode _node; | 3385 AstNode _node; |
| 3381 | 3386 |
| 3382 /** | 3387 /** |
| 3383 * Test an annotation that consists solely of an identifier (and hence | 3388 * Test an annotation that consists solely of an identifier (and hence |
| 3384 * represents a reference to a compile-time constant variable). | 3389 * represents a reference to a compile-time constant variable). |
| 3385 */ | 3390 */ |
| 3386 void test_visitAnnotation_constantVariable() { | 3391 void test_visitAnnotation_constantVariable() { |
| 3387 _node = AstFactory.annotation(AstFactory.identifier3('x')); | 3392 _node = AstFactory.annotation(AstFactory.identifier3('x')); |
| 3388 expect(_findAnnotations(), contains(_node)); | 3393 expect(_findAnnotations(), contains(_node)); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3504 identifier.staticElement = element; | 3509 identifier.staticElement = element; |
| 3505 AstFactory.variableDeclarationList2( | 3510 AstFactory.variableDeclarationList2( |
| 3506 isConst ? Keyword.CONST : null, | 3511 isConst ? Keyword.CONST : null, |
| 3507 [variableDeclaration]); | 3512 [variableDeclaration]); |
| 3508 _node = variableDeclaration; | 3513 _node = variableDeclaration; |
| 3509 return element; | 3514 return element; |
| 3510 } | 3515 } |
| 3511 } | 3516 } |
| 3512 | 3517 |
| 3513 | 3518 |
| 3519 @ReflectiveTestCase() |
| 3514 class ConstantValueComputerTest extends ResolverTestCase { | 3520 class ConstantValueComputerTest extends ResolverTestCase { |
| 3515 void test_annotation_constConstructor() { | 3521 void test_annotation_constConstructor() { |
| 3516 CompilationUnit compilationUnit = resolveSource(r''' | 3522 CompilationUnit compilationUnit = resolveSource(r''' |
| 3517 class A { | 3523 class A { |
| 3518 final int i; | 3524 final int i; |
| 3519 const A(this.i); | 3525 const A(this.i); |
| 3520 } | 3526 } |
| 3521 | 3527 |
| 3522 class C { | 3528 class C { |
| 3523 @A(5) | 3529 @A(5) |
| (...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4737 super.beforeGetEvaluationResult(node); | 4743 super.beforeGetEvaluationResult(node); |
| 4738 // If we are getting the evaluation result for a node in the graph, | 4744 // If we are getting the evaluation result for a node in the graph, |
| 4739 // make sure we properly recorded the dependency. | 4745 // make sure we properly recorded the dependency. |
| 4740 if (_referenceGraph.nodes.contains(node)) { | 4746 if (_referenceGraph.nodes.contains(node)) { |
| 4741 expect(_referenceGraph.containsPath(_nodeBeingEvaluated, node), isTrue); | 4747 expect(_referenceGraph.containsPath(_nodeBeingEvaluated, node), isTrue); |
| 4742 } | 4748 } |
| 4743 } | 4749 } |
| 4744 } | 4750 } |
| 4745 | 4751 |
| 4746 | 4752 |
| 4753 @ReflectiveTestCase() |
| 4747 class ConstantVisitorTest extends ResolverTestCase { | 4754 class ConstantVisitorTest extends ResolverTestCase { |
| 4748 void test_visitConditionalExpression_false() { | 4755 void test_visitConditionalExpression_false() { |
| 4749 Expression thenExpression = AstFactory.integer(1); | 4756 Expression thenExpression = AstFactory.integer(1); |
| 4750 Expression elseExpression = AstFactory.integer(0); | 4757 Expression elseExpression = AstFactory.integer(0); |
| 4751 ConditionalExpression expression = AstFactory.conditionalExpression( | 4758 ConditionalExpression expression = AstFactory.conditionalExpression( |
| 4752 AstFactory.booleanLiteral(false), | 4759 AstFactory.booleanLiteral(false), |
| 4753 thenExpression, | 4760 thenExpression, |
| 4754 elseExpression); | 4761 elseExpression); |
| 4755 GatheringErrorListener errorListener = new GatheringErrorListener(); | 4762 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 4756 ErrorReporter errorReporter = | 4763 ErrorReporter errorReporter = |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4908 GatheringErrorListener errorListener = new GatheringErrorListener(); | 4915 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 4909 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); | 4916 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); |
| 4910 DartObjectImpl result = expression.accept( | 4917 DartObjectImpl result = expression.accept( |
| 4911 new ConstantVisitor.con2(typeProvider, lexicalEnvironment, errorReporter
)); | 4918 new ConstantVisitor.con2(typeProvider, lexicalEnvironment, errorReporter
)); |
| 4912 errorListener.assertNoErrors(); | 4919 errorListener.assertNoErrors(); |
| 4913 return result; | 4920 return result; |
| 4914 } | 4921 } |
| 4915 } | 4922 } |
| 4916 | 4923 |
| 4917 | 4924 |
| 4925 @ReflectiveTestCase() |
| 4918 class ContentCacheTest { | 4926 class ContentCacheTest { |
| 4919 void test_setContents() { | 4927 void test_setContents() { |
| 4920 Source source = new TestSource(); | 4928 Source source = new TestSource(); |
| 4921 ContentCache cache = new ContentCache(); | 4929 ContentCache cache = new ContentCache(); |
| 4922 expect(cache.getContents(source), isNull); | 4930 expect(cache.getContents(source), isNull); |
| 4923 expect(cache.getModificationStamp(source), isNull); | 4931 expect(cache.getModificationStamp(source), isNull); |
| 4924 String contents = "library lib;"; | 4932 String contents = "library lib;"; |
| 4925 expect(cache.setContents(source, contents), isNull); | 4933 expect(cache.setContents(source, contents), isNull); |
| 4926 expect(cache.getContents(source), contents); | 4934 expect(cache.getContents(source), contents); |
| 4927 expect(cache.getModificationStamp(source), isNotNull); | 4935 expect(cache.getModificationStamp(source), isNotNull); |
| 4928 expect(cache.setContents(source, contents), contents); | 4936 expect(cache.setContents(source, contents), contents); |
| 4929 expect(cache.setContents(source, null), contents); | 4937 expect(cache.setContents(source, null), contents); |
| 4930 expect(cache.getContents(source), isNull); | 4938 expect(cache.getContents(source), isNull); |
| 4931 expect(cache.getModificationStamp(source), isNull); | 4939 expect(cache.getModificationStamp(source), isNull); |
| 4932 expect(cache.setContents(source, null), isNull); | 4940 expect(cache.setContents(source, null), isNull); |
| 4933 } | 4941 } |
| 4934 } | 4942 } |
| 4935 | 4943 |
| 4936 | 4944 |
| 4945 @ReflectiveTestCase() |
| 4937 class DartObjectImplTest extends EngineTestCase { | 4946 class DartObjectImplTest extends EngineTestCase { |
| 4938 TypeProvider _typeProvider = new TestTypeProvider(); | 4947 TypeProvider _typeProvider = new TestTypeProvider(); |
| 4939 | 4948 |
| 4940 void fail_add_knownString_knownString() { | 4949 void fail_add_knownString_knownString() { |
| 4941 fail("New constant semantics are not yet enabled"); | 4950 fail("New constant semantics are not yet enabled"); |
| 4942 _assertAdd(_stringValue("ab"), _stringValue("a"), _stringValue("b")); | 4951 _assertAdd(_stringValue("ab"), _stringValue("a"), _stringValue("b")); |
| 4943 } | 4952 } |
| 4944 | 4953 |
| 4945 void fail_add_knownString_unknownString() { | 4954 void fail_add_knownString_unknownString() { |
| 4946 fail("New constant semantics are not yet enabled"); | 4955 fail("New constant semantics are not yet enabled"); |
| (...skipping 2228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7175 new StringState(value)); | 7184 new StringState(value)); |
| 7176 } | 7185 } |
| 7177 } | 7186 } |
| 7178 | 7187 |
| 7179 DartObjectImpl _symbolValue(String value) { | 7188 DartObjectImpl _symbolValue(String value) { |
| 7180 return new DartObjectImpl(_typeProvider.symbolType, new SymbolState(value)); | 7189 return new DartObjectImpl(_typeProvider.symbolType, new SymbolState(value)); |
| 7181 } | 7190 } |
| 7182 } | 7191 } |
| 7183 | 7192 |
| 7184 | 7193 |
| 7194 @ReflectiveTestCase() |
| 7185 class DartUriResolverTest { | 7195 class DartUriResolverTest { |
| 7186 void test_creation() { | 7196 void test_creation() { |
| 7187 JavaFile sdkDirectory = DirectoryBasedDartSdk.defaultSdkDirectory; | 7197 JavaFile sdkDirectory = DirectoryBasedDartSdk.defaultSdkDirectory; |
| 7188 expect(sdkDirectory, isNotNull); | 7198 expect(sdkDirectory, isNotNull); |
| 7189 DartSdk sdk = new DirectoryBasedDartSdk(sdkDirectory); | 7199 DartSdk sdk = new DirectoryBasedDartSdk(sdkDirectory); |
| 7190 expect(new DartUriResolver(sdk), isNotNull); | 7200 expect(new DartUriResolver(sdk), isNotNull); |
| 7191 } | 7201 } |
| 7192 | 7202 |
| 7193 void test_isDartUri_null_scheme() { | 7203 void test_isDartUri_null_scheme() { |
| 7194 Uri uri = parseUriWithException("foo.dart"); | 7204 Uri uri = parseUriWithException("foo.dart"); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 7220 expect(sdkDirectory, isNotNull); | 7230 expect(sdkDirectory, isNotNull); |
| 7221 DartSdk sdk = new DirectoryBasedDartSdk(sdkDirectory); | 7231 DartSdk sdk = new DirectoryBasedDartSdk(sdkDirectory); |
| 7222 UriResolver resolver = new DartUriResolver(sdk); | 7232 UriResolver resolver = new DartUriResolver(sdk); |
| 7223 Source result = | 7233 Source result = |
| 7224 resolver.resolveAbsolute(parseUriWithException("package:some/file.dart")
); | 7234 resolver.resolveAbsolute(parseUriWithException("package:some/file.dart")
); |
| 7225 expect(result, isNull); | 7235 expect(result, isNull); |
| 7226 } | 7236 } |
| 7227 } | 7237 } |
| 7228 | 7238 |
| 7229 | 7239 |
| 7240 @ReflectiveTestCase() |
| 7230 class DeclaredVariablesTest extends EngineTestCase { | 7241 class DeclaredVariablesTest extends EngineTestCase { |
| 7231 void test_getBool_false() { | 7242 void test_getBool_false() { |
| 7232 TestTypeProvider typeProvider = new TestTypeProvider(); | 7243 TestTypeProvider typeProvider = new TestTypeProvider(); |
| 7233 String variableName = "var"; | 7244 String variableName = "var"; |
| 7234 DeclaredVariables variables = new DeclaredVariables(); | 7245 DeclaredVariables variables = new DeclaredVariables(); |
| 7235 variables.define(variableName, "false"); | 7246 variables.define(variableName, "false"); |
| 7236 DartObject object = variables.getBool(typeProvider, variableName); | 7247 DartObject object = variables.getBool(typeProvider, variableName); |
| 7237 expect(object, isNotNull); | 7248 expect(object, isNotNull); |
| 7238 expect(object.boolValue, false); | 7249 expect(object.boolValue, false); |
| 7239 } | 7250 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7321 } | 7332 } |
| 7322 | 7333 |
| 7323 void _assertUnknownDartObject(ParameterizedType expectedType, | 7334 void _assertUnknownDartObject(ParameterizedType expectedType, |
| 7324 DartObject result) { | 7335 DartObject result) { |
| 7325 expect((result as DartObjectImpl).isUnknown, isTrue); | 7336 expect((result as DartObjectImpl).isUnknown, isTrue); |
| 7326 expect(result.type, expectedType); | 7337 expect(result.type, expectedType); |
| 7327 } | 7338 } |
| 7328 } | 7339 } |
| 7329 | 7340 |
| 7330 | 7341 |
| 7342 @ReflectiveTestCase() |
| 7331 class DirectoryBasedDartSdkTest { | 7343 class DirectoryBasedDartSdkTest { |
| 7332 void fail_getDocFileFor() { | 7344 void fail_getDocFileFor() { |
| 7333 DirectoryBasedDartSdk sdk = _createDartSdk(); | 7345 DirectoryBasedDartSdk sdk = _createDartSdk(); |
| 7334 JavaFile docFile = sdk.getDocFileFor("html"); | 7346 JavaFile docFile = sdk.getDocFileFor("html"); |
| 7335 expect(docFile, isNotNull); | 7347 expect(docFile, isNotNull); |
| 7336 } | 7348 } |
| 7337 | 7349 |
| 7338 void test_creation() { | 7350 void test_creation() { |
| 7339 DirectoryBasedDartSdk sdk = _createDartSdk(); | 7351 DirectoryBasedDartSdk sdk = _createDartSdk(); |
| 7340 expect(sdk, isNotNull); | 7352 expect(sdk, isNotNull); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7433 expect( | 7445 expect( |
| 7434 sdkDirectory, | 7446 sdkDirectory, |
| 7435 isNotNull, | 7447 isNotNull, |
| 7436 reason: | 7448 reason: |
| 7437 "No SDK configured; set the property 'com.google.dart.sdk' on the co
mmand line"); | 7449 "No SDK configured; set the property 'com.google.dart.sdk' on the co
mmand line"); |
| 7438 return new DirectoryBasedDartSdk(sdkDirectory); | 7450 return new DirectoryBasedDartSdk(sdkDirectory); |
| 7439 } | 7451 } |
| 7440 } | 7452 } |
| 7441 | 7453 |
| 7442 | 7454 |
| 7455 @ReflectiveTestCase() |
| 7443 class DirectoryBasedSourceContainerTest { | 7456 class DirectoryBasedSourceContainerTest { |
| 7444 void test_contains() { | 7457 void test_contains() { |
| 7445 JavaFile dir = FileUtilities2.createFile("/does/not/exist"); | 7458 JavaFile dir = FileUtilities2.createFile("/does/not/exist"); |
| 7446 JavaFile file1 = FileUtilities2.createFile("/does/not/exist/some.dart"); | 7459 JavaFile file1 = FileUtilities2.createFile("/does/not/exist/some.dart"); |
| 7447 JavaFile file2 = | 7460 JavaFile file2 = |
| 7448 FileUtilities2.createFile("/does/not/exist/folder/some2.dart"); | 7461 FileUtilities2.createFile("/does/not/exist/folder/some2.dart"); |
| 7449 JavaFile file3 = FileUtilities2.createFile("/does/not/exist3/some3.dart"); | 7462 JavaFile file3 = FileUtilities2.createFile("/does/not/exist3/some3.dart"); |
| 7450 FileBasedSource source1 = new FileBasedSource.con1(file1); | 7463 FileBasedSource source1 = new FileBasedSource.con1(file1); |
| 7451 FileBasedSource source2 = new FileBasedSource.con1(file2); | 7464 FileBasedSource source2 = new FileBasedSource.con1(file2); |
| 7452 FileBasedSource source3 = new FileBasedSource.con1(file3); | 7465 FileBasedSource source3 = new FileBasedSource.con1(file3); |
| 7453 DirectoryBasedSourceContainer container = | 7466 DirectoryBasedSourceContainer container = |
| 7454 new DirectoryBasedSourceContainer.con1(dir); | 7467 new DirectoryBasedSourceContainer.con1(dir); |
| 7455 expect(container.contains(source1), isTrue); | 7468 expect(container.contains(source1), isTrue); |
| 7456 expect(container.contains(source2), isTrue); | 7469 expect(container.contains(source2), isTrue); |
| 7457 expect(container.contains(source3), isFalse); | 7470 expect(container.contains(source3), isFalse); |
| 7458 } | 7471 } |
| 7459 } | 7472 } |
| 7460 | 7473 |
| 7461 | 7474 |
| 7475 @ReflectiveTestCase() |
| 7462 class ElementBuilderTest extends EngineTestCase { | 7476 class ElementBuilderTest extends EngineTestCase { |
| 7463 void test_visitCatchClause() { | 7477 void test_visitCatchClause() { |
| 7464 ElementHolder holder = new ElementHolder(); | 7478 ElementHolder holder = new ElementHolder(); |
| 7465 ElementBuilder builder = new ElementBuilder(holder); | 7479 ElementBuilder builder = new ElementBuilder(holder); |
| 7466 String exceptionParameterName = "e"; | 7480 String exceptionParameterName = "e"; |
| 7467 String stackParameterName = "s"; | 7481 String stackParameterName = "s"; |
| 7468 CatchClause clause = | 7482 CatchClause clause = |
| 7469 AstFactory.catchClause2(exceptionParameterName, stackParameterName); | 7483 AstFactory.catchClause2(exceptionParameterName, stackParameterName); |
| 7470 clause.accept(builder); | 7484 clause.accept(builder); |
| 7471 List<LocalVariableElement> variables = holder.localVariables; | 7485 List<LocalVariableElement> variables = holder.localVariables; |
| (...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8708 null, | 8722 null, |
| 8709 null, | 8723 null, |
| 8710 null, | 8724 null, |
| 8711 AstFactory.identifier3("main"), | 8725 AstFactory.identifier3("main"), |
| 8712 AstFactory.formalParameterList([formalParameter]), | 8726 AstFactory.formalParameterList([formalParameter]), |
| 8713 body); | 8727 body); |
| 8714 } | 8728 } |
| 8715 } | 8729 } |
| 8716 | 8730 |
| 8717 | 8731 |
| 8732 @ReflectiveTestCase() |
| 8718 class ElementLocatorTest extends ResolverTestCase { | 8733 class ElementLocatorTest extends ResolverTestCase { |
| 8719 void fail_locate_ExportDirective() { | 8734 void fail_locate_ExportDirective() { |
| 8720 AstNode id = _findNodeIn("export", "export 'dart:core';"); | 8735 AstNode id = _findNodeIn("export", "export 'dart:core';"); |
| 8721 Element element = ElementLocator.locate(id); | 8736 Element element = ElementLocator.locate(id); |
| 8722 EngineTestCase.assertInstanceOf( | 8737 EngineTestCase.assertInstanceOf( |
| 8723 (obj) => obj is ImportElement, | 8738 (obj) => obj is ImportElement, |
| 8724 ImportElement, | 8739 ImportElement, |
| 8725 element); | 8740 element); |
| 8726 } | 8741 } |
| 8727 | 8742 |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9178 CompilationUnit _resolveContents(String code) { | 9193 CompilationUnit _resolveContents(String code) { |
| 9179 Source source = addSource(code); | 9194 Source source = addSource(code); |
| 9180 LibraryElement library = resolve(source); | 9195 LibraryElement library = resolve(source); |
| 9181 assertNoErrors(source); | 9196 assertNoErrors(source); |
| 9182 verify([source]); | 9197 verify([source]); |
| 9183 return analysisContext.resolveCompilationUnit(source, library); | 9198 return analysisContext.resolveCompilationUnit(source, library); |
| 9184 } | 9199 } |
| 9185 } | 9200 } |
| 9186 | 9201 |
| 9187 | 9202 |
| 9203 @ReflectiveTestCase() |
| 9188 class EnumMemberBuilderTest extends EngineTestCase { | 9204 class EnumMemberBuilderTest extends EngineTestCase { |
| 9189 void test_visitEnumDeclaration_multiple() { | 9205 void test_visitEnumDeclaration_multiple() { |
| 9190 String firstName = "ONE"; | 9206 String firstName = "ONE"; |
| 9191 String secondName = "TWO"; | 9207 String secondName = "TWO"; |
| 9192 String thirdName = "THREE"; | 9208 String thirdName = "THREE"; |
| 9193 EnumDeclaration enumDeclaration = | 9209 EnumDeclaration enumDeclaration = |
| 9194 AstFactory.enumDeclaration2("E", [firstName, secondName, thirdName]); | 9210 AstFactory.enumDeclaration2("E", [firstName, secondName, thirdName]); |
| 9195 | 9211 |
| 9196 ClassElement enumElement = _buildElement(enumDeclaration); | 9212 ClassElement enumElement = _buildElement(enumDeclaration); |
| 9197 List<FieldElement> fields = enumElement.fields; | 9213 List<FieldElement> fields = enumElement.fields; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9260 EnumMemberBuilder memberBuilder = | 9276 EnumMemberBuilder memberBuilder = |
| 9261 new EnumMemberBuilder(new TestTypeProvider()); | 9277 new EnumMemberBuilder(new TestTypeProvider()); |
| 9262 enumDeclaration.accept(memberBuilder); | 9278 enumDeclaration.accept(memberBuilder); |
| 9263 List<ClassElement> enums = holder.enums; | 9279 List<ClassElement> enums = holder.enums; |
| 9264 expect(enums, hasLength(1)); | 9280 expect(enums, hasLength(1)); |
| 9265 return enums[0]; | 9281 return enums[0]; |
| 9266 } | 9282 } |
| 9267 } | 9283 } |
| 9268 | 9284 |
| 9269 | 9285 |
| 9286 @ReflectiveTestCase() |
| 9270 class ErrorReporterTest extends EngineTestCase { | 9287 class ErrorReporterTest extends EngineTestCase { |
| 9271 /** | 9288 /** |
| 9272 * Create a type with the given name in a compilation unit with the given name
. | 9289 * Create a type with the given name in a compilation unit with the given name
. |
| 9273 * | 9290 * |
| 9274 * @param fileName the name of the compilation unit containing the class | 9291 * @param fileName the name of the compilation unit containing the class |
| 9275 * @param typeName the name of the type to be created | 9292 * @param typeName the name of the type to be created |
| 9276 * @return the type that was created | 9293 * @return the type that was created |
| 9277 */ | 9294 */ |
| 9278 InterfaceType createType(String fileName, String typeName) { | 9295 InterfaceType createType(String fileName, String typeName) { |
| 9279 CompilationUnitElementImpl unit = ElementFactory.compilationUnit(fileName); | 9296 CompilationUnitElementImpl unit = ElementFactory.compilationUnit(fileName); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9312 reporter.reportTypeErrorForNode( | 9329 reporter.reportTypeErrorForNode( |
| 9313 StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, | 9330 StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, |
| 9314 AstFactory.identifier3("x"), | 9331 AstFactory.identifier3("x"), |
| 9315 [firstType, secondType]); | 9332 [firstType, secondType]); |
| 9316 AnalysisError error = listener.errors[0]; | 9333 AnalysisError error = listener.errors[0]; |
| 9317 expect(error.message.indexOf("(") >= 0, isTrue); | 9334 expect(error.message.indexOf("(") >= 0, isTrue); |
| 9318 } | 9335 } |
| 9319 } | 9336 } |
| 9320 | 9337 |
| 9321 | 9338 |
| 9339 @ReflectiveTestCase() |
| 9322 class ErrorSeverityTest extends EngineTestCase { | 9340 class ErrorSeverityTest extends EngineTestCase { |
| 9323 void test_max_error_error() { | 9341 void test_max_error_error() { |
| 9324 expect( | 9342 expect( |
| 9325 ErrorSeverity.ERROR.max(ErrorSeverity.ERROR), | 9343 ErrorSeverity.ERROR.max(ErrorSeverity.ERROR), |
| 9326 same(ErrorSeverity.ERROR)); | 9344 same(ErrorSeverity.ERROR)); |
| 9327 } | 9345 } |
| 9328 | 9346 |
| 9329 void test_max_error_none() { | 9347 void test_max_error_none() { |
| 9330 expect( | 9348 expect( |
| 9331 ErrorSeverity.ERROR.max(ErrorSeverity.NONE), | 9349 ErrorSeverity.ERROR.max(ErrorSeverity.NONE), |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9369 } | 9387 } |
| 9370 | 9388 |
| 9371 void test_max_warning_warning() { | 9389 void test_max_warning_warning() { |
| 9372 expect( | 9390 expect( |
| 9373 ErrorSeverity.WARNING.max(ErrorSeverity.WARNING), | 9391 ErrorSeverity.WARNING.max(ErrorSeverity.WARNING), |
| 9374 same(ErrorSeverity.WARNING)); | 9392 same(ErrorSeverity.WARNING)); |
| 9375 } | 9393 } |
| 9376 } | 9394 } |
| 9377 | 9395 |
| 9378 | 9396 |
| 9397 @ReflectiveTestCase() |
| 9379 class ExitDetectorTest extends ParserTestCase { | 9398 class ExitDetectorTest extends ParserTestCase { |
| 9380 void fail_doStatement_continue_with_label() { | 9399 void fail_doStatement_continue_with_label() { |
| 9381 _assertFalse("{ x: do { continue x; } while(true); }"); | 9400 _assertFalse("{ x: do { continue x; } while(true); }"); |
| 9382 } | 9401 } |
| 9383 | 9402 |
| 9384 void fail_whileStatement_continue_with_label() { | 9403 void fail_whileStatement_continue_with_label() { |
| 9385 _assertFalse("{ x: while (true) { continue x; } }"); | 9404 _assertFalse("{ x: while (true) { continue x; } }"); |
| 9386 } | 9405 } |
| 9387 | 9406 |
| 9388 void fail_whileStatement_doStatement_scopeRequired() { | 9407 void fail_whileStatement_doStatement_scopeRequired() { |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9870 | 9889 |
| 9871 ExpressionVisitor_AngularTest_verify(this.verifier); | 9890 ExpressionVisitor_AngularTest_verify(this.verifier); |
| 9872 | 9891 |
| 9873 @override | 9892 @override |
| 9874 void visitExpression(Expression expression) { | 9893 void visitExpression(Expression expression) { |
| 9875 expression.accept(verifier); | 9894 expression.accept(verifier); |
| 9876 } | 9895 } |
| 9877 } | 9896 } |
| 9878 | 9897 |
| 9879 | 9898 |
| 9899 @ReflectiveTestCase() |
| 9880 class FileBasedSourceTest { | 9900 class FileBasedSourceTest { |
| 9881 void test_equals_false_differentFiles() { | 9901 void test_equals_false_differentFiles() { |
| 9882 JavaFile file1 = FileUtilities2.createFile("/does/not/exist1.dart"); | 9902 JavaFile file1 = FileUtilities2.createFile("/does/not/exist1.dart"); |
| 9883 JavaFile file2 = FileUtilities2.createFile("/does/not/exist2.dart"); | 9903 JavaFile file2 = FileUtilities2.createFile("/does/not/exist2.dart"); |
| 9884 FileBasedSource source1 = new FileBasedSource.con1(file1); | 9904 FileBasedSource source1 = new FileBasedSource.con1(file1); |
| 9885 FileBasedSource source2 = new FileBasedSource.con1(file2); | 9905 FileBasedSource source2 = new FileBasedSource.con1(file2); |
| 9886 expect(source1 == source2, isFalse); | 9906 expect(source1 == source2, isFalse); |
| 9887 } | 9907 } |
| 9888 | 9908 |
| 9889 void test_equals_false_null() { | 9909 void test_equals_false_null() { |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10086 JavaFile file = FileUtilities2.createFile("/does/not/exist.dart"); | 10106 JavaFile file = FileUtilities2.createFile("/does/not/exist.dart"); |
| 10087 FileBasedSource source = | 10107 FileBasedSource source = |
| 10088 new FileBasedSource.con2(parseUriWithException("dart:core"), file); | 10108 new FileBasedSource.con2(parseUriWithException("dart:core"), file); |
| 10089 expect(source, isNotNull); | 10109 expect(source, isNotNull); |
| 10090 expect(source.fullName, file.getAbsolutePath()); | 10110 expect(source.fullName, file.getAbsolutePath()); |
| 10091 expect(source.isInSystemLibrary, isTrue); | 10111 expect(source.isInSystemLibrary, isTrue); |
| 10092 } | 10112 } |
| 10093 } | 10113 } |
| 10094 | 10114 |
| 10095 | 10115 |
| 10116 @ReflectiveTestCase() |
| 10096 class FileUriResolverTest { | 10117 class FileUriResolverTest { |
| 10097 void test_creation() { | 10118 void test_creation() { |
| 10098 expect(new FileUriResolver(), isNotNull); | 10119 expect(new FileUriResolver(), isNotNull); |
| 10099 } | 10120 } |
| 10100 | 10121 |
| 10101 void test_resolve_file() { | 10122 void test_resolve_file() { |
| 10102 UriResolver resolver = new FileUriResolver(); | 10123 UriResolver resolver = new FileUriResolver(); |
| 10103 Source result = | 10124 Source result = |
| 10104 resolver.resolveAbsolute(parseUriWithException("file:/does/not/exist.dar
t")); | 10125 resolver.resolveAbsolute(parseUriWithException("file:/does/not/exist.dar
t")); |
| 10105 expect(result, isNotNull); | 10126 expect(result, isNotNull); |
| 10106 expect( | 10127 expect( |
| 10107 result.fullName, | 10128 result.fullName, |
| 10108 FileUtilities2.createFile("/does/not/exist.dart").getAbsolutePath()); | 10129 FileUtilities2.createFile("/does/not/exist.dart").getAbsolutePath()); |
| 10109 } | 10130 } |
| 10110 | 10131 |
| 10111 void test_resolve_nonFile() { | 10132 void test_resolve_nonFile() { |
| 10112 UriResolver resolver = new FileUriResolver(); | 10133 UriResolver resolver = new FileUriResolver(); |
| 10113 Source result = | 10134 Source result = |
| 10114 resolver.resolveAbsolute(parseUriWithException("dart:core")); | 10135 resolver.resolveAbsolute(parseUriWithException("dart:core")); |
| 10115 expect(result, isNull); | 10136 expect(result, isNull); |
| 10116 } | 10137 } |
| 10117 } | 10138 } |
| 10118 | 10139 |
| 10119 | 10140 |
| 10141 @ReflectiveTestCase() |
| 10120 class HtmlParserTest extends EngineTestCase { | 10142 class HtmlParserTest extends EngineTestCase { |
| 10121 /** | 10143 /** |
| 10122 * The name of the 'script' tag in an HTML file. | 10144 * The name of the 'script' tag in an HTML file. |
| 10123 */ | 10145 */ |
| 10124 static String _TAG_SCRIPT = "script"; | 10146 static String _TAG_SCRIPT = "script"; |
| 10125 void fail_parse_scriptWithComment() { | 10147 void fail_parse_scriptWithComment() { |
| 10126 String scriptBody = r''' | 10148 String scriptBody = r''' |
| 10127 /** | 10149 /** |
| 10128 * <editable-label bind-value="dartAsignableValue"> | 10150 * <editable-label bind-value="dartAsignableValue"> |
| 10129 * </editable-label> | 10151 * </editable-label> |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10293 new XmlValidator_Tag(tag, new XmlValidator_Attributes(), null, children); | 10315 new XmlValidator_Tag(tag, new XmlValidator_Attributes(), null, children); |
| 10294 void _validate(ht.HtmlUnit htmlUnit, List<XmlValidator_Tag> expectedTags) { | 10316 void _validate(ht.HtmlUnit htmlUnit, List<XmlValidator_Tag> expectedTags) { |
| 10295 XmlValidator validator = new XmlValidator(); | 10317 XmlValidator validator = new XmlValidator(); |
| 10296 validator.expectTags(expectedTags); | 10318 validator.expectTags(expectedTags); |
| 10297 htmlUnit.accept(validator); | 10319 htmlUnit.accept(validator); |
| 10298 validator.assertValid(); | 10320 validator.assertValid(); |
| 10299 } | 10321 } |
| 10300 } | 10322 } |
| 10301 | 10323 |
| 10302 | 10324 |
| 10325 @ReflectiveTestCase() |
| 10303 class HtmlTagInfoBuilderTest extends HtmlParserTest { | 10326 class HtmlTagInfoBuilderTest extends HtmlParserTest { |
| 10304 void test_builder() { | 10327 void test_builder() { |
| 10305 HtmlTagInfoBuilder builder = new HtmlTagInfoBuilder(); | 10328 HtmlTagInfoBuilder builder = new HtmlTagInfoBuilder(); |
| 10306 ht.HtmlUnit unit = parse(r''' | 10329 ht.HtmlUnit unit = parse(r''' |
| 10307 <html> | 10330 <html> |
| 10308 <body> | 10331 <body> |
| 10309 <div id="x"></div> | 10332 <div id="x"></div> |
| 10310 <p class='c'></p> | 10333 <p class='c'></p> |
| 10311 <div class='c'></div> | 10334 <div class='c'></div> |
| 10312 </body> | 10335 </body> |
| 10313 </html>'''); | 10336 </html>'''); |
| 10314 unit.accept(builder); | 10337 unit.accept(builder); |
| 10315 HtmlTagInfo info = builder.getTagInfo(); | 10338 HtmlTagInfo info = builder.getTagInfo(); |
| 10316 expect(info, isNotNull); | 10339 expect(info, isNotNull); |
| 10317 List<String> allTags = info.allTags; | 10340 List<String> allTags = info.allTags; |
| 10318 expect(allTags, hasLength(4)); | 10341 expect(allTags, hasLength(4)); |
| 10319 expect(info.getTagWithId("x"), "div"); | 10342 expect(info.getTagWithId("x"), "div"); |
| 10320 List<String> tagsWithClass = info.getTagsWithClass("c"); | 10343 List<String> tagsWithClass = info.getTagsWithClass("c"); |
| 10321 expect(tagsWithClass, hasLength(2)); | 10344 expect(tagsWithClass, hasLength(2)); |
| 10322 } | 10345 } |
| 10323 } | 10346 } |
| 10324 | 10347 |
| 10325 | 10348 |
| 10349 @ReflectiveTestCase() |
| 10326 class HtmlUnitBuilderTest extends EngineTestCase { | 10350 class HtmlUnitBuilderTest extends EngineTestCase { |
| 10327 AnalysisContextImpl _context; | 10351 AnalysisContextImpl _context; |
| 10328 @override | 10352 @override |
| 10329 void setUp() { | 10353 void setUp() { |
| 10330 _context = AnalysisContextFactory.contextWithCore(); | 10354 _context = AnalysisContextFactory.contextWithCore(); |
| 10331 } | 10355 } |
| 10332 @override | 10356 @override |
| 10333 void tearDown() { | 10357 void tearDown() { |
| 10334 _context = null; | 10358 _context = null; |
| 10335 super.tearDown(); | 10359 super.tearDown(); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10453 void validate(int scriptIndex, TopLevelVariableElement variable) { | 10477 void validate(int scriptIndex, TopLevelVariableElement variable) { |
| 10454 expect(variable, isNotNull, reason: "script $scriptIndex"); | 10478 expect(variable, isNotNull, reason: "script $scriptIndex"); |
| 10455 expect(variable.name, _expectedName, reason: "script $scriptIndex"); | 10479 expect(variable.name, _expectedName, reason: "script $scriptIndex"); |
| 10456 } | 10480 } |
| 10457 } | 10481 } |
| 10458 | 10482 |
| 10459 | 10483 |
| 10460 /** | 10484 /** |
| 10461 * Instances of the class `HtmlWarningCodeTest` test the generation of HTML warn
ing codes. | 10485 * Instances of the class `HtmlWarningCodeTest` test the generation of HTML warn
ing codes. |
| 10462 */ | 10486 */ |
| 10487 @ReflectiveTestCase() |
| 10463 class HtmlWarningCodeTest extends EngineTestCase { | 10488 class HtmlWarningCodeTest extends EngineTestCase { |
| 10464 /** | 10489 /** |
| 10465 * The source factory used to create the sources to be resolved. | 10490 * The source factory used to create the sources to be resolved. |
| 10466 */ | 10491 */ |
| 10467 SourceFactory _sourceFactory; | 10492 SourceFactory _sourceFactory; |
| 10468 | 10493 |
| 10469 /** | 10494 /** |
| 10470 * The analysis context used to resolve the HTML files. | 10495 * The analysis context used to resolve the HTML files. |
| 10471 */ | 10496 */ |
| 10472 AnalysisContextImpl _context; | 10497 AnalysisContextImpl _context; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10563 Source fromFileUri(Uri uri) => null; | 10588 Source fromFileUri(Uri uri) => null; |
| 10564 | 10589 |
| 10565 @override | 10590 @override |
| 10566 SdkLibrary getSdkLibrary(String dartUri) => null; | 10591 SdkLibrary getSdkLibrary(String dartUri) => null; |
| 10567 | 10592 |
| 10568 @override | 10593 @override |
| 10569 Source mapDartUri(String dartUri) => null; | 10594 Source mapDartUri(String dartUri) => null; |
| 10570 } | 10595 } |
| 10571 | 10596 |
| 10572 | 10597 |
| 10598 @ReflectiveTestCase() |
| 10573 class ReferenceFinderTest extends EngineTestCase { | 10599 class ReferenceFinderTest extends EngineTestCase { |
| 10574 DirectedGraph<AstNode> _referenceGraph; | 10600 DirectedGraph<AstNode> _referenceGraph; |
| 10575 Map<VariableElement, VariableDeclaration> _variableDeclarationMap; | 10601 Map<VariableElement, VariableDeclaration> _variableDeclarationMap; |
| 10576 Map<ConstructorElement, ConstructorDeclaration> _constructorDeclarationMap; | 10602 Map<ConstructorElement, ConstructorDeclaration> _constructorDeclarationMap; |
| 10577 VariableDeclaration _head; | 10603 VariableDeclaration _head; |
| 10578 AstNode _tail; | 10604 AstNode _tail; |
| 10579 @override | 10605 @override |
| 10580 void setUp() { | 10606 void setUp() { |
| 10581 _referenceGraph = new DirectedGraph<AstNode>(); | 10607 _referenceGraph = new DirectedGraph<AstNode>(); |
| 10582 _variableDeclarationMap = | 10608 _variableDeclarationMap = |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10725 SimpleIdentifier identifier = AstFactory.identifier3(name); | 10751 SimpleIdentifier identifier = AstFactory.identifier3(name); |
| 10726 identifier.staticElement = variableElement; | 10752 identifier.staticElement = variableElement; |
| 10727 return identifier; | 10753 return identifier; |
| 10728 } | 10754 } |
| 10729 void _visitNode(AstNode node) { | 10755 void _visitNode(AstNode node) { |
| 10730 node.accept(_createReferenceFinder(_head)); | 10756 node.accept(_createReferenceFinder(_head)); |
| 10731 } | 10757 } |
| 10732 } | 10758 } |
| 10733 | 10759 |
| 10734 | 10760 |
| 10761 @ReflectiveTestCase() |
| 10735 class SDKLibrariesReaderTest extends EngineTestCase { | 10762 class SDKLibrariesReaderTest extends EngineTestCase { |
| 10736 void test_readFrom_dart2js() { | 10763 void test_readFrom_dart2js() { |
| 10737 LibraryMap libraryMap = new SdkLibrariesReader( | 10764 LibraryMap libraryMap = new SdkLibrariesReader( |
| 10738 true).readFromFile(FileUtilities2.createFile("/libs.dart"), r''' | 10765 true).readFromFile(FileUtilities2.createFile("/libs.dart"), r''' |
| 10739 final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> { | 10766 final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> { |
| 10740 'first' : const LibraryInfo( | 10767 'first' : const LibraryInfo( |
| 10741 'first/first.dart', | 10768 'first/first.dart', |
| 10742 category: 'First', | 10769 category: 'First', |
| 10743 documented: true, | 10770 documented: true, |
| 10744 platforms: VM_PLATFORM, | 10771 platforms: VM_PLATFORM, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10796 expect(second.path, "second/second.dart"); | 10823 expect(second.path, "second/second.dart"); |
| 10797 expect(second.shortName, "dart:second"); | 10824 expect(second.shortName, "dart:second"); |
| 10798 expect(second.isDart2JsLibrary, false); | 10825 expect(second.isDart2JsLibrary, false); |
| 10799 expect(second.isDocumented, false); | 10826 expect(second.isDocumented, false); |
| 10800 expect(second.isImplementation, true); | 10827 expect(second.isImplementation, true); |
| 10801 expect(second.isVmLibrary, false); | 10828 expect(second.isVmLibrary, false); |
| 10802 } | 10829 } |
| 10803 } | 10830 } |
| 10804 | 10831 |
| 10805 | 10832 |
| 10833 @ReflectiveTestCase() |
| 10806 class SourceFactoryTest { | 10834 class SourceFactoryTest { |
| 10807 void test_creation() { | 10835 void test_creation() { |
| 10808 expect(new SourceFactory([]), isNotNull); | 10836 expect(new SourceFactory([]), isNotNull); |
| 10809 } | 10837 } |
| 10810 void test_fromEncoding_invalidUri() { | 10838 void test_fromEncoding_invalidUri() { |
| 10811 SourceFactory factory = new SourceFactory([]); | 10839 SourceFactory factory = new SourceFactory([]); |
| 10812 try { | 10840 try { |
| 10813 factory.fromEncoding("<:&%>"); | 10841 factory.fromEncoding("<:&%>"); |
| 10814 fail("Expected IllegalArgumentException"); | 10842 fail("Expected IllegalArgumentException"); |
| 10815 } on IllegalArgumentException catch (exception) { | 10843 } on IllegalArgumentException catch (exception) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10863 Source source2 = new FileBasedSource.con1(file2); | 10891 Source source2 = new FileBasedSource.con1(file2); |
| 10864 Uri expected1 = parseUriWithException("file:///my_file.dart"); | 10892 Uri expected1 = parseUriWithException("file:///my_file.dart"); |
| 10865 SourceFactory factory = | 10893 SourceFactory factory = |
| 10866 new SourceFactory([new UriResolver_restoreUri(source1, expected1)]); | 10894 new SourceFactory([new UriResolver_restoreUri(source1, expected1)]); |
| 10867 expect(factory.restoreUri(source1), same(expected1)); | 10895 expect(factory.restoreUri(source1), same(expected1)); |
| 10868 expect(factory.restoreUri(source2), same(null)); | 10896 expect(factory.restoreUri(source2), same(null)); |
| 10869 } | 10897 } |
| 10870 } | 10898 } |
| 10871 | 10899 |
| 10872 | 10900 |
| 10901 @ReflectiveTestCase() |
| 10873 class StringScannerTest extends AbstractScannerTest { | 10902 class StringScannerTest extends AbstractScannerTest { |
| 10874 @override | 10903 @override |
| 10875 ht.AbstractScanner newScanner(String input) { | 10904 ht.AbstractScanner newScanner(String input) { |
| 10876 return new ht.StringScanner(null, input); | 10905 return new ht.StringScanner(null, input); |
| 10877 } | 10906 } |
| 10878 } | 10907 } |
| 10879 | 10908 |
| 10880 | 10909 |
| 10881 /** | 10910 /** |
| 10882 * Instances of the class `ToSourceVisitorTest` | 10911 * Instances of the class `ToSourceVisitorTest` |
| 10883 */ | 10912 */ |
| 10913 @ReflectiveTestCase() |
| 10884 class ToSourceVisitorTest extends EngineTestCase { | 10914 class ToSourceVisitorTest extends EngineTestCase { |
| 10885 void fail_visitHtmlScriptTagNode_attributes_content() { | 10915 void fail_visitHtmlScriptTagNode_attributes_content() { |
| 10886 _assertSource( | 10916 _assertSource( |
| 10887 "<script type='application/dart'>f() {}</script>", | 10917 "<script type='application/dart'>f() {}</script>", |
| 10888 HtmlFactory.scriptTagWithContent( | 10918 HtmlFactory.scriptTagWithContent( |
| 10889 "f() {}", | 10919 "f() {}", |
| 10890 [HtmlFactory.attribute("type", "'application/dart'")])); | 10920 [HtmlFactory.attribute("type", "'application/dart'")])); |
| 10891 } | 10921 } |
| 10892 | 10922 |
| 10893 void fail_visitHtmlScriptTagNode_noAttributes_content() { | 10923 void fail_visitHtmlScriptTagNode_noAttributes_content() { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10928 * @param node the AST node being visited to produce the actual source | 10958 * @param node the AST node being visited to produce the actual source |
| 10929 */ | 10959 */ |
| 10930 void _assertSource(String expectedSource, ht.XmlNode node) { | 10960 void _assertSource(String expectedSource, ht.XmlNode node) { |
| 10931 PrintStringWriter writer = new PrintStringWriter(); | 10961 PrintStringWriter writer = new PrintStringWriter(); |
| 10932 node.accept(new ht.ToSourceVisitor(writer)); | 10962 node.accept(new ht.ToSourceVisitor(writer)); |
| 10933 expect(writer.toString(), expectedSource); | 10963 expect(writer.toString(), expectedSource); |
| 10934 } | 10964 } |
| 10935 } | 10965 } |
| 10936 | 10966 |
| 10937 | 10967 |
| 10968 @ReflectiveTestCase() |
| 10938 class UriKindTest { | 10969 class UriKindTest { |
| 10939 void test_fromEncoding() { | 10970 void test_fromEncoding() { |
| 10940 expect(UriKind.fromEncoding(0x64), same(UriKind.DART_URI)); | 10971 expect(UriKind.fromEncoding(0x64), same(UriKind.DART_URI)); |
| 10941 expect(UriKind.fromEncoding(0x66), same(UriKind.FILE_URI)); | 10972 expect(UriKind.fromEncoding(0x66), same(UriKind.FILE_URI)); |
| 10942 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI)); | 10973 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI)); |
| 10943 expect(UriKind.fromEncoding(0x58), same(null)); | 10974 expect(UriKind.fromEncoding(0x58), same(null)); |
| 10944 } | 10975 } |
| 10945 | 10976 |
| 10946 void test_getEncoding() { | 10977 void test_getEncoding() { |
| 10947 expect(UriKind.DART_URI.encoding, 0x64); | 10978 expect(UriKind.DART_URI.encoding, 0x64); |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11371 } else { | 11402 } else { |
| 11372 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); | 11403 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); |
| 11373 String actualExternalScriptName = scriptSource.shortName; | 11404 String actualExternalScriptName = scriptSource.shortName; |
| 11374 expect( | 11405 expect( |
| 11375 actualExternalScriptName, | 11406 actualExternalScriptName, |
| 11376 _expectedExternalScriptName, | 11407 _expectedExternalScriptName, |
| 11377 reason: "script $scriptIndex"); | 11408 reason: "script $scriptIndex"); |
| 11378 } | 11409 } |
| 11379 } | 11410 } |
| 11380 } | 11411 } |
| OLD | NEW |