OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 ElementTest; | 5 library ElementTest; |
6 import '../../pkg/unittest/lib/unittest.dart'; | 6 import '../../pkg/unittest/lib/unittest.dart'; |
7 import '../../pkg/unittest/lib/html_config.dart'; | 7 import '../../pkg/unittest/lib/html_config.dart'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 | 9 |
10 main() { | 10 main() { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 test('iterator', () { | 61 test('iterator', () { |
62 final classes = <String>[]; | 62 final classes = <String>[]; |
63 for (var el in makeClassSet()) { | 63 for (var el in makeClassSet()) { |
64 classes.add(el); | 64 classes.add(el); |
65 } | 65 } |
66 expect(classes, unorderedEquals(['foo', 'bar', 'baz'])); | 66 expect(classes, unorderedEquals(['foo', 'bar', 'baz'])); |
67 }); | 67 }); |
68 | 68 |
69 test('mappedBy', () { | 69 test('mappedBy', () { |
70 expect(makeClassSet().mappedBy((c) => c.toUpperCase()).toList(), | 70 expect(makeClassSet().map((c) => c.toUpperCase()).toList(), |
71 unorderedEquals(['FOO', 'BAR', 'BAZ'])); | 71 unorderedEquals(['FOO', 'BAR', 'BAZ'])); |
72 }); | 72 }); |
73 | 73 |
74 test('where', () { | 74 test('where', () { |
75 expect(makeClassSet().where((c) => c.contains('a')).toSet(), | 75 expect(makeClassSet().where((c) => c.contains('a')).toSet(), |
76 unorderedEquals(['bar', 'baz'])); | 76 unorderedEquals(['bar', 'baz'])); |
77 }); | 77 }); |
78 | 78 |
79 test('every', () { | 79 test('every', () { |
80 expect(makeClassSet().every((c) => c is String), isTrue); | 80 expect(makeClassSet().every((c) => c is String), isTrue); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 expect(classes.intersection(['foo', 'qux', 'baz']), | 159 expect(classes.intersection(['foo', 'qux', 'baz']), |
160 unorderedEquals(['foo', 'baz'])); | 160 unorderedEquals(['foo', 'baz'])); |
161 }); | 161 }); |
162 | 162 |
163 test('clear', () { | 163 test('clear', () { |
164 final classes = makeClassSet(); | 164 final classes = makeClassSet(); |
165 classes.clear(); | 165 classes.clear(); |
166 expect(classes, equals([])); | 166 expect(classes, equals([])); |
167 }); | 167 }); |
168 } | 168 } |
OLD | NEW |