Skip to content

Commit 47aedf1

Browse files
committed
Tidy
1 parent 3a9d2c4 commit 47aedf1

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

test/package_test.dart

+18-6
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,20 @@ void main() {
2323
FakePackageConfigProvider packageConfigProvider;
2424
PackageGraph packageGraph;
2525

26+
/// Dartdoc has a few indicator files it uses to verify that a directory
27+
/// represents a Dart SDK. These include "bin/dart" and "bin/pub".
28+
void writeSdkBinFiles(Folder root) {
29+
var sdkBinFolder = root.getChildAssumingFolder('bin')..create();
30+
sdkBinFolder.getChildAssumingFile('dart').writeAsStringSync('');
31+
sdkBinFolder.getChildAssumingFile('pub').writeAsStringSync('');
32+
}
33+
2634
void writeSdk() {
2735
mockSdk = MockSdk(resourceProvider: resourceProvider);
36+
// The [MockSdk] only works in non-canonicalized paths, which include
37+
// "C:\sdk", on Windows. Howerver, dartdoc works almost exclusively with
38+
// canonical paths ("c:\sdk"). Copy all MockSdk files to the canonicalized
39+
// path.
2840
for (var l in mockSdk.sdkLibraries) {
2941
var p = l.path;
3042
resourceProvider
@@ -35,17 +47,18 @@ void main() {
3547
.canonicalize(resourceProvider.convertPath(sdkRoot)))
3648
..create();
3749
sdkFolder.getChildAssumingFile('version').writeAsStringSync('2.9.0');
38-
var sdkBinFolder = sdkFolder.getChildAssumingFolder('bin')..create();
39-
sdkBinFolder.getChildAssumingFile('dart').writeAsStringSync('');
40-
sdkBinFolder.getChildAssumingFile('pub').writeAsStringSync('');
4150

42-
var sdkFolderNonCanon = resourceProvider
51+
writeSdkBinFiles(sdkFolder);
52+
writeSdkBinFiles(
53+
resourceProvider.getFolder(resourceProvider.convertPath(sdkRoot)));
54+
55+
/*var sdkFolderNonCanon = resourceProvider
4356
.getFolder(resourceProvider.convertPath(sdkRoot))
4457
..create();
4558
var sdkBinFolderNonCanon = sdkFolderNonCanon.getChildAssumingFolder('bin')
4659
..create();
4760
sdkBinFolderNonCanon.getChildAssumingFile('dart').writeAsStringSync('');
48-
sdkBinFolderNonCanon.getChildAssumingFile('pub').writeAsStringSync('');
61+
sdkBinFolderNonCanon.getChildAssumingFile('pub').writeAsStringSync('');*/
4962
}
5063

5164
void writePackage() {
@@ -60,7 +73,6 @@ void main() {
6073
name: $packageName
6174
version: 0.0.1
6275
''');
63-
projectFolder.getChildAssumingFolder('.dart_tool').create();
6476
projectFolder
6577
.getChildAssumingFolder('.dart_tool')
6678
.getChildAssumingFile('package_config.json')

0 commit comments

Comments
 (0)