Skip to content

Commit

Permalink
Update validate-sdk-docs task to allow 20 libs (dart-lang#3404)
Browse files Browse the repository at this point in the history
  • Loading branch information
srawlins authored May 3, 2023
1 parent d01ddc5 commit 60055b4
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions tool/grind.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1276,37 +1276,38 @@ Future<void> testDartdocFlutterPlugin() async {
@Depends(buildSdkDocs)
void validateSdkDocs() {
const expectedLibCounts = 0;
const expectedSubLibCount = {18, 19};
const expectedTotalCount = {18, 19};
const expectedSubLibCount = {18, 19, 20};
const expectedTotalCount = {18, 19, 20};
var indexHtml = joinFile(_sdkDocsDir, ['index.html']);
if (!indexHtml.existsSync()) {
fail('no index.html found for SDK docs');
fail("No 'index.html' found for the SDK docs");
}
log('found index.html');
log("Found 'index.html'");
var indexContents = indexHtml.readAsStringSync();
var foundLibs = _findCount(indexContents, ' <li><a href="dart-');
if (expectedLibCounts != foundLibs) {
fail('expected $expectedLibCounts "dart:" index.html entries, found '
'$foundLibs');
fail("Expected $expectedLibCounts 'dart:' entries in 'index.html', but "
'found $foundLibs');
}
log('$foundLibs index.html dart: entries found');
log("Found $foundLibs 'dart:' entries in 'index.html'");

var foundSubLibs =
_findCount(indexContents, '<li class="section-subitem"><a href="dart-');
if (!expectedSubLibCount.contains(foundSubLibs)) {
fail('expected $expectedSubLibCount "dart:" index.html entries in '
'categories, found $foundSubLibs');
fail("Expected $expectedSubLibCount 'dart:' entries in 'index.html' to be "
'in categories, but found $foundSubLibs');
}
log('$foundSubLibs index.html dart: entries in categories found');

// check for the existence of certain files/dirs
var libsLength =
_sdkDocsDir.listSync().where((fs) => fs.path.contains('dart-')).length;
if (!expectedTotalCount.contains(libsLength)) {
fail('docs not generated for all the SDK libraries, '
'expected $expectedTotalCount directories, generated $libsLength directories');
fail('Docs not generated for all the SDK libraries; expected '
'$expectedTotalCount directories, but $libsLength directories were '
'generated');
}
log('$libsLength dart: libraries found');
log("Found $libsLength 'dart:' libraries");

var futureConstFile =
joinFile(_sdkDocsDir, [p.join('dart-async', 'Future', 'Future.html')]);
Expand Down

0 comments on commit 60055b4

Please sign in to comment.