| 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/test.dart'; | 14 import 'package:test/test.dart'; |
| 15 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 15 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 16 | 16 |
| 17 import '../utils.dart'; | |
| 18 import 'resolver_test_case.dart'; | 17 import 'resolver_test_case.dart'; |
| 19 import 'test_support.dart'; | 18 import 'test_support.dart'; |
| 20 | 19 |
| 21 main() { | 20 main() { |
| 22 initializeTestEnvironment(); | |
| 23 defineReflectiveSuite(() { | 21 defineReflectiveSuite(() { |
| 24 defineReflectiveTests(ConstantEvaluatorTest); | 22 defineReflectiveTests(ConstantEvaluatorTest); |
| 25 }); | 23 }); |
| 26 } | 24 } |
| 27 | 25 |
| 28 @reflectiveTest | 26 @reflectiveTest |
| 29 class ConstantEvaluatorTest extends ResolverTestCase { | 27 class ConstantEvaluatorTest extends ResolverTestCase { |
| 30 void fail_constructor() { | 28 void fail_constructor() { |
| 31 EvaluationResult result = _getExpressionValue("?"); | 29 EvaluationResult result = _getExpressionValue("?"); |
| 32 expect(result.isValid, isTrue); | 30 expect(result.isValid, isTrue); |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 TopLevelVariableDeclaration, declaration); | 401 TopLevelVariableDeclaration, declaration); |
| 404 NodeList<VariableDeclaration> variables = | 402 NodeList<VariableDeclaration> variables = |
| 405 (declaration as TopLevelVariableDeclaration).variables.variables; | 403 (declaration as TopLevelVariableDeclaration).variables.variables; |
| 406 expect(variables, hasLength(1)); | 404 expect(variables, hasLength(1)); |
| 407 ConstantEvaluator evaluator = new ConstantEvaluator( | 405 ConstantEvaluator evaluator = new ConstantEvaluator( |
| 408 source, analysisContext.typeProvider, | 406 source, analysisContext.typeProvider, |
| 409 typeSystem: analysisContext.typeSystem); | 407 typeSystem: analysisContext.typeSystem); |
| 410 return evaluator.evaluate(variables[0].initializer); | 408 return evaluator.evaluate(variables[0].initializer); |
| 411 } | 409 } |
| 412 } | 410 } |
| OLD | NEW |