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