OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /// Unit tests for doc. | 5 /// Unit tests for doc. |
6 #library('dartdoc_tests'); | 6 #library('dartdoc_tests'); |
7 | 7 |
8 // TODO(rnystrom): Use "package:" URL (#4968). | 8 // TODO(rnystrom): Use "package:" URL (#4968). |
9 #import('../lib/dartdoc.dart', prefix: 'dd'); | 9 #import('../lib/dartdoc.dart', prefix: 'dd'); |
10 #import('../lib/markdown.dart', prefix: 'md'); | 10 #import('../lib/markdown.dart', prefix: 'md'); |
11 | 11 #import('../../unittest/lib/unittest.dart'); |
12 // TODO(rnystrom): Better path to unittest. | |
13 #import('../../unittest/unittest.dart'); | |
14 | 12 |
15 main() { | 13 main() { |
16 group('countOccurrences', () { | 14 group('countOccurrences', () { |
17 test('empty text returns 0', () { | 15 test('empty text returns 0', () { |
18 expect(dd.countOccurrences('', 'needle'), equals(0)); | 16 expect(dd.countOccurrences('', 'needle'), equals(0)); |
19 }); | 17 }); |
20 | 18 |
21 test('one occurrence', () { | 19 test('one occurrence', () { |
22 expect(dd.countOccurrences('bananarama', 'nara'), equals(1)); | 20 expect(dd.countOccurrences('bananarama', 'nara'), equals(1)); |
23 }); | 21 }); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 '../../other/sub/file.html')); | 108 '../../other/sub/file.html')); |
111 }); | 109 }); |
112 | 110 |
113 test('from nested to directory with different path', () { | 111 test('from nested to directory with different path', () { |
114 doc.startFile('dir/sub/file.html'); | 112 doc.startFile('dir/sub/file.html'); |
115 expect(doc.relativePath('other/file.html'), equals( | 113 expect(doc.relativePath('other/file.html'), equals( |
116 '../../other/file.html')); | 114 '../../other/file.html')); |
117 }); | 115 }); |
118 }); | 116 }); |
119 } | 117 } |
OLD | NEW |