| 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 dartdocTests; | 6 library dartdocTests; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 | 10 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 expect(doc.relativePath('other/sub/file.html'), equals( | 112 expect(doc.relativePath('other/sub/file.html'), equals( |
| 113 '../../other/sub/file.html')); | 113 '../../other/sub/file.html')); |
| 114 }); | 114 }); |
| 115 | 115 |
| 116 test('from nested to directory with different path', () { | 116 test('from nested to directory with different path', () { |
| 117 doc.startFile('dir/sub/file.html'); | 117 doc.startFile('dir/sub/file.html'); |
| 118 expect(doc.relativePath('other/file.html'), equals( | 118 expect(doc.relativePath('other/file.html'), equals( |
| 119 '../../other/file.html')); | 119 '../../other/file.html')); |
| 120 }); | 120 }); |
| 121 }); | 121 }); |
| 122 | 122 |
| 123 group('integration tests', () { | 123 group('integration tests', () { |
| 124 test('no entrypoints', () { | 124 test('no entrypoints', () { |
| 125 expect(_runDartdoc([], exitCode: 1), completes); | 125 expect(_runDartdoc([], exitCode: 1), completes); |
| 126 }); | 126 }); |
| 127 | 127 |
| 128 test('library with no packages', () { | 128 test('library with no packages', () { |
| 129 expect(_runDartdoc( | 129 expect(_runDartdoc( |
| 130 [new Path.fromNative('test/test_files/other_place/' | 130 [new Path('test/test_files/other_place/' |
| 131 'no_package_test_file.dart').toNativePath()]), | 131 'no_package_test_file.dart').toNativePath()]), |
| 132 completes); | 132 completes); |
| 133 }); | 133 }); |
| 134 | 134 |
| 135 test('library with packages', () { | 135 test('library with packages', () { |
| 136 expect(_runDartdoc( | 136 expect(_runDartdoc( |
| 137 [new Path.fromNative('test/test_files/' | 137 [new Path('test/test_files/' |
| 138 'package_test_file.dart').toNativePath()]), | 138 'package_test_file.dart').toNativePath()]), |
| 139 completes); | 139 completes); |
| 140 }); | 140 }); |
| 141 | 141 |
| 142 }); | 142 }); |
| 143 } | 143 } |
| 144 | 144 |
| 145 Future _runDartdoc(List<String> arguments, {int exitCode: 0}) { | 145 Future _runDartdoc(List<String> arguments, {int exitCode: 0}) { |
| 146 var dartBin = new Options().executable; | 146 var dartBin = new Options().executable; |
| 147 var dartdoc = 'bin/dartdoc.dart'; | 147 var dartdoc = 'bin/dartdoc.dart'; |
| 148 arguments.insertRange(0, 1, dartdoc); | 148 arguments.insertRange(0, 1, dartdoc); |
| 149 return Process.run(dartBin, arguments) | 149 return Process.run(dartBin, arguments) |
| 150 .then((result) { | 150 .then((result) { |
| 151 expect(result.exitCode, exitCode); | 151 expect(result.exitCode, exitCode); |
| 152 }); | 152 }); |
| 153 } | 153 } |
| OLD | NEW |