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