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

Unified Diff: pkg/matcher/test/core_matchers_test.dart

Issue 327213003: Compare sets order-independently in pkg/matcher. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | « pkg/matcher/pubspec.yaml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/matcher/test/core_matchers_test.dart
diff --git a/pkg/matcher/test/core_matchers_test.dart b/pkg/matcher/test/core_matchers_test.dart
index 3f694f31c49a8739236d5b4a319ec217f0a7a786..c7644a292a37ef08bf26098214f7a097d535528c 100644
--- a/pkg/matcher/test/core_matchers_test.dart
+++ b/pkg/matcher/test/core_matchers_test.dart
@@ -47,6 +47,24 @@ void main() {
shouldPass(a, equals(b));
});
+ test('equals with a set', () {
+ var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
+ var set1 = numbers.toSet();
+ numbers.shuffle();
+ var set2 = numbers.toSet();
+
+ shouldPass(set2, equals(set1));
+ shouldPass(numbers, equals(set1));
+ shouldFail([1, 2, 3, 4, 5, 6, 7, 8, 9], equals(set1),
+ "Expected: ?:[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n"
+ " Actual: [1, 2, 3, 4, 5, 6, 7, 8, 9]\n"
+ " Which: does not contain 10");
+ shouldFail([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], equals(set1),
+ "Expected: ?:[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n"
+ " Actual: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]\n"
+ " Which: larger than expected");
+ });
+
test('anything', () {
var a = new Map();
shouldPass(0, anything);
« no previous file with comments | « pkg/matcher/pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698