Skip to content

Commit

Permalink
Fix test timeouts related to weak null safety (#2416)
Browse files Browse the repository at this point in the history
  • Loading branch information
elliette authored Apr 22, 2024
1 parent d4f9f67 commit 0b18816
Show file tree
Hide file tree
Showing 12 changed files with 583 additions and 690 deletions.
16 changes: 5 additions & 11 deletions dwds/test/build_daemon_circular_evaluate_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import 'package:test_common/test_sdk_configuration.dart';

import 'evaluate_circular_common.dart';
import 'fixtures/context.dart';
import 'fixtures/project.dart';

void main() async {
// Enable verbose logging for debugging.
Expand All @@ -19,14 +18,9 @@ void main() async {
final provider = TestSdkConfigurationProvider(verbose: debug);
tearDownAll(provider.dispose);

for (var nullSafety in NullSafety.values) {
group('${nullSafety.name} null safety |', () {
testAll(
provider: provider,
compilationMode: CompilationMode.buildDaemon,
nullSafety: nullSafety,
debug: debug,
);
});
}
testAll(
provider: provider,
compilationMode: CompilationMode.buildDaemon,
debug: debug,
);
}
16 changes: 5 additions & 11 deletions dwds/test/build_daemon_evaluate_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import 'package:test_common/test_sdk_configuration.dart';

import 'evaluate_common.dart';
import 'fixtures/context.dart';
import 'fixtures/project.dart';

void main() async {
// Enable verbose logging for debugging.
Expand All @@ -20,14 +19,9 @@ void main() async {
final provider = TestSdkConfigurationProvider(verbose: debug);
tearDownAll(provider.dispose);

for (var nullSafety in NullSafety.values) {
group('${nullSafety.name} null safety |', () {
testAll(
provider: provider,
compilationMode: CompilationMode.buildDaemon,
nullSafety: nullSafety,
debug: debug,
);
});
}
testAll(
provider: provider,
compilationMode: CompilationMode.buildDaemon,
debug: debug,
);
}
4 changes: 1 addition & 3 deletions dwds/test/evaluate_circular_common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ void testAll({
required TestSdkConfigurationProvider provider,
CompilationMode compilationMode = CompilationMode.buildDaemon,
IndexBaseMode indexBaseMode = IndexBaseMode.noBase,
NullSafety nullSafety = NullSafety.sound,
bool useDebuggerModuleNames = false,
bool debug = false,
}) {
Expand All @@ -30,9 +29,8 @@ void testAll({
);
}

final testCircular1 = TestProject.testCircular1(nullSafety: nullSafety);
final testCircular1 = TestProject.testCircular1();
final testCircular2 = TestProject.testCircular2(
nullSafety: nullSafety,
baseMode: indexBaseMode,
);

Expand Down
19 changes: 2 additions & 17 deletions dwds/test/evaluate_common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ void testAll({
required TestSdkConfigurationProvider provider,
CompilationMode compilationMode = CompilationMode.buildDaemon,
IndexBaseMode indexBaseMode = IndexBaseMode.noBase,
NullSafety nullSafety = NullSafety.sound,
bool useDebuggerModuleNames = false,
bool debug = false,
}) {
Expand All @@ -32,9 +31,8 @@ void testAll({
);
}

final testProject = TestProject.test(nullSafety: nullSafety);
final testPackageProject =
TestProject.testPackage(nullSafety: nullSafety, baseMode: indexBaseMode);
final testProject = TestProject.test();
final testPackageProject = TestProject.testPackage(baseMode: indexBaseMode);

final context = TestContext(testPackageProject, provider);

Expand Down Expand Up @@ -302,19 +300,6 @@ void testAll({
skip: 'https://github.com/dart-lang/webdev/issues/1371',
);

test('uses correct null safety mode', () async {
await onBreakPoint(mainScript, 'printLocal', (event) async {
final isNullSafetyEnabledExpression =
'() { const sound = !(<Null>[] is List<int>); return sound; } ()';
final result = await getInstanceRef(
event.topFrame!.index!,
isNullSafetyEnabledExpression,
);
final expectedResult = '${nullSafety == NullSafety.sound}';
expect(result, matchInstanceRef(expectedResult));
});
});

test('does not crash if class metadata cannot be found', () async {
await onBreakPoint(mainScript, 'printStream', (event) async {
final instanceRef =
Expand Down
Loading

0 comments on commit 0b18816

Please sign in to comment.