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

Side by Side Diff: utils/tests/dartdoc/src/dartdoc_tests.dart

Issue 9455034: Fix dartdoc tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | « utils/tests/dartdoc/dartdoc.status ('k') | utils/tests/dartdoc/src/markdown_tests.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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('../../../dartdoc/dartdoc.dart', prefix: 'dd');
9 #import('../../../dartdoc/markdown.dart', prefix: 'md'); 9 #import('../../../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_node.dart'); 12 #import('../../../../client/testing/unittest/unittest_vm.dart');
13 #import('../../../../frog/lang.dart'); 13 #import('../../../../frog/lang.dart');
14 #import('../../../../frog/file_system_node.dart'); 14 #import('../../../../frog/file_system_vm.dart');
15 15
16 main() { 16 main() {
17 var files = new NodeFileSystem(); 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 });
25 25
26 test('one occurrence', () { 26 test('one occurrence', () {
27 expect(dd.countOccurrences('bananarama', 'nara')).equals(1); 27 expect(dd.countOccurrences('bananarama', 'nara')).equals(1);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = 'utils/tests/dartdoc/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 NodeFileSystem(); 138 var fileSystem = new VMFileSystem();
139 if (!fileSystem.fileExists(dummyPath)) { 139 if (!fileSystem.fileExists(dummyPath)) {
140 print("Can't run dartdoc name reference tests because dummy.dart " + 140 print("Can't run dartdoc name reference tests because dummy.dart " +
141 "could not be found."); 141 "could not be found.");
142 return; 142 return;
143 } 143 }
144 144
145 var doc = new dd.Dartdoc(); 145 var doc = new dd.Dartdoc();
146 doc.startFile('someLib/someType.html'); 146 doc.startFile('someLib/someType.html');
147 147
148 world.processDartScript(dummyPath); 148 world.processDartScript(dummyPath);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « utils/tests/dartdoc/dartdoc.status ('k') | utils/tests/dartdoc/src/markdown_tests.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698