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

Unified Diff: tests/corelib/set_test.dart

Issue 26280002: Set.add returns true if item has been added, otherwise false (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: again Created 7 years, 2 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 | « sdk/lib/html/html_common/css_class_set.dart ('k') | tests/html/element_classes_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/set_test.dart
diff --git a/tests/corelib/set_test.dart b/tests/corelib/set_test.dart
index b0246f001aba9621abb7a648b6683cf997db865c..b59d7469198bb8f33d9338cb24b714ad56854239 100644
--- a/tests/corelib/set_test.dart
+++ b/tests/corelib/set_test.dart
@@ -17,15 +17,19 @@ void testInts(Set create()) {
Set set = create();
testLength(0, set);
- set.add(1);
+ Expect.isTrue(set.add(1));
testLength(1, set);
Expect.isTrue(set.contains(1));
- set.add(1);
+ Expect.isFalse(set.add(1));
testLength(1, set);
Expect.isTrue(set.contains(1));
- set.remove(1);
+ Expect.isTrue(set.remove(1));
+ testLength(0, set);
+ Expect.isFalse(set.contains(1));
+
+ Expect.isFalse(set.remove(1));
testLength(0, set);
Expect.isFalse(set.contains(1));
@@ -184,7 +188,7 @@ void testInts(Set create()) {
// Test Set.clear.
set.clear();
testLength(0, set);
- set.add(11);
+ Expect.isTrue(set.add(11));
testLength(1, set);
}
@@ -205,8 +209,8 @@ void testStrings(Set create()) {
testLength(8, set);
set.removeAll(strings.where((x) => x.length == 3));
testLength(4, set);
- set.add("bar");
- set.add("qux");
+ Expect.isTrue(set.add("bar"));
+ Expect.isTrue(set.add("qux"));
testLength(6, set);
set.addAll(strings);
testLength(8, set);
« no previous file with comments | « sdk/lib/html/html_common/css_class_set.dart ('k') | tests/html/element_classes_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698