Skip to content

Commit 7c2d9f0

Browse files
authored
Cleanup for feedback on options_test refactoring (#3587)
1 parent 602e1aa commit 7c2d9f0

File tree

1 file changed

+19
-89
lines changed

1 file changed

+19
-89
lines changed

test/options_test.dart

Lines changed: 19 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,6 @@ class OptionsTest extends DartdocTestBase {
2828

2929
static const packageName = 'test_package';
3030

31-
/*@override
32-
Future<void> setUp() async {
33-
await super.setUp();
34-
startLogging(
35-
isJson: false,
36-
isQuiet: true,
37-
showProgress: true,
38-
outSink: outBuffer,
39-
errSink: errBuffer,
40-
);
41-
}*/
42-
4331
Future<void> createPackage(
4432
String name, {
4533
String? dartdocOptions,
@@ -58,65 +46,7 @@ class OptionsTest extends DartdocTestBase {
5846
packagePath, packageName, Uri.file('$packagePath/'));
5947
}
6048

61-
/*
62-
63-
Future<PubPackageBuilder> createPackageBuilder({
64-
List<String> additionalOptions = const [],
65-
bool skipUnreachableSdkLibraries = true,
66-
bool useJson = false,
67-
}) async {
68-
context = await utils.generatorContextFromArgv([
69-
'--input',
70-
packagePath,
71-
'--output',
72-
path.join(packagePath, 'doc'),
73-
'--sdk-dir',
74-
packageMetaProvider.defaultSdkDir.path,
75-
'--allow-tools',
76-
'--no-link-to-remote',
77-
'--no-show-progress',
78-
if (useJson) '--json',
79-
...additionalOptions,
80-
], packageMetaProvider);
81-
82-
var packageConfigProvider = utils
83-
.getTestPackageConfigProvider(packageMetaProvider.defaultSdkDir.path);
84-
packageConfigProvider.addPackageToConfigFor(
85-
packagePath, packageName, Uri.file('$packagePath/'));
86-
87-
startLogging(
88-
isJson: useJson,
89-
isQuiet: true,
90-
showProgress: true,
91-
outSink: outBuffer,
92-
errSink: errBuffer,
93-
);
94-
return PubPackageBuilder(
95-
context,
96-
packageMetaProvider,
97-
packageConfigProvider,
98-
skipUnreachableSdkLibraries: skipUnreachableSdkLibraries,
99-
);
100-
}
101-
102-
Future<Dartdoc> buildDartdoc({
103-
List<String> additionalOptions = const [],
104-
bool skipUnreachableSdkLibraries = true,
105-
bool useJson = false,
106-
}) async {
107-
final packageBuilder = await createPackageBuilder(
108-
additionalOptions: additionalOptions,
109-
skipUnreachableSdkLibraries: skipUnreachableSdkLibraries,
110-
useJson: useJson,
111-
);
112-
return await Dartdoc.fromContext(
113-
context,
114-
packageBuilder,
115-
);
116-
}
117-
*/
118-
119-
void test_faviconOptionCopiesFaviconFile() async {
49+
void test_faviconOption_copiesFaviconFile() async {
12050
await createPackage(
12151
packageName,
12252
dartdocOptions: '''
@@ -141,7 +71,7 @@ dartdoc:
14171
expect(faviconContent, contains('Just plain text'));
14272
}
14373

144-
void test_headerOptionAddsContentToIndexFile() async {
74+
void test_headerOption_addsContentToIndexFile() async {
14575
await createPackage(
14676
packageName,
14777
dartdocOptions: '''
@@ -161,7 +91,7 @@ dartdoc:
16191
expect(indexContent, contains('<em>Header</em> things.'));
16292
}
16393

164-
void test_footerOptionAddsContentToIndexFile() async {
94+
void test_footerOption_addsContentToIndexFile() async {
16595
await createPackage(
16696
packageName,
16797
dartdocOptions: '''
@@ -181,7 +111,7 @@ dartdoc:
181111
expect(indexContent, contains('<em>Footer</em> things.'));
182112
}
183113

184-
void test_footerTextOptionAddsTextToIndexFile() async {
114+
void test_footerTextOption_addsTextToIndexFile() async {
185115
await createPackage(
186116
packageName,
187117
dartdocOptions: '''
@@ -201,7 +131,7 @@ dartdoc:
201131
expect(indexContent, contains('Just footer text'));
202132
}
203133

204-
void test_excludeFooterVersionOptionDoesNotDisplayVersion() async {
134+
void test_excludeFooterVersionOption_doesNotDisplayVersion() async {
205135
await createPackage(
206136
packageName,
207137
dartdocOptions: '''
@@ -229,7 +159,7 @@ dartdoc:
229159
expect(version.hasMatch(match.group(0)!), false, reason: indexContent);
230160
}
231161

232-
void test_examplePathPrefixOptionFindsExamplesInACustomPath() async {
162+
void test_examplePathPrefixOption_findsExamplesInACustomPath() async {
233163
await createPackage(
234164
packageName,
235165
dartdocOptions: '''
@@ -267,7 +197,7 @@ An example in an unusual dir.
267197
contains('<code class="language-dart">An example in an unusual dir.'));
268198
}
269199

270-
void test_formatEqualMdOptionGeneratesMarkdownFiles() async {
200+
void test_formatOption_md_generatesMarkdownFiles() async {
271201
await createPackage(
272202
packageName,
273203
libFiles: [
@@ -286,7 +216,7 @@ class Foo {}
286216
expect(indexContent, contains('# Foo class'));
287217
}
288218

289-
void test_formatEqualsBadOptionResultsInDartdocFailure() async {
219+
void test_formatOption_bad_resultsInDartdocFailure() async {
290220
await createPackage(
291221
packageName,
292222
libFiles: [
@@ -302,7 +232,7 @@ class Foo {}
302232
'message', startsWith('Unsupported output format'))));
303233
}
304234

305-
void test_includeOptionCanBeSpecifiedInOptionsFile() async {
235+
void test_includeOption_canBeSpecifiedInOptionsFile() async {
306236
await createPackage(
307237
packageName,
308238
dartdocOptions: '''
@@ -333,7 +263,7 @@ class Baz {}
333263
orderedEquals(['library_1', 'library_2']));
334264
}
335265

336-
void test_includeCommandLineOptionOverridesOptionsFileOption() async {
266+
void test_includeCommandLineOption_overridesOptionsFileOption() async {
337267
await createPackage(
338268
packageName,
339269
dartdocOptions: '''
@@ -365,7 +295,7 @@ class Baz {}
365295
orderedEquals(['library_3']));
366296
}
367297

368-
void test_excludeCommandLineOptionOverridesOptionsFileOption() async {
298+
void test_excludeCommandLineOption_overridesOptionsFileOption() async {
369299
await createPackage(
370300
packageName,
371301
dartdocOptions: '''
@@ -394,7 +324,7 @@ class Bar {}
394324
}
395325

396326
void
397-
test_showUndocumentedCategoriesOptionShowsUndocumentedCategories() async {
327+
test_showUndocumentedCategoriesOption_showsUndocumentedCategories() async {
398328
await createPackage(
399329
packageName,
400330
dartdocOptions: '''
@@ -420,7 +350,7 @@ class Foo {}
420350
expect(classFoo.displayedCategories, isNotEmpty);
421351
}
422352

423-
void test_categoryOrderOrdersCategories() async {
353+
void test_categoryOrderOption_ordersCategories() async {
424354
await createPackage(
425355
packageName,
426356
dartdocOptions: '''
@@ -465,7 +395,7 @@ class C3 {}
465395
equals(['Three', 'One', 'Two']));
466396
}
467397

468-
void test_categoriesNotIncludedInCategoryOrderAreOrderedAtTheEnd() async {
398+
void test_categoriesNotIncludedInCategoryOrder_areOrderedAtTheEnd() async {
469399
await createPackage(
470400
packageName,
471401
dartdocOptions: '''
@@ -552,7 +482,7 @@ class C1 {}
552482
}
553483

554484
void
555-
test_templatesDirOptionReferencingANonExistentDirectoryResultsInDartdocFailure() async {
485+
test_templatesDirOption_referencingANonExistentDirectory_resultsInDartdocFailure() async {
556486
await createPackage(
557487
packageName,
558488
libFiles: [
@@ -572,7 +502,7 @@ class Foo {}
572502
)));
573503
}
574504

575-
void test_templatesDirOptionSpecifiesTheTemplatesToUse() async {
505+
void test_templatesDirOption_specifiesTheTemplatesToUse() async {
576506
await createPackage(
577507
packageName,
578508
libFiles: [
@@ -615,7 +545,7 @@ class Foo {}
615545
}
616546

617547
void
618-
test_templatesDirOptionReferencingAnEmptyDirectoryResultsInDartdocFailure() async {
548+
test_templatesDirOptionReferencingAnEmptyDirectory_resultsInDartdocFailure() async {
619549
await createPackage(
620550
packageName,
621551
libFiles: [
@@ -691,7 +621,7 @@ Found 1 warning and 0 errors.
691621
expect(outputDirectory.exists, isFalse);
692622
}
693623

694-
void test_jsonOptionResultsInJsonOutput() async {
624+
void test_jsonOption_resultsInJsonOutput() async {
695625
await createPackage(
696626
packageName,
697627
libFiles: [
@@ -712,7 +642,7 @@ class Foo {}
712642
expect(errBuffer, isEmpty);
713643
}
714644

715-
void test_nonExistentOption_resultsIFatalError() async {
645+
void test_nonExistentOption_resultsInFatalError() async {
716646
expect(
717647
() => utils.generatorContextFromArgv([
718648
'--nonexistent',

0 commit comments

Comments
 (0)