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

Unified Diff: pkg/serialization/test/polyfill_identity_set_test.dart

Issue 11293283: Initial version of a serialization framework (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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
Index: pkg/serialization/test/polyfill_identity_set_test.dart
===================================================================
--- pkg/serialization/test/polyfill_identity_set_test.dart (revision 0)
+++ pkg/serialization/test/polyfill_identity_set_test.dart (revision 0)
@@ -0,0 +1,37 @@
+// Copyright (c) 2012, 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.
+
+/**
+ * Provide a trivial test for identity based hashed collections, which we
+ * provide here until an implementation is available in the regular libraries.
+ */
+// TODO(alanknight): Remove once identity-hashed collections are available.
+// Issue 4161.
+library identity_set_test;
+
+import '../../unittest/lib/unittest.dart';
Jennifer Messerly 2012/11/15 08:02:14 can this be imported with package:?
Alan Knight 2012/11/15 20:51:03 As I understand it, not until we've got the situat
+import '../lib/src/polyfill_identity_set.dart';
Jennifer Messerly 2012/11/15 08:02:14 likewise, using the self-link? 'package:serializa
+
+class Foo {
+ var x;
+ Foo(this.x);
+ int get hashCode => x.hashCode;
+ bool operator ==(a) => a.x == x;
+}
+
+main() {
+ test('basic', () {
+ var one = new Foo(3);
+ var two = new Foo(3);
+ var set = new Set();
+ var identitySet = new IdentitySet();
+ set..add(one)..add(two);
+ identitySet..add(one)..add(two);
+ expect(set.length, 1);
+ expect(identitySet.length, 2);
+ for (var each in identitySet) {
+ expect(each, one);
+ }
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698