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 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
(...skipping 16 matching lines...) Expand all Loading... |
27 import 'package:analyzer/src/generated/sdk_io.dart'; | 27 import 'package:analyzer/src/generated/sdk_io.dart'; |
28 import 'package:analyzer/src/generated/source.dart'; | 28 import 'package:analyzer/src/generated/source.dart'; |
29 import 'package:analyzer/src/generated/source_io.dart'; | 29 import 'package:analyzer/src/generated/source_io.dart'; |
30 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 30 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
31 import 'package:analyzer/src/generated/testing/element_factory.dart'; | 31 import 'package:analyzer/src/generated/testing/element_factory.dart'; |
32 import 'package:analyzer/src/generated/testing/html_factory.dart'; | 32 import 'package:analyzer/src/generated/testing/html_factory.dart'; |
33 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; | 33 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; |
34 import 'package:analyzer/src/generated/utilities_collection.dart'; | 34 import 'package:analyzer/src/generated/utilities_collection.dart'; |
35 import 'package:analyzer/src/generated/utilities_dart.dart'; | 35 import 'package:analyzer/src/generated/utilities_dart.dart'; |
36 import 'package:analyzer/src/task/dart.dart'; | 36 import 'package:analyzer/src/task/dart.dart'; |
37 import 'package:path/src/context.dart'; | 37 import 'package:path/path.dart'; |
38 import 'package:unittest/unittest.dart'; | 38 import 'package:unittest/unittest.dart'; |
39 | 39 |
40 import '../reflective_tests.dart'; | 40 import '../reflective_tests.dart'; |
41 import 'engine_test.dart'; | 41 import 'engine_test.dart'; |
42 import 'parser_test.dart'; | 42 import 'parser_test.dart'; |
43 import 'resolver_test.dart'; | 43 import 'resolver_test.dart'; |
44 import 'test_support.dart'; | 44 import 'test_support.dart'; |
45 | 45 |
46 main() { | 46 main() { |
47 groupSep = ' | '; | 47 groupSep = ' | '; |
(...skipping 2451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2499 _assertValue(3, _evaluateConstant(compilationUnit, "a", null)); | 2499 _assertValue(3, _evaluateConstant(compilationUnit, "a", null)); |
2500 } | 2500 } |
2501 | 2501 |
2502 void _assertValue(int expectedValue, DartObjectImpl result) { | 2502 void _assertValue(int expectedValue, DartObjectImpl result) { |
2503 expect(result, isNotNull); | 2503 expect(result, isNotNull); |
2504 expect(result.type.name, "int"); | 2504 expect(result.type.name, "int"); |
2505 expect(result.intValue, expectedValue); | 2505 expect(result.intValue, expectedValue); |
2506 } | 2506 } |
2507 | 2507 |
2508 NonExistingSource _dummySource() { | 2508 NonExistingSource _dummySource() { |
2509 return new NonExistingSource("foo.dart", UriKind.FILE_URI); | 2509 String path = '/test.dart'; |
| 2510 return new NonExistingSource(path, toUri(path), UriKind.FILE_URI); |
2510 } | 2511 } |
2511 | 2512 |
2512 DartObjectImpl _evaluateConstant(CompilationUnit compilationUnit, String name, | 2513 DartObjectImpl _evaluateConstant(CompilationUnit compilationUnit, String name, |
2513 Map<String, DartObjectImpl> lexicalEnvironment) { | 2514 Map<String, DartObjectImpl> lexicalEnvironment) { |
2514 Source source = compilationUnit.element.source; | 2515 Source source = compilationUnit.element.source; |
2515 Expression expression = | 2516 Expression expression = |
2516 findTopLevelConstantExpression(compilationUnit, name); | 2517 findTopLevelConstantExpression(compilationUnit, name); |
2517 GatheringErrorListener errorListener = new GatheringErrorListener(); | 2518 GatheringErrorListener errorListener = new GatheringErrorListener(); |
2518 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); | 2519 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); |
2519 DartObjectImpl result = expression.accept(new ConstantVisitor( | 2520 DartObjectImpl result = expression.accept(new ConstantVisitor( |
(...skipping 4102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6622 StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER, | 6623 StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER, |
6623 element, ['A']); | 6624 element, ['A']); |
6624 AnalysisError error = listener.errors[0]; | 6625 AnalysisError error = listener.errors[0]; |
6625 expect(error.offset, element.nameOffset); | 6626 expect(error.offset, element.nameOffset); |
6626 } | 6627 } |
6627 | 6628 |
6628 void test_reportErrorForElement_unnamed() { | 6629 void test_reportErrorForElement_unnamed() { |
6629 ImportElementImpl element = | 6630 ImportElementImpl element = |
6630 ElementFactory.importFor(ElementFactory.library(null, ''), null); | 6631 ElementFactory.importFor(ElementFactory.library(null, ''), null); |
6631 GatheringErrorListener listener = new GatheringErrorListener(); | 6632 GatheringErrorListener listener = new GatheringErrorListener(); |
6632 ErrorReporter reporter = new ErrorReporter( | 6633 ErrorReporter reporter = new ErrorReporter(listener, new NonExistingSource( |
6633 listener, new NonExistingSource("/test.dart", UriKind.FILE_URI)); | 6634 '/test.dart', toUri('/test.dart'), UriKind.FILE_URI)); |
6634 reporter.reportErrorForElement( | 6635 reporter.reportErrorForElement( |
6635 StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER, | 6636 StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER, |
6636 element, ['A']); | 6637 element, ['A']); |
6637 AnalysisError error = listener.errors[0]; | 6638 AnalysisError error = listener.errors[0]; |
6638 expect(error.offset, element.nameOffset); | 6639 expect(error.offset, element.nameOffset); |
6639 } | 6640 } |
6640 | 6641 |
6641 void test_reportTypeErrorForNode_differentNames() { | 6642 void test_reportTypeErrorForNode_differentNames() { |
6642 DartType firstType = createType("/test1.dart", "A"); | 6643 DartType firstType = createType("/test1.dart", "A"); |
6643 DartType secondType = createType("/test2.dart", "B"); | 6644 DartType secondType = createType("/test2.dart", "B"); |
(...skipping 2022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8666 if (_expectedExternalScriptName == null) { | 8667 if (_expectedExternalScriptName == null) { |
8667 expect(scriptSource, isNull, reason: "script $scriptIndex"); | 8668 expect(scriptSource, isNull, reason: "script $scriptIndex"); |
8668 } else { | 8669 } else { |
8669 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); | 8670 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); |
8670 String actualExternalScriptName = scriptSource.shortName; | 8671 String actualExternalScriptName = scriptSource.shortName; |
8671 expect(actualExternalScriptName, _expectedExternalScriptName, | 8672 expect(actualExternalScriptName, _expectedExternalScriptName, |
8672 reason: "script $scriptIndex"); | 8673 reason: "script $scriptIndex"); |
8673 } | 8674 } |
8674 } | 8675 } |
8675 } | 8676 } |
OLD | NEW |