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

Unified Diff: tests/corelib/splay_tree_test.dart

Issue 274563008: Fix bug in SplayTreeSet when removeWhere removes all elements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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/collection/splay_tree.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/splay_tree_test.dart
diff --git a/tests/corelib/splay_tree_test.dart b/tests/corelib/splay_tree_test.dart
index ee3083df577fc02a6a90d0514e0950e959e56cc9..2557b54012197fe6c6cf0693f20a04e9f78a79ec 100644
--- a/tests/corelib/splay_tree_test.dart
+++ b/tests/corelib/splay_tree_test.dart
@@ -51,6 +51,7 @@ main() {
Expect.equals(7, tree.firstKeyAfter(6));
regressRemoveWhere();
+ regressRemoveWhere2();
}
void regressRemoveWhere() {
@@ -65,3 +66,16 @@ void regressRemoveWhere() {
return x.isOdd;
});
}
+
+void regressRemoveWhere2() {
+ // Regression test for http://dartbug.com/18676
+ // Removing all elements with removeWhere causes error.
+
+ var t = new SplayTreeSet();
+ t.addAll([1,2,3,4,5]);
+ t.removeWhere((_) => true); // Should not throw.
+ Expect.isTrue(t.isEmpty);
+ t.addAll([1,2,3,4,5]);
+ t.retainWhere((_) => false); // Should not throw.
+ Expect.isTrue(t.isEmpty);
+}
« no previous file with comments | « sdk/lib/collection/splay_tree.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698