| 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 @deprecated | 5 @deprecated |
| 6 library analyzer.test.constant_test; | 6 library analyzer.test.constant_test; |
| 7 | 7 |
| 8 import 'package:analyzer/dart/ast/ast.dart'; | 8 import 'package:analyzer/dart/ast/ast.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
| 11 import 'package:analyzer/src/generated/constant.dart'; | 11 import 'package:analyzer/src/generated/constant.dart'; |
| 12 import 'package:analyzer/src/generated/source.dart'; | 12 import 'package:analyzer/src/generated/source.dart'; |
| 13 import 'package:analyzer/src/generated/source_io.dart'; | 13 import 'package:analyzer/src/generated/source_io.dart'; |
| 14 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 14 import 'package:unittest/unittest.dart'; | 15 import 'package:unittest/unittest.dart'; |
| 15 | 16 |
| 16 import '../reflective_tests.dart'; | |
| 17 import '../utils.dart'; | 17 import '../utils.dart'; |
| 18 import 'resolver_test_case.dart'; | 18 import 'resolver_test_case.dart'; |
| 19 import 'test_support.dart'; | 19 import 'test_support.dart'; |
| 20 | 20 |
| 21 main() { | 21 main() { |
| 22 initializeTestEnvironment(); | 22 initializeTestEnvironment(); |
| 23 runReflectiveTests(ConstantEvaluatorTest); | 23 defineReflectiveTests(ConstantEvaluatorTest); |
| 24 } | 24 } |
| 25 | 25 |
| 26 @reflectiveTest | 26 @reflectiveTest |
| 27 class ConstantEvaluatorTest extends ResolverTestCase { | 27 class ConstantEvaluatorTest extends ResolverTestCase { |
| 28 void fail_constructor() { | 28 void fail_constructor() { |
| 29 EvaluationResult result = _getExpressionValue("?"); | 29 EvaluationResult result = _getExpressionValue("?"); |
| 30 expect(result.isValid, isTrue); | 30 expect(result.isValid, isTrue); |
| 31 DartObject value = result.value; | 31 DartObject value = result.value; |
| 32 expect(value, null); | 32 expect(value, null); |
| 33 } | 33 } |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 TopLevelVariableDeclaration, declaration); | 401 TopLevelVariableDeclaration, declaration); |
| 402 NodeList<VariableDeclaration> variables = | 402 NodeList<VariableDeclaration> variables = |
| 403 (declaration as TopLevelVariableDeclaration).variables.variables; | 403 (declaration as TopLevelVariableDeclaration).variables.variables; |
| 404 expect(variables, hasLength(1)); | 404 expect(variables, hasLength(1)); |
| 405 ConstantEvaluator evaluator = new ConstantEvaluator( | 405 ConstantEvaluator evaluator = new ConstantEvaluator( |
| 406 source, analysisContext.typeProvider, | 406 source, analysisContext.typeProvider, |
| 407 typeSystem: analysisContext.typeSystem); | 407 typeSystem: analysisContext.typeSystem); |
| 408 return evaluator.evaluate(variables[0].initializer); | 408 return evaluator.evaluate(variables[0].initializer); |
| 409 } | 409 } |
| 410 } | 410 } |
| OLD | NEW |