[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:
Jonah Williams
2020-10-02 21:52:38 -07:00
committed by GitHub
parent 687121d6da
commit ddb01a0c81
5 changed files with 102 additions and 2 deletions

View File

@@ -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 {

View File

@@ -3,3 +3,4 @@
analyzer:
exclude:
- lib/null_safe_main.dart
- lib/sound_mode.dart

View 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',
);
}