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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012, 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 /**
6 * Provide a trivial test for identity based hashed collections, which we
7 * provide here until an implementation is available in the regular libraries.
8 */
9 // TODO(alanknight): Remove once identity-hashed collections are available.
10 // Issue 4161.
11 library identity_set_test;
12
13 import '../../unittest/lib/unittest.dart';
Jennifer Messerly 2012/11/20 01:20:47 use "package:" here if you can (maybe doesn't work
Alan Knight 2012/11/20 12:17:54 It's supposed to now, so converted all of these.
14 import '../lib/src/polyfill_identity_set.old.dart';
15
16 class Foo {
17 var x;
18 Foo(this.x);
19 int get hashCode => x.hashCode;
20 bool operator ==(a) => a.x == x;
21 }
22
23 main() {
24 test('basic', () {
25 var one = new Foo(3);
26 var two = new Foo(3);
27 var set = new Set();
28 var identitySet = new IdentitySet();
29 set..add(one)..add(two);
30 identitySet..add(one)..add(two);
31 expect(set.length, 1);
32 expect(identitySet.length, 2);
33 for (var each in identitySet) {
34 expect(each, one);
35 }
36 });
37 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698