| 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 dart2js.constants.values.test; | 5 library dart2js.constants.values.test; |
| 6 | 6 |
| 7 import 'package:async_helper/async_helper.dart'; | 7 import 'package:async_helper/async_helper.dart'; |
| 8 import 'package:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
| 9 import 'package:compiler/src/helpers/helpers.dart'; | 9 import 'package:compiler/src/helpers/helpers.dart'; |
| 10 import 'package:compiler/src/elements/elements.dart'; | 10 import 'package:compiler/src/elements/elements.dart'; |
| 11 import 'package:compiler/src/constants/values.dart'; | 11 import 'package:compiler/src/constants/values.dart'; |
| 12 import 'type_test_helper.dart'; | 12 import 'type_test_helper.dart'; |
| 13 | 13 |
| 14 void main() { | 14 void main() { |
| 15 enableDebugMode(); | 15 enableDebugMode(); |
| 16 | 16 |
| 17 asyncTest(() async { | 17 asyncTest(() async { |
| 18 TypeEnvironment env = await TypeEnvironment.create(''' | 18 TypeEnvironment env = await TypeEnvironment.create(''' |
| 19 class C { | 19 class C { |
| 20 final field1; | 20 final field1; |
| 21 final field2; | 21 final field2; |
| 22 | 22 |
| 23 C(this.field1, this.field2); | 23 C(this.field1, this.field2); |
| 24 } | 24 } |
| 25 '''); | 25 '''); |
| 26 ClassElement C = env.getElement('C'); | 26 ClassElement C = env.getElement('C'); |
| 27 FieldElement field1 = C.lookupLocalMember('field1'); | 27 FieldElement field1 = C.lookupLocalMember('field1'); |
| 28 FieldElement field2 = C.lookupLocalMember('field2'); | 28 FieldElement field2 = C.lookupLocalMember('field2'); |
| 29 ConstantValue value1 = new ConstructedConstantValue(C.rawType, { | 29 ConstantValue value1 = new ConstructedConstantValue(C.rawType, |
| 30 field1: new IntConstantValue(0), | 30 {field1: new IntConstantValue(0), field2: new IntConstantValue(1),}); |
| 31 field2: new IntConstantValue(1), | 31 ConstantValue value2 = new ConstructedConstantValue(C.rawType, |
| 32 }); | 32 {field2: new IntConstantValue(1), field1: new IntConstantValue(0),}); |
| 33 ConstantValue value2 = new ConstructedConstantValue(C.rawType, { | |
| 34 field2: new IntConstantValue(1), | |
| 35 field1: new IntConstantValue(0), | |
| 36 }); | |
| 37 Expect.equals(value1.hashCode, value2.hashCode, "Hashcode mismatch."); | 33 Expect.equals(value1.hashCode, value2.hashCode, "Hashcode mismatch."); |
| 38 Expect.equals(value1, value2, "Value mismatch."); | 34 Expect.equals(value1, value2, "Value mismatch."); |
| 39 }); | 35 }); |
| 40 } | 36 } |
| OLD | NEW |