[null-safety] add integration tests for sound null safety modes, add support for sound null safety in dart2js (#67171)
Add integration tests to verify that ddc and dart2js can be built and run in sound mode. Updates dart2js compilation to insert a language version comment into the generated entrypoint if necessary. dart-lang/sdk#42253
This commit is contained in:
@@ -765,6 +765,16 @@ Future<void> _runWebIntegrationTests() async {
|
||||
'--dart-define=test.valueB=Value',
|
||||
]
|
||||
);
|
||||
await _runWebDebugTest('lib/sound_mode.dart', additionalArguments: <String>[
|
||||
'--enable-experiment',
|
||||
'non-nullable',
|
||||
'--sound-null-safety',
|
||||
]);
|
||||
await _runWebReleaseTest('lib/sound_mode.dart', additionalArguments: <String>[
|
||||
'--enable-experiment',
|
||||
'non-nullable',
|
||||
'--sound-null-safety',
|
||||
]);
|
||||
}
|
||||
|
||||
Future<void> _runWebStackTraceTest(String buildMode) async {
|
||||
|
||||
@@ -3,3 +3,4 @@
|
||||
analyzer:
|
||||
exclude:
|
||||
- lib/null_safe_main.dart
|
||||
- lib/sound_mode.dart
|
||||
|
||||
24
dev/integration_tests/web/lib/sound_mode.dart
Normal file
24
dev/integration_tests/web/lib/sound_mode.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart=2.10
|
||||
|
||||
import 'dart:html' as html;
|
||||
|
||||
// Verify that web applications can be run in sound mode.
|
||||
void main() {
|
||||
const isWeak = <int?>[] is List<int>;
|
||||
String output;
|
||||
if (isWeak) {
|
||||
output = '--- TEST FAILED ---';
|
||||
} else {
|
||||
output = '--- TEST SUCCEEDED ---';
|
||||
}
|
||||
print(output);
|
||||
html.HttpRequest.request(
|
||||
'/test-result',
|
||||
method: 'POST',
|
||||
sendData: '$output',
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user