| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer.test.constant_test; | 5 library analyzer.test.constant_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
| 9 import 'package:analyzer/dart/element/type.dart'; | 9 import 'package:analyzer/dart/element/type.dart'; |
| 10 import 'package:analyzer/src/dart/element/element.dart'; | 10 import 'package:analyzer/src/dart/element/element.dart'; |
| 11 import 'package:analyzer/src/generated/constant.dart'; | 11 import 'package:analyzer/src/generated/constant.dart'; |
| 12 import 'package:analyzer/src/generated/engine.dart'; | 12 import 'package:analyzer/src/generated/engine.dart'; |
| 13 import 'package:analyzer/src/generated/error.dart'; | 13 import 'package:analyzer/src/generated/error.dart'; |
| 14 import 'package:analyzer/src/generated/java_core.dart'; | |
| 15 import 'package:analyzer/src/generated/resolver.dart'; | 14 import 'package:analyzer/src/generated/resolver.dart'; |
| 16 import 'package:analyzer/src/generated/scanner.dart'; | 15 import 'package:analyzer/src/generated/scanner.dart'; |
| 17 import 'package:analyzer/src/generated/source.dart'; | 16 import 'package:analyzer/src/generated/source.dart'; |
| 18 import 'package:analyzer/src/generated/source_io.dart'; | 17 import 'package:analyzer/src/generated/source_io.dart'; |
| 19 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 18 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
| 20 import 'package:analyzer/src/generated/testing/element_factory.dart'; | 19 import 'package:analyzer/src/generated/testing/element_factory.dart'; |
| 21 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; | 20 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; |
| 22 import 'package:analyzer/src/generated/utilities_collection.dart'; | 21 import 'package:analyzer/src/generated/utilities_collection.dart'; |
| 23 import 'package:analyzer/src/task/dart.dart'; | 22 import 'package:analyzer/src/task/dart.dart'; |
| 24 import 'package:path/path.dart'; | 23 import 'package:path/path.dart'; |
| 25 import 'package:unittest/unittest.dart'; | 24 import 'package:unittest/unittest.dart'; |
| 26 | 25 |
| 27 import '../reflective_tests.dart'; | 26 import '../reflective_tests.dart'; |
| 28 import '../utils.dart'; | 27 import '../utils.dart'; |
| 29 import 'engine_test.dart'; | 28 import 'engine_test.dart'; |
| 30 import 'resolver_test.dart'; | 29 import 'resolver_test.dart'; |
| 31 import 'test_support.dart'; | 30 import 'test_support.dart'; |
| 32 | 31 |
| 32 const int LONG_MAX_VALUE = 0x7fffffffffffffff; |
| 33 |
| 33 main() { | 34 main() { |
| 34 initializeTestEnvironment(); | 35 initializeTestEnvironment(); |
| 35 runReflectiveTests(ConstantEvaluatorTest); | 36 runReflectiveTests(ConstantEvaluatorTest); |
| 36 runReflectiveTests(ConstantFinderTest); | 37 runReflectiveTests(ConstantFinderTest); |
| 37 runReflectiveTests(ConstantValueComputerTest); | 38 runReflectiveTests(ConstantValueComputerTest); |
| 38 runReflectiveTests(ConstantVisitorTest); | 39 runReflectiveTests(ConstantVisitorTest); |
| 39 runReflectiveTests(DartObjectImplTest); | 40 runReflectiveTests(DartObjectImplTest); |
| 40 runReflectiveTests(DeclaredVariablesTest); | 41 runReflectiveTests(DeclaredVariablesTest); |
| 41 runReflectiveTests(ReferenceFinderTest); | 42 runReflectiveTests(ReferenceFinderTest); |
| 42 } | 43 } |
| (...skipping 4163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4206 expect(result, expected); | 4207 expect(result, expected); |
| 4207 } | 4208 } |
| 4208 } | 4209 } |
| 4209 | 4210 |
| 4210 /** | 4211 /** |
| 4211 * Assert that the result of multiplying the left and right operands is the ex
pected value, or | 4212 * Assert that the result of multiplying the left and right operands is the ex
pected value, or |
| 4212 * that the operation throws an exception if the expected value is `null`. | 4213 * that the operation throws an exception if the expected value is `null`. |
| 4213 * | 4214 * |
| 4214 * @param expected the expected result of the operation | 4215 * @param expected the expected result of the operation |
| 4215 * @param leftOperand the left operand to the operation | 4216 * @param leftOperand the left operand to the operation |
| 4216 * @param rightOperand the left operand to the operation | 4217 * @param rightOperand the right operand to the operation |
| 4217 * @throws EvaluationException if the result is an exception when it should no
t be | 4218 * @throws EvaluationException if the result is an exception when it should no
t be |
| 4218 */ | 4219 */ |
| 4219 void _assertShiftRight(DartObjectImpl expected, DartObjectImpl leftOperand, | 4220 void _assertShiftRight(DartObjectImpl expected, DartObjectImpl leftOperand, |
| 4220 DartObjectImpl rightOperand) { | 4221 DartObjectImpl rightOperand) { |
| 4221 if (expected == null) { | 4222 if (expected == null) { |
| 4222 try { | 4223 try { |
| 4223 leftOperand.shiftRight(_typeProvider, rightOperand); | 4224 leftOperand.shiftRight(_typeProvider, rightOperand); |
| 4224 fail("Expected an EvaluationException"); | 4225 fail("Expected an EvaluationException"); |
| 4225 } on EvaluationException {} | 4226 } on EvaluationException {} |
| 4226 } else { | 4227 } else { |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4530 | 4531 |
| 4531 void _visitNode(AstNode node) { | 4532 void _visitNode(AstNode node) { |
| 4532 node.accept(_createReferenceFinder(_head)); | 4533 node.accept(_createReferenceFinder(_head)); |
| 4533 } | 4534 } |
| 4534 } | 4535 } |
| 4535 | 4536 |
| 4536 class _TestAnalysisContext extends TestAnalysisContext { | 4537 class _TestAnalysisContext extends TestAnalysisContext { |
| 4537 @override | 4538 @override |
| 4538 InternalAnalysisContext getContextFor(Source source) => this; | 4539 InternalAnalysisContext getContextFor(Source source) => this; |
| 4539 } | 4540 } |
| OLD | NEW |