Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tests to use the 2.12 null safety version #3249

Merged
merged 1 commit into from Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion build_runner/test/daemon/daemon_test.dart
Expand Up @@ -239,7 +239,7 @@ main() {
await d.dir('a', [
d.dir('web', [
d.file('main.dart', '''
// @dart=2.10
// @dart=2.12
main() {
print('goodbye world');
}'''),
Expand Down
2 changes: 2 additions & 0 deletions build_web_compilers/CHANGELOG.md
@@ -1,3 +1,5 @@
## 3.2.3-dev

## 3.2.2

- Allow the latest analyzer.
Expand Down
2 changes: 1 addition & 1 deletion build_web_compilers/pubspec.yaml
@@ -1,5 +1,5 @@
name: build_web_compilers
version: 3.2.2
version: 3.2.3-dev
description: Builder implementations wrapping Dart compilers.
repository: https://github.com/dart-lang/build/tree/master/build_web_compilers

Expand Down
59 changes: 28 additions & 31 deletions build_web_compilers/test/dart2js_bootstrap_test.dart
Expand Up @@ -4,7 +4,6 @@

import 'dart:async';

import 'package:build/experiments.dart';
import 'package:build_modules/build_modules.dart';
import 'package:build_test/build_test.dart';
import 'package:build_web_compilers/build_web_compilers.dart';
Expand Down Expand Up @@ -119,11 +118,11 @@ void main() {
test('sound null safety is defaulted based on the entrypoint', () async {
assets = {
'a|lib/is_sound.dart': '''
// @dart=2.10
// @dart=2.12
const unsoundMode = <int?>[] is List<int>;
''',
'a|web/sound.dart': '''
// @dart=2.10
// @dart=2.12
import 'package:a/is_sound.dart';
void main() {
print(unsoundMode);
Expand All @@ -138,34 +137,32 @@ void main() {
''',
};

await withEnabledExperiments(() async {
// Set up all the other required inputs for this test.
await testBuilderAndCollectAssets(const ModuleLibraryBuilder(), assets);
await testBuilderAndCollectAssets(MetaModuleBuilder(platform), assets);
await testBuilderAndCollectAssets(
MetaModuleCleanBuilder(platform), assets);
await testBuilderAndCollectAssets(ModuleBuilder(platform), assets);
// Check the inlined constant value for soundness
var expectedOutputs = {
'a|web/sound.dart.js': decodedMatches(allOf(
contains('NullSafetyMode.sound'),
isNot(contains('NullSafetyMode.unsound')))),
'a|web/sound.dart.js.map': anything,
'a|web/sound.dart.js.tar.gz': anything,
'a|web/unsound.dart.js': decodedMatches(allOf(
contains('NullSafetyMode.unsound'),
isNot(contains('NullSafetyMode.sound')))),
'a|web/unsound.dart.js.map': anything,
'a|web/unsound.dart.js.tar.gz': anything,
};
await testBuilder(
WebEntrypointBuilder(WebCompiler.Dart2Js,
soundNullSafetyOverride: null,
nullAssertions: false,
nativeNullAssertions: false),
assets,
outputs: expectedOutputs);
}, ['non-nullable']);
// Set up all the other required inputs for this test.
await testBuilderAndCollectAssets(const ModuleLibraryBuilder(), assets);
await testBuilderAndCollectAssets(MetaModuleBuilder(platform), assets);
await testBuilderAndCollectAssets(
MetaModuleCleanBuilder(platform), assets);
await testBuilderAndCollectAssets(ModuleBuilder(platform), assets);
// Check the inlined constant value for soundness
var expectedOutputs = {
'a|web/sound.dart.js': decodedMatches(allOf(
contains('NullSafetyMode.sound'),
isNot(contains('NullSafetyMode.unsound')))),
'a|web/sound.dart.js.map': anything,
'a|web/sound.dart.js.tar.gz': anything,
'a|web/unsound.dart.js': decodedMatches(allOf(
contains('NullSafetyMode.unsound'),
isNot(contains('NullSafetyMode.sound')))),
'a|web/unsound.dart.js.map': anything,
'a|web/unsound.dart.js.tar.gz': anything,
};
await testBuilder(
WebEntrypointBuilder(WebCompiler.Dart2Js,
soundNullSafetyOverride: null,
nullAssertions: false,
nativeNullAssertions: false),
assets,
outputs: expectedOutputs);
});
});
}