OLD | NEW |
| (Empty) |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 library route.pattern_test; | |
5 | |
6 import 'package:unittest/unittest.dart'; | |
7 import 'package:route_hierarchical/pattern.dart'; | |
8 | |
9 main() { | |
10 test('matchAny', () { | |
11 var p = matchAny(['a', 'b'], exclude: ['ac', 'aa']); | |
12 expect(p.allMatches('a').map(matchValue), ['a']); | |
13 expect(p.allMatches('ab').map(matchValue), ['a', 'b']); | |
14 expect(p.allMatches('aa').map(matchValue), []); | |
15 expect(p.allMatches('bb').map(matchValue), ['b', 'b']); | |
16 expect(p.allMatches('aca').map(matchValue), []); | |
17 }); | |
18 | |
19 test('matchesFull', () { | |
20 expect(matchesFull('a', 'aa'), false); | |
21 expect(matchesFull('aa', 'aa'), true); | |
22 }); | |
23 } | |
24 | |
25 String matchValue(Match m) => m.input.substring(m.start, m.end); | |
OLD | NEW |