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 #import('../../../dartdoc/dartdoc.dart', prefix: 'dd'); | 8 #import('../../../lib/dartdoc/dartdoc.dart', prefix: 'dd'); |
9 #import('../../../dartdoc/markdown.dart', prefix: 'md'); | 9 #import('../../../lib/dartdoc/markdown.dart', prefix: 'md'); |
10 | 10 |
11 // TODO(rnystrom): Better path to unittest. | 11 // TODO(rnystrom): Better path to unittest. |
12 #import('../../../../client/testing/unittest/unittest_vm.dart'); | 12 #import('../../../client/testing/unittest/unittest_vm.dart'); |
13 #import('../../../../frog/lang.dart'); | 13 #import('../../../frog/lang.dart'); |
14 #import('../../../../frog/file_system_vm.dart'); | 14 #import('../../../frog/file_system_vm.dart'); |
15 | 15 |
16 main() { | 16 main() { |
17 var files = new VMFileSystem(); | 17 var files = new VMFileSystem(); |
18 parseOptions('../../frog', [], files); | 18 parseOptions('../../frog', [], files); |
19 initializeWorld(files); | 19 initializeWorld(files); |
20 | 20 |
21 group('countOccurrences', () { | 21 group('countOccurrences', () { |
22 test('empty text returns 0', () { | 22 test('empty text returns 0', () { |
23 expect(dd.countOccurrences('', 'needle')).equals(0); | 23 expect(dd.countOccurrences('', 'needle')).equals(0); |
24 }); | 24 }); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 test('from nested to directory with different path', () { | 119 test('from nested to directory with different path', () { |
120 doc.startFile('dir/sub/file.html'); | 120 doc.startFile('dir/sub/file.html'); |
121 expect(doc.relativePath('other/file.html')).equals( | 121 expect(doc.relativePath('other/file.html')).equals( |
122 '../../other/file.html'); | 122 '../../other/file.html'); |
123 }); | 123 }); |
124 }); | 124 }); |
125 | 125 |
126 group('name reference', () { | 126 group('name reference', () { |
127 // TODO(rnystrom): The paths here are a bit strange. They're relative to | 127 // TODO(rnystrom): The paths here are a bit strange. They're relative to |
128 // where test.dart happens to be invoked from. | 128 // where test.dart happens to be invoked from. |
129 final dummyPath = 'utils/tests/dartdoc/src/dummy.dart'; | 129 final dummyPath = 'tests/utils/src/dummy.dart'; |
130 | 130 |
131 // TODO(rnystrom): Bail if we couldn't find the test file. The problem is | 131 // TODO(rnystrom): Bail if we couldn't find the test file. The problem is |
132 // that loading dummy.dart is sensitive to the location that dart was | 132 // that loading dummy.dart is sensitive to the location that dart was |
133 // *invoked* from and not relative to *this* file like we'd like. That | 133 // *invoked* from and not relative to *this* file like we'd like. That |
134 // means these tests only run correctly from one place. Unfortunately, | 134 // means these tests only run correctly from one place. Unfortunately, |
135 // test.py/test.dart runs this from one directory and frog/presubmit.py | 135 // test.py/test.dart runs this from one directory and frog/presubmit.py |
136 // runs it from another. | 136 // runs it from another. |
137 // See Bug 1145. | 137 // See Bug 1145. |
138 var fileSystem = new VMFileSystem(); | 138 var fileSystem = new VMFileSystem(); |
139 if (!fileSystem.fileExists(dummyPath)) { | 139 if (!fileSystem.fileExists(dummyPath)) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 215 |
216 test('to a named constructor', () { | 216 test('to a named constructor', () { |
217 expect(render(doc.resolveNameReference('new Class.namedConstructor', | 217 expect(render(doc.resolveNameReference('new Class.namedConstructor', |
218 library: dummy))). | 218 library: dummy))). |
219 equals('<a class="crossref" ' + | 219 equals('<a class="crossref" ' + |
220 'href="../dummy/Class.html#new:Class.namedConstructor">new ' + | 220 'href="../dummy/Class.html#new:Class.namedConstructor">new ' + |
221 'Class.namedConstructor</a>'); | 221 'Class.namedConstructor</a>'); |
222 }); | 222 }); |
223 }); | 223 }); |
224 } | 224 } |
OLD | NEW |