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

Unified Diff: packages/path/test/utils.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 5 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 | « packages/path/test/url_test.dart ('k') | packages/path/test/windows_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/path/test/utils.dart
diff --git a/packages/path/test/utils.dart b/packages/path/test/utils.dart
index 7d917a0be99fccad9fd9edb16aca73e5fbd47b34..5e22ce1f31777b69338df23d781967d3b5f7bc62 100644
--- a/packages/path/test/utils.dart
+++ b/packages/path/test/utils.dart
@@ -2,10 +2,31 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library path.test.utils;
-
import "package:test/test.dart";
-import "package:path/path.dart" as path;
+import "package:path/path.dart" as p;
/// A matcher for a closure that throws a [path.PathException].
-final throwsPathException = throwsA(new isInstanceOf<path.PathException>());
+final throwsPathException = throwsA(new isInstanceOf<p.PathException>());
+
+void expectEquals(p.Context context, String path1, String path2) {
+ expect(context.equals(path1, path2), isTrue,
+ reason: 'Expected "$path1" to equal "$path2".');
+ expect(context.equals(path2, path1), isTrue,
+ reason: 'Expected "$path2" to equal "$path1".');
+ expect(context.hash(path1), equals(context.hash(path2)),
+ reason: 'Expected "$path1" to hash the same as "$path2".');
+}
+
+void expectNotEquals(p.Context context, String path1, String path2,
+ {bool allowSameHash: false}) {
+ expect(context.equals(path1, path2), isFalse,
+ reason: 'Expected "$path1" not to equal "$path2".');
+ expect(context.equals(path2, path1), isFalse,
+ reason: 'Expected "$path2" not to equal "$path1".');
+
+ // Hash collisions are allowed, but the test author should be explicitly aware
+ // when they occur.
+ if (allowSameHash) return;
+ expect(context.hash(path1), isNot(equals(context.hash(path2))),
+ reason: 'Expected "$path1" not to hash the same as "$path2".');
+}
« no previous file with comments | « packages/path/test/url_test.dart ('k') | packages/path/test/windows_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698