Skip to content

Commit c613f42

Browse files
authored
Move 'onPlatform' arguments for tests and groups up. (dart-lang#3890)
With named-arguments-anywhere, `onPlatform` can be specified before the group or test's closure. Doing so makes the group or test must more readable.
1 parent e8f2333 commit c613f42

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

test/html_generator_test.dart

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ import 'package:test/test.dart';
2222
import 'src/utils.dart' as utils;
2323

2424
void main() {
25-
group('HTML generator tests', () {
25+
group('HTML generator tests', onPlatform: {
26+
'windows': Skip('Tests do not work on Windows after NNBD conversion')
27+
}, () {
2628
late MemoryResourceProvider resourceProvider;
2729
late path.Context pathContext;
2830

@@ -86,7 +88,9 @@ void main() {
8688
}
8789
});
8890

89-
test('libraries with no duplicates are not warned about', () async {
91+
test('libraries with no duplicates are not warned about',
92+
onPlatform: {'windows': Skip('Test does not work on Windows (#2446)')},
93+
() async {
9094
getConvertedFile('$projectPath/lib/a.dart')
9195
.writeAsStringSync('library a;');
9296
getConvertedFile('$projectPath/lib/b.dart')
@@ -96,9 +100,11 @@ void main() {
96100
await generator.generate(packageGraph);
97101

98102
expect(packageGraph.packageWarningCounter.errorCount, 0);
99-
}, onPlatform: {'windows': Skip('Test does not work on Windows (#2446)')});
103+
});
100104

101-
test('libraries with duplicate names are warned about', () async {
105+
test('libraries with duplicate names are warned about',
106+
onPlatform: {'windows': Skip('Test does not work on Windows (#2446)')},
107+
() async {
102108
getConvertedFile('$projectPath/lib/a.dart')
103109
.writeAsStringSync('library a;');
104110
getConvertedFile('$projectPath/lib/b.dart')
@@ -112,9 +118,7 @@ void main() {
112118
packageGraph.localPublicLibraries,
113119
anyElement((Library l) => packageGraph.packageWarningCounter
114120
.hasWarning(l, PackageWarning.duplicateFile, expectedPath)));
115-
}, onPlatform: {'windows': Skip('Test does not work on Windows (#2446)')});
116-
}, onPlatform: {
117-
'windows': Skip('Tests do not work on Windows after NNBD conversion')
121+
});
118122
});
119123
}
120124

test/libraries_test.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@ A doc comment.
151151
);
152152
});
153153

154-
test('libraries in SDK package have appropriate data', () async {
154+
test('libraries in SDK package have appropriate data',
155+
onPlatform: {'windows': Skip('Test does not work on Windows (#2446)')},
156+
() async {
155157
var packageMetaProvider = testPackageMetaProvider;
156158
var sdkFolder = packageMetaProvider.defaultSdkDir;
157159
var packageConfigProvider = getTestPackageConfigProvider(sdkFolder.path);
@@ -173,7 +175,7 @@ A doc comment.
173175
expect(dartAsyncLib.dirName, 'dart-async');
174176
expect(dartAsyncLib.href,
175177
'${htmlBasePlaceholder}dart-async/dart-async-library.html');
176-
}, onPlatform: {'windows': Skip('Test does not work on Windows (#2446)')});
178+
});
177179
}
178180

179181
@reflectiveTest

test/packages_test.dart

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ void main() {
4747

4848
tearDown(clearPackageMetaCache);
4949

50-
group('tests', () {
50+
group('tests',
51+
onPlatform: {'windows': Skip('Test does not work on Windows (#2446)')},
52+
() {
5153
group('typical package', () {
5254
setUp(() {
5355
optionSet.parseArguments([]);
@@ -120,13 +122,6 @@ int x;
120122
equals('https://github.com/dart-lang'));
121123
});
122124

123-
test('has a public library', () async {
124-
var packageGraph = await utils.bootBasicPackage(
125-
projectPath, packageMetaProvider, packageConfigProvider);
126-
var library = packageGraph.libraries.named('a');
127-
expect(library.isDocumented, true);
128-
});
129-
130125
test('has anonymous libraries', () async {
131126
writeToJoinedPath(['lib', 'b.dart'], '''
132127
/// Documentation comment.
@@ -492,5 +487,5 @@ int x;
492487
expect(packageGraph.localPackages.first.categories, isEmpty);
493488
});
494489
});
495-
}, onPlatform: {'windows': Skip('Test does not work on Windows (#2446)')});
490+
});
496491
}

0 commit comments

Comments
 (0)