Skip to content

Commit 9e55e7b

Browse files
authored
Simplify and correct two tests (#3657)
1 parent 2f49935 commit 9e55e7b

File tree

2 files changed

+6
-32
lines changed

2 files changed

+6
-32
lines changed

test/options_test.dart

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import 'package:test_reflective_loader/test_reflective_loader.dart';
1212

1313
import 'dartdoc_test_base.dart';
1414
import 'src/test_descriptor_utils.dart' as d;
15-
import 'src/utils.dart' as utils;
1615
import 'src/utils.dart';
1716

1817
void main() {
@@ -28,8 +27,7 @@ class OptionsTest extends DartdocTestBase {
2827

2928
static const packageName = 'test_package';
3029

31-
Future<void> createPackage(
32-
String name, {
30+
Future<void> createPackage({
3331
String? dartdocOptions,
3432
List<d.Descriptor> libFiles = const [],
3533
List<d.Descriptor> files = const [],
@@ -41,14 +39,13 @@ class OptionsTest extends DartdocTestBase {
4139
files: files,
4240
resourceProvider: resourceProvider,
4341
);
44-
await utils.writeDartdocResources(resourceProvider);
42+
await writeDartdocResources(resourceProvider);
4543
packageConfigProvider.addPackageToConfigFor(
4644
packagePath, packageName, Uri.file('$packagePath/'));
4745
}
4846

4947
void test_faviconOption_copiesFaviconFile() async {
5048
await createPackage(
51-
packageName,
5249
dartdocOptions: '''
5350
dartdoc:
5451
favicon: anicon.png
@@ -59,7 +56,6 @@ dartdoc:
5956
await (await buildDartdoc(
6057
additionalArguments: [
6158
'--auto-include-dependencies',
62-
'--no-link-to-remote',
6359
],
6460
))
6561
.generateDocs();
@@ -73,7 +69,6 @@ dartdoc:
7369

7470
void test_headerOption_addsContentToIndexFile() async {
7571
await createPackage(
76-
packageName,
7772
dartdocOptions: '''
7873
dartdoc:
7974
header: ['extras/header.html']
@@ -93,7 +88,6 @@ dartdoc:
9388

9489
void test_footerOption_addsContentToIndexFile() async {
9590
await createPackage(
96-
packageName,
9791
dartdocOptions: '''
9892
dartdoc:
9993
footer: ['extras/footer.html']
@@ -113,7 +107,6 @@ dartdoc:
113107

114108
void test_footerTextOption_addsTextToIndexFile() async {
115109
await createPackage(
116-
packageName,
117110
dartdocOptions: '''
118111
dartdoc:
119112
footerText: ['extras/footer.txt']
@@ -133,7 +126,6 @@ dartdoc:
133126

134127
void test_excludeFooterVersionOption_doesNotDisplayVersion() async {
135128
await createPackage(
136-
packageName,
137129
dartdocOptions: '''
138130
dartdoc:
139131
excludeFooterVersion: true
@@ -161,7 +153,6 @@ dartdoc:
161153

162154
void test_examplePathPrefixOption_findsExamplesInACustomPath() async {
163155
await createPackage(
164-
packageName,
165156
dartdocOptions: '''
166157
dartdoc:
167158
examplePathPrefix: 'package_examples'
@@ -199,7 +190,6 @@ An example in an unusual dir.
199190

200191
void test_includeOption_canBeSpecifiedInOptionsFile() async {
201192
await createPackage(
202-
packageName,
203193
dartdocOptions: '''
204194
dartdoc:
205195
include: ["library_1", "library_2"]
@@ -230,7 +220,6 @@ class Baz {}
230220

231221
void test_includeCommandLineOption_overridesOptionsFileOption() async {
232222
await createPackage(
233-
packageName,
234223
dartdocOptions: '''
235224
dartdoc:
236225
include: ["library_1", "library_2"]
@@ -262,7 +251,6 @@ class Baz {}
262251

263252
void test_excludeCommandLineOption_overridesOptionsFileOption() async {
264253
await createPackage(
265-
packageName,
266254
dartdocOptions: '''
267255
dartdoc:
268256
include: ["library_1", "library_2"]
@@ -291,7 +279,6 @@ class Bar {}
291279
void
292280
test_showUndocumentedCategoriesOption_showsUndocumentedCategories() async {
293281
await createPackage(
294-
packageName,
295282
dartdocOptions: '''
296283
dartdoc:
297284
showUndocumentedCategories: true
@@ -317,7 +304,6 @@ class Foo {}
317304

318305
void test_categoryOrderOption_ordersCategories() async {
319306
await createPackage(
320-
packageName,
321307
dartdocOptions: '''
322308
dartdoc:
323309
categories:
@@ -362,7 +348,6 @@ class C3 {}
362348

363349
void test_categoriesNotIncludedInCategoryOrder_areOrderedAtTheEnd() async {
364350
await createPackage(
365-
packageName,
366351
dartdocOptions: '''
367352
dartdoc:
368353
categories:
@@ -413,7 +398,6 @@ class C4 {}
413398

414399
void test_categoriesAreOnlyTrackedWhenUsed() async {
415400
await createPackage(
416-
packageName,
417401
dartdocOptions: '''
418402
dartdoc:
419403
categories:
@@ -449,7 +433,6 @@ class C1 {}
449433
void
450434
test_templatesDirOption_referencingANonExistentDirectory_resultsInDartdocFailure() async {
451435
await createPackage(
452-
packageName,
453436
libFiles: [
454437
d.file('library_1.dart', '''
455438
library library_1;
@@ -469,7 +452,6 @@ class Foo {}
469452

470453
void test_templatesDirOption_specifiesTheTemplatesToUse() async {
471454
await createPackage(
472-
packageName,
473455
libFiles: [
474456
d.file('library_1.dart', '''
475457
library library_1;
@@ -512,7 +494,6 @@ class Foo {}
512494
void
513495
test_templatesDirOptionReferencingAnEmptyDirectory_resultsInDartdocFailure() async {
514496
await createPackage(
515-
packageName,
516497
libFiles: [
517498
d.file('library_1.dart', '''
518499
library library_1;
@@ -533,7 +514,6 @@ class Foo {}
533514

534515
void test_quietOption_resultsInNoProgressOrOtherLogging() async {
535516
await createPackage(
536-
packageName,
537517
libFiles: [
538518
d.file('library_1.dart', '''
539519
library library_1;
@@ -558,7 +538,6 @@ Found 1 warning and 0 errors.
558538

559539
void test_noGenerateDocsOption_resultsInNoLoggingAndNoGeneratedDocs() async {
560540
await createPackage(
561-
packageName,
562541
libFiles: [
563542
d.file('library_1.dart', '''
564543
library library_1;
@@ -588,15 +567,14 @@ Found 1 warning and 0 errors.
588567

589568
void test_jsonOption_resultsInJsonOutput() async {
590569
await createPackage(
591-
packageName,
592570
libFiles: [
593571
d.file('library_1.dart', '''
594572
library library_1;
595573
class Foo {}
596574
'''),
597575
],
598576
);
599-
await utils.writeDartdocResources(resourceProvider);
577+
await writeDartdocResources(resourceProvider);
600578
final dartdoc = await buildDartdoc(useJson: true);
601579
await dartdoc.generateDocs();
602580

@@ -609,7 +587,7 @@ class Foo {}
609587

610588
void test_nonExistentOption_resultsInFatalError() async {
611589
expect(
612-
() => utils.generatorContextFromArgv([
590+
() => generatorContextFromArgv([
613591
'--nonexistent',
614592
], packageMetaProvider),
615593
throwsA(isA<ArgParserException>().having(
@@ -622,7 +600,7 @@ class Foo {}
622600

623601
void test_nonExistentInputPath_resultsInFatalError() async {
624602
expect(
625-
() => utils.generatorContextFromArgv([
603+
() => generatorContextFromArgv([
626604
'--input',
627605
'non-existent',
628606
], packageMetaProvider),
@@ -638,7 +616,6 @@ class Foo {}
638616

639617
void test_limitFilesCreated_maxFileCountIsReached() async {
640618
await createPackage(
641-
packageName,
642619
libFiles: [
643620
d.file('library_1.dart', '''
644621
library library_1;
@@ -659,7 +636,6 @@ class Foo {
659636

660637
void test_limitFilesCreated_maxFileCountIsNotReached() async {
661638
await createPackage(
662-
packageName,
663639
libFiles: [
664640
d.file('library_1.dart', '''
665641
library library_1;
@@ -677,7 +653,6 @@ class Foo {
677653

678654
void test_limitFilesCreated_maxTotalSizeIsReached() async {
679655
await createPackage(
680-
packageName,
681656
libFiles: [
682657
d.file('library_1.dart', '''
683658
library library_1;
@@ -698,7 +673,6 @@ class Foo {
698673

699674
void test_limitFilesCreated_maxTotalSizeIsNotReached() async {
700675
await createPackage(
701-
packageName,
702676
libFiles: [
703677
d.file('library_1.dart', '''
704678
library library_1;

test/templates/extension_type_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class Base1<E> {
8383
8484
class Base2 {}
8585
86-
class Foo<E> extends Base1<E>, Base2 {}
86+
class Foo<E> implements Base1<E>, Base2 {}
8787
8888
class FooSub extends Foo<int> {}
8989

0 commit comments

Comments
 (0)