| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 dart2js.constants.expressions.evaluate_test; | 5 library dart2js.constants.expressions.evaluate_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
| 9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
| 10 import 'package:compiler/src/constants/evaluation.dart'; | 10 import 'package:compiler/src/constants/evaluation.dart'; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 const ConstantData('const <int>[0, 1]', const { | 72 const ConstantData('const <int>[0, 1]', const { |
| 73 const {} : 'ListConstant(<int>[IntConstant(0), IntConstant(1)])' }), | 73 const {} : 'ListConstant(<int>[IntConstant(0), IntConstant(1)])' }), |
| 74 const ConstantData('const {0: 1, 2: 3}', | 74 const ConstantData('const {0: 1, 2: 3}', |
| 75 const { const {} : | 75 const { const {} : |
| 76 'MapConstant({IntConstant(0): IntConstant(1), ' | 76 'MapConstant({IntConstant(0): IntConstant(1), ' |
| 77 'IntConstant(2): IntConstant(3)})' }), | 77 'IntConstant(2): IntConstant(3)})' }), |
| 78 const ConstantData('const <int, int>{0: 1, 2: 3}', | 78 const ConstantData('const <int, int>{0: 1, 2: 3}', |
| 79 const { const {} : | 79 const { const {} : |
| 80 'MapConstant(<int, int>{IntConstant(0): IntConstant(1), ' | 80 'MapConstant(<int, int>{IntConstant(0): IntConstant(1), ' |
| 81 'IntConstant(2): IntConstant(3)})' }), | 81 'IntConstant(2): IntConstant(3)})' }), |
| 82 const ConstantData('const <int, int>{0: 1, 0: 2}', |
| 83 const { const {} : |
| 84 'MapConstant(<int, int>{IntConstant(0): IntConstant(2)})' }), |
| 82 const ConstantData( | 85 const ConstantData( |
| 83 'const bool.fromEnvironment("foo", defaultValue: false)', | 86 'const bool.fromEnvironment("foo", defaultValue: false)', |
| 84 const { const {} : 'BoolConstant(false)', | 87 const { const {} : 'BoolConstant(false)', |
| 85 const {'foo': 'true'} : 'BoolConstant(true)'}), | 88 const {'foo': 'true'} : 'BoolConstant(true)'}), |
| 86 const ConstantData( | 89 const ConstantData( |
| 87 'const int.fromEnvironment("foo", defaultValue: 42)', | 90 'const int.fromEnvironment("foo", defaultValue: 42)', |
| 88 const { const {} : 'IntConstant(42)', | 91 const { const {} : 'IntConstant(42)', |
| 89 const {'foo': '87'} : 'IntConstant(87)'}), | 92 const {'foo': '87'} : 'IntConstant(87)'}), |
| 90 const ConstantData( | 93 const ConstantData( |
| 91 'const String.fromEnvironment("foo", defaultValue: "bar")', | 94 'const String.fromEnvironment("foo", defaultValue: "bar")', |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 Environment environment = new MemoryEnvironment(compiler, env); | 240 Environment environment = new MemoryEnvironment(compiler, env); |
| 238 ConstantValue value = | 241 ConstantValue value = |
| 239 constant.evaluate(environment, DART_CONSTANT_SYSTEM); | 242 constant.evaluate(environment, DART_CONSTANT_SYSTEM); |
| 240 String valueText = value.toStructuredText(); | 243 String valueText = value.toStructuredText(); |
| 241 Expect.equals(expectedText, valueText, | 244 Expect.equals(expectedText, valueText, |
| 242 "Unexpected value '${valueText}' for contant " | 245 "Unexpected value '${valueText}' for contant " |
| 243 "`${constant.toDartText()}`, expected '${expectedText}'."); | 246 "`${constant.toDartText()}`, expected '${expectedText}'."); |
| 244 }); | 247 }); |
| 245 }); | 248 }); |
| 246 } | 249 } |
| OLD | NEW |