Skip to content

Commit 5b3f387

Browse files
jcollins-gCommit Queue
authored and
Commit Queue
committed
Make dartdev test_all.dart test all and work.
This corrects some tests that just weren't working for myself and others while disabling a small number that don't work anymore or are blocked on a bug. Bug: #51707 Change-Id: Ib537d210e80baa3bb80578f0fcccc063a2029173 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288623 Auto-Submit: Janice Collins <[email protected]> Reviewed-by: Ben Konyi <[email protected]> Commit-Queue: Janice Collins <[email protected]>
1 parent ba07466 commit 5b3f387

14 files changed

+161
-70
lines changed

pkg/dartdev/lib/src/templates/web.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ dependencies:
5353
# path: ^1.8.0
5454
5555
dev_dependencies:
56-
build_runner: ^2.3.0
56+
build_daemon: ">=2.0.0 <4.0.0"
57+
build_runner: ^2.4.0
5758
build_web_compilers: ^4.0.0
5859
lints: ^2.0.0
5960
''';

pkg/dartdev/test/analytics_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ List<Map> extractAnalytics(ProcessResult result) {
1919
.toList();
2020
}
2121

22-
Future<void> main() async {
22+
void main() {
23+
final experiments = experimentsWithValidation();
2324
group('DisabledAnalytics', disabledAnalyticsObject);
2425

2526
group('VM -> CLI --analytics flag smoke test:', () {
@@ -67,7 +68,6 @@ Future<void> main() async {
6768
'''));
6869
});
6970

70-
final experiments = await experimentsWithValidation();
7171
group('Sending analytics', () {
7272
test('help', () async {
7373
final p = project(logAnalytics: true);

pkg/dartdev/test/commands/compile_test.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,10 @@ void defineCompileTests() {
389389
expect(result.stdout, contains('I love AOT'));
390390
expect(result.stderr, isEmpty);
391391
expect(result.exitCode, 0);
392-
}, skip: isRunningOnIA32);
392+
},
393+
skip: isRunningOnIA32 ||
394+
// Allow on MacOS after dart-lang/sdk#51707 is fixed.
395+
Platform.isMacOS);
393396

394397
test('Compile and run kernel snapshot', () async {
395398
final p = project(mainSrc: 'void main() { print("I love kernel"); }');
@@ -1281,6 +1284,9 @@ void main() {
12811284
// Now perform the same basic compile and run test with the signed
12821285
// dartaotruntime.
12831286
await basicCompileTest();
1284-
}, skip: isRunningOnIA32);
1287+
},
1288+
skip: isRunningOnIA32 ||
1289+
// Allow on MacOS after dart-lang/sdk#51707 is fixed.
1290+
Platform.isMacOS);
12851291
}
12861292
}

pkg/dartdev/test/commands/fix_test.dart

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import 'dart:io';
66

7-
import 'package:cli_util/cli_logging.dart';
87
import 'package:path/path.dart' as path;
98
import 'package:test/test.dart';
109

