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

Side by Side Diff: third_party/pkg/route_hierarchical/test/url_template_test.dart

Issue 180843004: Revert revision 33053 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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
« no previous file with comments | « third_party/pkg/route_hierarchical/test/client_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 library url_template_test; 1 library url_template_test;
2 2
3 import 'package:unittest/unittest.dart'; 3 import 'package:unittest/unittest.dart';
4 import 'package:route_hierarchical/url_template.dart'; 4 import 'package:route_hierarchical/url_template.dart';
5 import 'package:route_hierarchical/url_matcher.dart'; 5 import 'package:route_hierarchical/url_matcher.dart';
6 6
7 main() { 7 main() {
8 group('UrlTemplate', () { 8 group('UrlTemplate', () {
9 test('should work with simple templates', () { 9 test('should work with simple templates', () {
10 var tmpl = new UrlTemplate('/foo/bar:baz/aux'); 10 var tmpl = new UrlTemplate('/foo/bar:baz/aux');
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 'foo': '123' 52 'foo': '123'
53 })); 53 }));
54 }); 54 });
55 55
56 test('should only match prefix', () { 56 test('should only match prefix', () {
57 var tmpl = new UrlTemplate(r'/foo'); 57 var tmpl = new UrlTemplate(r'/foo');
58 expect(tmpl.match(r'/foo/foo/bar'), 58 expect(tmpl.match(r'/foo/foo/bar'),
59 new UrlMatch(r'/foo', '/foo/bar', {})); 59 new UrlMatch(r'/foo', '/foo/bar', {}));
60 }); 60 });
61 61
62 test('should match without leading slashes', () {
63 var tmpl = new UrlTemplate(r'foo');
64 expect(tmpl.match(r'foo'),
65 new UrlMatch(r'foo', '', {}));
66 });
67
68 test('should reverse', () { 62 test('should reverse', () {
69 var tmpl = new UrlTemplate('/:a/:b/:c'); 63 var tmpl = new UrlTemplate('/:a/:b/:c');
70 expect(tmpl.reverse(), '/null/null/null'); 64 expect(tmpl.reverse(), '/null/null/null');
71 expect(tmpl.reverse(parameters: { 65 expect(tmpl.reverse(parameters: {
72 'a': 'foo', 66 'a': 'foo',
73 'b': 'bar', 67 'b': 'bar',
74 'c': 'baz' 68 'c': 'baz'
75 }), '/foo/bar/baz'); 69 }), '/foo/bar/baz');
76 70
77 tmpl = new UrlTemplate(':a/bar/baz'); 71 tmpl = new UrlTemplate(':a/bar/baz');
78 expect(tmpl.reverse(), 'null/bar/baz'); 72 expect(tmpl.reverse(), 'null/bar/baz');
79 expect(tmpl.reverse(parameters: { 73 expect(tmpl.reverse(parameters: {
80 'a': '/foo', 74 'a': '/foo',
81 }), '/foo/bar/baz'); 75 }), '/foo/bar/baz');
82 76
83 tmpl = new UrlTemplate('/foo/bar/:c'); 77 tmpl = new UrlTemplate('/foo/bar/:c');
84 expect(tmpl.reverse(), '/foo/bar/null'); 78 expect(tmpl.reverse(), '/foo/bar/null');
85 expect(tmpl.reverse(parameters: { 79 expect(tmpl.reverse(parameters: {
86 'c': 'baz', 80 'c': 'baz',
87 }), '/foo/bar/baz'); 81 }), '/foo/bar/baz');
88 82
89 tmpl = new UrlTemplate('/foo/bar/:c'); 83 tmpl = new UrlTemplate('/foo/bar/:c');
90 expect(tmpl.reverse(tail: '/tail', parameters: { 84 expect(tmpl.reverse(tail: '/tail', parameters: {
91 'c': 'baz', 85 'c': 'baz',
92 }), '/foo/bar/baz/tail'); 86 }), '/foo/bar/baz/tail');
93 }); 87 });
94 }); 88 });
95 } 89 }
OLDNEW
« no previous file with comments | « third_party/pkg/route_hierarchical/test/client_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698