Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Unified Diff: tests/compiler/dart2js/constant_value_test.dart

Issue 2112893002: Use unordered map hash on ConstructedConstantValue. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/util/util.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/constant_value_test.dart
diff --git a/tests/compiler/dart2js/constant_value_test.dart b/tests/compiler/dart2js/constant_value_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5c5bec689f3a124ee0fa5dfd7d3ceed6c4910f10
--- /dev/null
+++ b/tests/compiler/dart2js/constant_value_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library dart2js.constants.values.test;
+
+import 'package:async_helper/async_helper.dart';
+import 'package:expect/expect.dart';
+import 'package:compiler/src/helpers/helpers.dart';
+import 'package:compiler/src/elements/elements.dart';
+import 'package:compiler/src/constants/values.dart';
+import 'type_test_helper.dart';
+
+void main() {
+ enableDebugMode();
+
+ asyncTest(() async {
+ TypeEnvironment env = await TypeEnvironment.create('''
+ class C {
+ final field1;
+ final field2;
+
+ C(this.field1, this.field2);
+ }
+ ''');
+ ClassElement C = env.getElement('C');
+ FieldElement field1 = C.lookupLocalMember('field1');
+ FieldElement field2 = C.lookupLocalMember('field2');
+ ConstantValue value1 = new ConstructedConstantValue(C.rawType, {
+ field1: new IntConstantValue(0),
+ field2: new IntConstantValue(1),
+ });
+ ConstantValue value2 = new ConstructedConstantValue(C.rawType, {
+ field2: new IntConstantValue(1),
+ field1: new IntConstantValue(0),
+ });
+ Expect.equals(value1.hashCode, value2.hashCode, "Hashcode mismatch.");
+ Expect.equals(value1, value2, "Value mismatch.");
+ });
+}
« no previous file with comments | « pkg/compiler/lib/src/util/util.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698