@@ -17,13 +16,27 @@ void main() {
1716
/// Enable to run from local source (useful in development).
1817
const runFromSource = false;
1918

19+
final bullet = '•';
20+
final nonAnsiBullet = '-';
21+
22+
/// Allow for different bullets; depending on how the test harness is run,
23+
/// subprocesses may decide to give us ansi bullets or normal bullets.
24+
/// TODO(jcollins): find a way to detect which one we should be expecting.
25+
Matcher stringContainsInOrderWithVariableBullets(List<String> substrings) {
26+
var substitutedSubstrings = substrings;
27+
if (substrings.any((s) => s.contains(bullet))) {
28+
substitutedSubstrings =
29+
substrings.map((s) => s.replaceAll(bullet, nonAnsiBullet)).toList();
30+
}
31+
return anyOf(stringContainsInOrder(substrings),
32+
stringContainsInOrder(substitutedSubstrings));
33+
}
34+
2035
void defineFix() {
2136
TestProject? p;
2237

2338
late ProcessResult result;
2439

25-
final bullet = Logger.standard().ansi.bullet;
26-
2740
setUp(() => p = null);
2841

2942
tearDown(() async => await p?.dispose());
@@ -136,7 +149,7 @@ linter:
136149
expect(result.stderr, isEmpty);
137150
expect(
138151
result.stdout,
139-
stringContainsInOrder([
152+
stringContainsInOrderWithVariableBullets([
140153
'Applying fixes...',
141154
'lib${Platform.pathSeparator}main.dart',
142155
' prefer_single_quotes $bullet 1 fix',
@@ -166,7 +179,7 @@ linter:
166179
expect(result.stderr, isEmpty);
167180
expect(
168181
result.stdout,
169-
stringContainsInOrder([
182+
stringContainsInOrderWithVariableBullets([
170183
'3 proposed fixes in 1 file.',
171184
'lib${Platform.pathSeparator}main.dart',
172185
' annotate_overrides $bullet 1 fix',
@@ -201,7 +214,7 @@ linter:
201214
expect(result.stderr, isEmpty);
202215
expect(
203216
result.stdout,
204-
stringContainsInOrder([
217+
stringContainsInOrderWithVariableBullets([
205218
'1 proposed fix in 1 file.',
206219
'lib${Platform.pathSeparator}main.dart',
207220
' prefer_single_quotes $bullet 1 fix',
@@ -229,7 +242,7 @@ linter:
229242
expect(result.stderr, isEmpty);
230243
expect(
231244
result.stdout,
232-
stringContainsInOrder([
245+
stringContainsInOrderWithVariableBullets([
233246
"Unable to compute fixes: The diagnostic '_undefined_' is not defined by the analyzer.",
234247
]));
235248
});
@@ -251,7 +264,7 @@ linter:
251264
expect(result.stderr, isEmpty);
252265
expect(
253266
result.stdout,
254-
stringContainsInOrder([
267+
stringContainsInOrderWithVariableBullets([
255268
'Applying fixes...',
256269
'main.dart',
257270
' prefer_single_quotes $bullet 1 fix',
@@ -281,7 +294,7 @@ linter:
281294
expect(result.stderr, isEmpty);
282295
expect(
283296
result.stdout,
284-
stringContainsInOrder([
297+
stringContainsInOrderWithVariableBullets([
285298
'Applying fixes...',
286299
'lib${Platform.pathSeparator}main.dart',
287300
' prefer_single_quotes $bullet 1 fix',
@@ -299,7 +312,7 @@ linter:
299312
expect(result.stderr, isEmpty);
300313
expect(
301314
result.stdout,
302-
stringContainsInOrder([
315+
stringContainsInOrderWithVariableBullets([
303316
"Unable to compute fixes: The diagnostic '_undefined_' is not defined by the analyzer.",
304317
]));
305318
});
@@ -323,7 +336,8 @@ linter:
323336
workingDir: p!.dirPath);
324337
expect(result.exitCode, 0);
325338
expect(result.stderr, isEmpty);
326-
expect(result.stdout, stringContainsInOrder(['Nothing to fix!']));
339+
expect(result.stdout,
340+
stringContainsInOrderWithVariableBullets(['Nothing to fix!']));
327341
});
328342

329343
test('--apply --code=(multiple: one undefined)', () async {
@@ -353,7 +367,7 @@ linter:
353367
expect(result.stderr, isEmpty);
354368
expect(
355369
result.stdout,
356-
stringContainsInOrder([
370+
stringContainsInOrderWithVariableBullets([
357371
"Unable to compute fixes: The diagnostic '_undefined_' is not defined by the analyzer.",
358372
]));
359373
});
@@ -385,7 +399,7 @@ linter:
385399
expect(result.stderr, isEmpty);
386400
expect(
387401
result.stdout,
388-
stringContainsInOrder([
402+
stringContainsInOrderWithVariableBullets([
389403
'Applying fixes...',
390404
'lib${Platform.pathSeparator}main.dart',
391405
' prefer_single_quotes $bullet 1 fix',
@@ -416,7 +430,7 @@ linter:
416430
expect(result.stderr, isEmpty);
417431
expect(
418432
result.stdout,
419-
stringContainsInOrder([
433+
stringContainsInOrderWithVariableBullets([
420434
'Applying fixes...',
421435
'lib${Platform.pathSeparator}main.dart',
422436
' prefer_single_quotes $bullet 1 fix',
@@ -441,7 +455,7 @@ linter:
441455
expect(result.stderr, isEmpty);
442456
expect(
443457
result.stdout,
444-
stringContainsInOrder([
458+
stringContainsInOrderWithVariableBullets([
445459
'Applying fixes...',
446460
'lib${Platform.pathSeparator}main.dart',
447461
' prefer_single_quotes $bullet 1 fix',
@@ -466,7 +480,7 @@ linter:
466480
expect(result.stderr, isEmpty);
467481
expect(
468482
result.stdout,
469-
stringContainsInOrder([
483+
stringContainsInOrderWithVariableBullets([
470484
'Applying fixes...',
471485
'lib${Platform.pathSeparator}main.dart',
472486
' prefer_double_quotes $bullet 2 fixes',
@@ -531,7 +545,7 @@ linter:
531545
expect(result.stderr, isEmpty);
532546
expect(
533547
result.stdout,
534-
stringContainsInOrder([
548+
stringContainsInOrderWithVariableBullets([
535549
'Applying fixes...',
536550
'lib${Platform.pathSeparator}main.dart',
537551
' prefer_single_quotes $bullet 1 fix',

pkg/dartdev/test/commands/info_windows_test.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
@TestOn('windows')
66

7+
import 'dart:io';
8+
79
import 'package:dartdev/src/processes.dart';
810
import 'package:test/test.dart';
911

@@ -35,7 +37,7 @@ void main() {
3537
// 233384kb == 227MB
3638
expect(result.memoryMb, 227);
3739
});
38-
});
40+
}, skip: !Platform.isWindows);
3941

4042
group('info windows', () {
4143
late TestProject p;
@@ -56,5 +58,5 @@ void main() {
5658
expect(output, contains('| Memory'));
5759
expect(output, contains('| dart.exe '));
5860
});
59-
}, timeout: longTimeout);
61+
}, timeout: longTimeout, skip: !Platform.isWindows);
6062
}

0 commit comments

Comments
 (0)