Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library docgen.test.only_lib_content_in_pkg; | 5 library docgen.test.only_lib_content_in_pkg; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:path/path.dart' as p; | 9 import 'package:path/path.dart' as p; |
| 10 import 'package:scheduled_test/descriptor.dart' as d; | 10 import 'package:scheduled_test/descriptor.dart' as d; |
| 11 import 'package:scheduled_test/scheduled_test.dart'; | 11 import 'package:scheduled_test/scheduled_test.dart'; |
| 12 | 12 |
| 13 import '../lib/docgen.dart' as dg; | 13 import '../lib/docgen.dart' as dg; |
| 14 import 'util.dart'; | 14 import 'util.dart'; |
| 15 | 15 |
| 16 void main() { | 16 main() async { |
| 17 | |
| 18 var packageRoot = (await Platform.packageRoot).toFilePath(); | |
|
Lasse Reichstein Nielsen
2015/09/22 09:48:25
I don't think the toFilePath() should be there. Al
| |
| 19 if (packageRoot == '') packageRoot = null; | |
| 17 | 20 |
| 18 setUp(() { | 21 setUp(() { |
| 19 scheduleTempDir(); | 22 scheduleTempDir(); |
| 20 }); | 23 }); |
| 21 | 24 |
| 22 test('exclude non-lib code from package docs', () { | 25 test('exclude non-lib code from package docs', () { |
| 23 schedule(() { | 26 schedule(() { |
| 24 var thisScript = Platform.script; | 27 var thisScript = Platform.script; |
| 25 var thisPath = p.fromUri(thisScript); | 28 var thisPath = p.fromUri(thisScript); |
| 26 expect(p.basename(thisPath), 'only_lib_content_in_pkg_test.dart'); | 29 expect(p.basename(thisPath), 'only_lib_content_in_pkg_test.dart'); |
| 27 expect(p.dirname(thisPath), endsWith('test')); | 30 expect(p.dirname(thisPath), endsWith('test')); |
| 28 | 31 |
| 29 var packageRoot = Platform.packageRoot; | |
| 30 if (packageRoot == '') packageRoot = null; | |
| 31 | |
| 32 var codeDir = p.normalize(p.join(thisPath, '..', '..')); | 32 var codeDir = p.normalize(p.join(thisPath, '..', '..')); |
| 33 expect(FileSystemEntity.isDirectorySync(codeDir), isTrue); | 33 expect(FileSystemEntity.isDirectorySync(codeDir), isTrue); |
| 34 return dg.docgen(['$codeDir/'], out: p.join(d.defaultRoot, 'docs'), | 34 return dg.docgen(['$codeDir/'], out: p.join(d.defaultRoot, 'docs'), |
| 35 packageRoot: packageRoot); | 35 packageRoot: packageRoot); |
| 36 }); | 36 }); |
| 37 | 37 |
| 38 d.dir('docs', [ | 38 d.dir('docs', [ |
| 39 d.dir('docgen', [ | 39 d.dir('docgen', [ |
| 40 d.matcherFile('docgen.json', isJsonMap) | 40 d.matcherFile('docgen.json', isJsonMap) |
| 41 ]), | 41 ]), |
| 42 d.matcherFile('index.json', isJsonMap), | 42 d.matcherFile('index.json', isJsonMap), |
| 43 d.matcherFile('index.txt', hasSortedLines), | 43 d.matcherFile('index.txt', hasSortedLines), |
| 44 d.matcherFile('library_list.json', isJsonMap), | 44 d.matcherFile('library_list.json', isJsonMap), |
| 45 d.nothing('test_lib.json'), | 45 d.nothing('test_lib.json'), |
| 46 d.nothing('test_lib-bar.json'), | 46 d.nothing('test_lib-bar.json'), |
| 47 d.nothing('test_lib-foo.json') | 47 d.nothing('test_lib-foo.json') |
| 48 ]).validate(); | 48 ]).validate(); |
| 49 | 49 |
| 50 }); | 50 }); |
| 51 } | 51 } |
| OLD | NEW |