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

Unified Diff: third_party/pkg/route_hierarchical/test/pattern_test.dart

Issue 124053002: Adding Angular and dependent packages for testing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 12 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
Index: third_party/pkg/route_hierarchical/test/pattern_test.dart
diff --git a/third_party/pkg/route_hierarchical/test/pattern_test.dart b/third_party/pkg/route_hierarchical/test/pattern_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..bf9acece03fcaf4a53c0ef4d09852a2fc995b017
--- /dev/null
+++ b/third_party/pkg/route_hierarchical/test/pattern_test.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+import 'package:unittest/unittest.dart';
+import 'package:route_hierarchical/pattern.dart';
+
+main() {
+ test('matchAny', () {
+ var p = matchAny(['a', 'b'], exclude: ['ac', 'aa']);
+ expect(p.allMatches('a').map(matchValue), ['a']);
+ expect(p.allMatches('ab').map(matchValue), ['a', 'b']);
+ expect(p.allMatches('aa').map(matchValue), []);
+ expect(p.allMatches('bb').map(matchValue), ['b', 'b']);
+ expect(p.allMatches('aca').map(matchValue), []);
+ });
+
+ test('matchesFull', () {
+ expect(matchesFull('a', 'aa'), false);
+ expect(matchesFull('aa', 'aa'), true);
+ });
+}
+
+String matchValue(Match m) => m.input.substring(m.start, m.end);

Powered by Google App Engine
This is Rietveld 408576698