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

Side by Side Diff: third_party/pkg/route_hierarchical/lib/url_matcher.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, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 library url_matcher;
2
3 import 'package:unittest/matcher.dart';
4
5 /**
6 * A reversible URL matcher interface.
7 */
8 abstract class UrlMatcher {
9
10 /**
11 * Attempts to match a given URL. If match is successul then returns an
12 * instance or [UrlMatch], otherwise returns [null].
13 */
14 UrlMatch match(String url);
15
16 /**
17 * Reverses (reconstructs) a URL from optionally provided parameters map
18 * and a tail.
19 */
20 String reverse({Map parameters, String tail});
21
22 /**
23 * Returns a list of named parameters in the URL.
24 */
25 List<String> urlParameterNames();
26 }
27
28 /**
29 * Object representing a successul URL match.
30 */
31 class UrlMatch {
32
33 /// Matched section of the URL
34 final String match;
35
36 /// Remaining unmatched suffix
37 final String tail;
38
39 ///
40 final Map parameters;
41
42 UrlMatch(this.match, this.tail, this.parameters);
43
44 bool operator ==(o) {
45 if (!(o is UrlMatch)) {
46 return false;
47 }
48 return o.match == match && o.tail == tail &&
49 equals(o.parameters, 1).matches(parameters, null);
50 }
51
52 String toString() {
53 return '{$match, $tail, $parameters}';
54 }
55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698