Version 3.9.0-86.0.dev Merge 4ef2725654404d7ed04a96444f4fb49cae89a224 into dev
diff --git a/DEPS b/DEPS index b78f567..aac015e 100644 --- a/DEPS +++ b/DEPS
@@ -54,7 +54,7 @@ # co19 is a cipd package automatically generated for each co19 commit. # Use tests/co19/update.sh to update this hash. - "co19_rev": "b1b6108e0ef7aeaf27cacb5ff236494507fc48ac", + "co19_rev": "ccda634a15d62b23b427ae260991bd7580164661", # The internal benchmarks to use. See go/dart-benchmarks-internal "benchmarks_internal_rev": "1fa5d33a45f7d4dd0093124706cdfa45d9270851",
diff --git a/pkg/analysis_server/benchmark/benchmarks.dart b/pkg/analysis_server/benchmark/benchmarks.dart index 6d1c604..a21d18c 100644 --- a/pkg/analysis_server/benchmark/benchmarks.dart +++ b/pkg/analysis_server/benchmark/benchmarks.dart
@@ -11,7 +11,7 @@ import 'dart:math' as math; import 'package:analyzer/file_system/physical_file_system.dart'; -import 'package:analyzer_utilities/package_root.dart'; +import 'package:analyzer_testing/package_root.dart'; import 'package:args/command_runner.dart'; import 'package:path/path.dart' as path;
diff --git a/pkg/analysis_server/benchmark/perf/dart_analyze.dart b/pkg/analysis_server/benchmark/perf/dart_analyze.dart index 17b7185..031fafb 100644 --- a/pkg/analysis_server/benchmark/perf/dart_analyze.dart +++ b/pkg/analysis_server/benchmark/perf/dart_analyze.dart
@@ -5,7 +5,7 @@ import 'dart:convert'; import 'dart:io'; -import 'package:analyzer_utilities/package_root.dart'; +import 'package:analyzer_testing/package_root.dart'; import '../benchmarks.dart'; import 'utils.dart';
diff --git a/pkg/analysis_server/pubspec.yaml b/pkg/analysis_server/pubspec.yaml index 6b792b7..407f4f3 100644 --- a/pkg/analysis_server/pubspec.yaml +++ b/pkg/analysis_server/pubspec.yaml
@@ -37,6 +37,7 @@ # Use 'any' constraints here; we get our versions from the DEPS file. dev_dependencies: + analyzer_testing: any analyzer_utilities: any cli_util: any lints: any
diff --git a/pkg/analysis_server/test/benchmarks_test.dart b/pkg/analysis_server/test/benchmarks_test.dart index 69b20b0..686ba84 100644 --- a/pkg/analysis_server/test/benchmarks_test.dart +++ b/pkg/analysis_server/test/benchmarks_test.dart
@@ -9,7 +9,7 @@ import 'dart:convert'; import 'dart:io'; -import 'package:analyzer_utilities/package_root.dart'; +import 'package:analyzer_testing/package_root.dart'; import 'package:path/path.dart' as path; import 'package:test/test.dart';
diff --git a/pkg/analysis_server/test/src/utilities/selection_coverage_test.dart b/pkg/analysis_server/test/src/utilities/selection_coverage_test.dart index 92eeffb..d770fd0 100644 --- a/pkg/analysis_server/test/src/utilities/selection_coverage_test.dart +++ b/pkg/analysis_server/test/src/utilities/selection_coverage_test.dart
@@ -9,7 +9,7 @@ import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/file_system/physical_file_system.dart'; import 'package:analyzer/src/dart/element/inheritance_manager3.dart'; -import 'package:analyzer_utilities/package_root.dart' as package_root; +import 'package:analyzer_testing/package_root.dart' as package_root; import 'package:test/test.dart'; import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/support/configuration_files.dart b/pkg/analysis_server/test/support/configuration_files.dart index 5edb780..b2ae8f6 100644 --- a/pkg/analysis_server/test/support/configuration_files.dart +++ b/pkg/analysis_server/test/support/configuration_files.dart
@@ -8,7 +8,7 @@ import 'package:analyzer/src/test_utilities/package_config_file_builder.dart'; import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart'; import 'package:analyzer/src/util/file_paths.dart' as file_paths; -import 'package:analyzer_utilities/package_root.dart' as package_root; +import 'package:analyzer_testing/package_root.dart' as package_root; import 'package:analyzer_utilities/test/mock_packages/mock_packages.dart'; /// A mixin adding functionality to write `.dart_tool/package_config.json`
diff --git a/pkg/analysis_server/test/verify_no_utf8_encode_test.dart b/pkg/analysis_server/test/verify_no_utf8_encode_test.dart index 6d5e534..1f4d08f 100644 --- a/pkg/analysis_server/test/verify_no_utf8_encode_test.dart +++ b/pkg/analysis_server/test/verify_no_utf8_encode_test.dart
@@ -7,7 +7,7 @@ import 'package:analyzer/file_system/file_system.dart'; import 'package:analyzer/file_system/physical_file_system.dart'; import 'package:analyzer/src/util/file_paths.dart' as file_paths; -import 'package:analyzer_utilities/package_root.dart'; +import 'package:analyzer_testing/package_root.dart'; import 'package:test/test.dart'; // TODO(scheglov): Remove it after SDK 3.1 published.
diff --git a/pkg/analysis_server/test/verify_sorted_test.dart b/pkg/analysis_server/test/verify_sorted_test.dart index 93fc172..4b94925 100644 --- a/pkg/analysis_server/test/verify_sorted_test.dart +++ b/pkg/analysis_server/test/verify_sorted_test.dart
@@ -8,7 +8,7 @@ import 'package:analyzer/dart/analysis/session.dart'; import 'package:analyzer/file_system/file_system.dart'; import 'package:analyzer/file_system/physical_file_system.dart'; -import 'package:analyzer_utilities/package_root.dart'; +import 'package:analyzer_testing/package_root.dart'; import 'package:test/test.dart'; /// The purpose of this test is to validate that all elements
diff --git a/pkg/analysis_server/test/verify_tests_test.dart b/pkg/analysis_server/test/verify_tests_test.dart index 3f7c4c9..0f29d6e 100644 --- a/pkg/analysis_server/test/verify_tests_test.dart +++ b/pkg/analysis_server/test/verify_tests_test.dart
@@ -4,7 +4,7 @@ import 'package:analyzer/file_system/file_system.dart'; import 'package:analyzer/file_system/physical_file_system.dart'; -import 'package:analyzer_utilities/package_root.dart' as package_root; +import 'package:analyzer_testing/package_root.dart' as package_root; import 'package:analyzer_utilities/verify_tests.dart'; import 'package:path/path.dart' as path;
diff --git a/pkg/analysis_server/tool/bulk_fix/parse_utils.dart b/pkg/analysis_server/tool/bulk_fix/parse_utils.dart index 91549b8..b3a337f 100644 --- a/pkg/analysis_server/tool/bulk_fix/parse_utils.dart +++ b/pkg/analysis_server/tool/bulk_fix/parse_utils.dart
@@ -8,7 +8,7 @@ import 'package:analyzer/dart/analysis/results.dart'; import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/file_system/physical_file_system.dart'; -import 'package:analyzer_utilities/package_root.dart'; +import 'package:analyzer_testing/package_root.dart'; class BulkFixDetails { Future<Map<String, CorrectionDetails>> collectOverrides() async {
diff --git a/pkg/analysis_server/tool/code_completion/relevance_table_generator.dart b/pkg/analysis_server/tool/code_completion/relevance_table_generator.dart index 83bc4e5..a178c85 100644 --- a/pkg/analysis_server/tool/code_completion/relevance_table_generator.dart +++ b/pkg/analysis_server/tool/code_completion/relevance_table_generator.dart
@@ -24,7 +24,7 @@ import 'package:analyzer/src/dart/element/inheritance_manager3.dart'; import 'package:analyzer/src/util/file_paths.dart' as file_paths; import 'package:analyzer/src/utilities/extensions/flutter.dart'; -import 'package:analyzer_utilities/package_root.dart' as package_root; +import 'package:analyzer_testing/package_root.dart' as package_root; import 'package:analyzer_utilities/tools.dart'; import 'package:args/args.dart';
diff --git a/pkg/analysis_server/tool/codebase/failing_tests.dart b/pkg/analysis_server/tool/codebase/failing_tests.dart index 6f3e036..5eae739 100644 --- a/pkg/analysis_server/tool/codebase/failing_tests.dart +++ b/pkg/analysis_server/tool/codebase/failing_tests.dart
@@ -11,7 +11,7 @@ import 'package:analyzer/dart/ast/visitor.dart'; import 'package:analyzer/file_system/file_system.dart'; import 'package:analyzer/file_system/physical_file_system.dart'; -import 'package:analyzer_utilities/package_root.dart'; +import 'package:analyzer_testing/package_root.dart'; import 'package:http/http.dart' as http; import 'package:test/test.dart'; import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/tool/generate_analyzer_version.dart b/pkg/analysis_server/tool/generate_analyzer_version.dart index 82325b6..cbceb64 100644 --- a/pkg/analysis_server/tool/generate_analyzer_version.dart +++ b/pkg/analysis_server/tool/generate_analyzer_version.dart
@@ -4,7 +4,7 @@ import 'dart:io'; -import 'package:analyzer_utilities/package_root.dart'; +import 'package:analyzer_testing/package_root.dart'; import 'package:analyzer_utilities/tools.dart'; import 'package:path/path.dart'; import 'package:yaml/yaml.dart';
diff --git a/pkg/analysis_server/tool/presubmit/verify_error_fix_status.dart b/pkg/analysis_server/tool/presubmit/verify_error_fix_status.dart index 43c0500..ac57468 100644 --- a/pkg/analysis_server/tool/presubmit/verify_error_fix_status.dart +++ b/pkg/analysis_server/tool/presubmit/verify_error_fix_status.dart
@@ -11,7 +11,7 @@ import 'package:analyzer/error/error.dart'; import 'package:analyzer/file_system/physical_file_system.dart'; import 'package:analyzer/src/lint/registry.dart'; -import 'package:analyzer_utilities/package_root.dart' as package_root; +import 'package:analyzer_testing/package_root.dart' as package_root; import 'package:linter/src/rules.dart'; import 'package:yaml/yaml.dart';
diff --git a/pkg/analyzer/pubspec.yaml b/pkg/analyzer/pubspec.yaml index 6778abf..e7068b4 100644 --- a/pkg/analyzer/pubspec.yaml +++ b/pkg/analyzer/pubspec.yaml
@@ -28,6 +28,7 @@ # best practice for packages is to specify their compatible version ranges. # See also https://dart.dev/tools/pub/dependencies. dev_dependencies: + analyzer_testing: any analyzer_utilities: any args: any async: any
diff --git a/pkg/analyzer/test/src/fasta/message_coverage_test.dart b/pkg/analyzer/test/src/fasta/message_coverage_test.dart index 55bf9da..7d5e6a0 100644 --- a/pkg/analyzer/test/src/fasta/message_coverage_test.dart +++ b/pkg/analyzer/test/src/fasta/message_coverage_test.dart
@@ -6,7 +6,7 @@ import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/ast/visitor.dart'; -import 'package:analyzer_utilities/package_root.dart' as package_root; +import 'package:analyzer_testing/package_root.dart' as package_root; import 'package:path/path.dart' as path; import 'package:test/test.dart'; import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analyzer/test/verify_docs_test.dart b/pkg/analyzer/test/verify_docs_test.dart index 136415e..14f7f7c 100644 --- a/pkg/analyzer/test/verify_docs_test.dart +++ b/pkg/analyzer/test/verify_docs_test.dart
@@ -12,7 +12,7 @@ import 'package:analyzer/file_system/overlay_file_system.dart'; import 'package:analyzer/file_system/physical_file_system.dart'; import 'package:analyzer/src/error/codes.dart'; -import 'package:analyzer_utilities/package_root.dart' as package_root; +import 'package:analyzer_testing/package_root.dart' as package_root; import 'package:test/test.dart'; main() async {
diff --git a/pkg/analyzer/test/verify_tests_test.dart b/pkg/analyzer/test/verify_tests_test.dart index deca8ad..14adaf5 100644 --- a/pkg/analyzer/test/verify_tests_test.dart +++ b/pkg/analyzer/test/verify_tests_test.dart
@@ -4,7 +4,7 @@ import 'package:analyzer/file_system/file_system.dart'; import 'package:analyzer/file_system/physical_file_system.dart'; -import 'package:analyzer_utilities/package_root.dart' as package_root; +import 'package:analyzer_testing/package_root.dart' as package_root; import 'package:analyzer_utilities/verify_tests.dart'; import 'package:path/path.dart' as path;
diff --git a/pkg/analyzer/tool/api/generate.dart b/pkg/analyzer/tool/api/generate.dart index 76a533f..aa99d5b 100644 --- a/pkg/analyzer/tool/api/generate.dart +++ b/pkg/analyzer/tool/api/generate.dart
@@ -16,8 +16,8 @@ import 'package:analyzer/dart/element/type.dart'; import 'package:analyzer/file_system/physical_file_system.dart'; import 'package:analyzer/src/utilities/extensions/element.dart'; -import 'package:analyzer_utilities/package_root.dart' as pkg_root; -import 'package:analyzer_utilities/package_root.dart'; +import 'package:analyzer_testing/package_root.dart' as pkg_root; +import 'package:analyzer_testing/package_root.dart'; import 'package:analyzer_utilities/tools.dart'; import 'package:collection/collection.dart'; import 'package:path/path.dart';
diff --git a/pkg/analyzer/tool/benchmark/heap/flutter_elements.dart b/pkg/analyzer/tool/benchmark/heap/flutter_elements.dart index ef4b057..753a5cf 100644 --- a/pkg/analyzer/tool/benchmark/heap/flutter_elements.dart +++ b/pkg/analyzer/tool/benchmark/heap/flutter_elements.dart
@@ -15,7 +15,7 @@ import 'package:analyzer/src/dart/analysis/byte_store.dart'; import 'package:analyzer/src/dart/analysis/file_content_cache.dart'; import 'package:analyzer/src/dart/analysis/unlinked_unit_store.dart'; -import 'package:analyzer_utilities/package_root.dart'; +import 'package:analyzer_testing/package_root.dart'; import 'package:args/args.dart'; import 'package:heap_snapshot/analysis.dart'; import 'package:heap_snapshot/format.dart';
diff --git a/pkg/analyzer/tool/experiments/generate.dart b/pkg/analyzer/tool/experiments/generate.dart index 617aca9..a3bda02 100644 --- a/pkg/analyzer/tool/experiments/generate.dart +++ b/pkg/analyzer/tool/experiments/generate.dart
@@ -6,7 +6,7 @@ import 'package:_fe_analyzer_shared/src/scanner/characters.dart' show $MINUS, $_; -import 'package:analyzer_utilities/package_root.dart' as pkg_root; +import 'package:analyzer_testing/package_root.dart' as pkg_root; import 'package:analyzer_utilities/tools.dart'; import 'package:path/path.dart'; import 'package:yaml/yaml.dart' show YamlMap, loadYaml;
diff --git a/pkg/analyzer/tool/messages/error_code_info.dart b/pkg/analyzer/tool/messages/error_code_info.dart index 2b177f8..0ec8202 100644 --- a/pkg/analyzer/tool/messages/error_code_info.dart +++ b/pkg/analyzer/tool/messages/error_code_info.dart
@@ -5,7 +5,7 @@ import 'dart:convert'; import 'dart:io'; -import 'package:analyzer_utilities/package_root.dart' as pkg_root; +import 'package:analyzer_testing/package_root.dart' as pkg_root; import 'package:path/path.dart'; import 'package:yaml/yaml.dart' show loadYaml;
diff --git a/pkg/analyzer/tool/messages/extract_errors_to_yaml.dart b/pkg/analyzer/tool/messages/extract_errors_to_yaml.dart index e95be80..d8105b40 100644 --- a/pkg/analyzer/tool/messages/extract_errors_to_yaml.dart +++ b/pkg/analyzer/tool/messages/extract_errors_to_yaml.dart
@@ -18,7 +18,7 @@ import 'package:analyzer/src/dart/ast/token.dart'; import 'package:analyzer/src/dart/error/todo_codes.dart'; import 'package:analyzer/src/generated/parser.dart'; -import 'package:analyzer_utilities/package_root.dart' as pkg_root; +import 'package:analyzer_testing/package_root.dart' as pkg_root; import 'package:path/path.dart'; import 'package:yaml/yaml.dart';
diff --git a/pkg/analyzer/tool/messages/generate.dart b/pkg/analyzer/tool/messages/generate.dart index 499f846b..a240c4b 100644 --- a/pkg/analyzer/tool/messages/generate.dart +++ b/pkg/analyzer/tool/messages/generate.dart
@@ -20,7 +20,7 @@ import 'dart:io'; import 'package:_fe_analyzer_shared/src/scanner/scanner.dart'; -import 'package:analyzer_utilities/package_root.dart' as pkg_root; +import 'package:analyzer_testing/package_root.dart' as pkg_root; import 'package:analyzer_utilities/tools.dart'; import 'package:collection/collection.dart'; import 'package:path/path.dart';
diff --git a/pkg/analyzer/tool/summary/check_test.dart b/pkg/analyzer/tool/summary/check_test.dart index 4c9e87e..14f0eae 100644 --- a/pkg/analyzer/tool/summary/check_test.dart +++ b/pkg/analyzer/tool/summary/check_test.dart
@@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:analyzer_utilities/package_root.dart' as package_root; +import 'package:analyzer_testing/package_root.dart' as package_root; import 'package:analyzer_utilities/tools.dart'; import 'package:path/path.dart';
diff --git a/pkg/analyzer/tool/wolf/generate.dart b/pkg/analyzer/tool/wolf/generate.dart index 876c24c..c16d3b7 100644 --- a/pkg/analyzer/tool/wolf/generate.dart +++ b/pkg/analyzer/tool/wolf/generate.dart
@@ -4,7 +4,7 @@ import 'dart:convert'; -import 'package:analyzer_utilities/package_root.dart' as pkg_root; +import 'package:analyzer_testing/package_root.dart' as pkg_root; import 'package:analyzer_utilities/tools.dart'; import 'package:collection/collection.dart'; import 'package:path/path.dart';
diff --git a/pkg/analyzer_plugin/pubspec.yaml b/pkg/analyzer_plugin/pubspec.yaml index 986f60d..e0c79dd 100644 --- a/pkg/analyzer_plugin/pubspec.yaml +++ b/pkg/analyzer_plugin/pubspec.yaml
@@ -21,6 +21,7 @@ # best practice for packages is to specify their compatible version ranges. # See also https://dart.dev/tools/pub/dependencies. dev_dependencies: + analyzer_testing: any analyzer_utilities: any lints: any linter: any
diff --git a/pkg/analyzer_plugin/test/verify_tests_test.dart b/pkg/analyzer_plugin/test/verify_tests_test.dart index 1218879..1e798ca 100644 --- a/pkg/analyzer_plugin/test/verify_tests_test.dart +++ b/pkg/analyzer_plugin/test/verify_tests_test.dart
@@ -4,7 +4,7 @@ import 'package:analyzer/file_system/file_system.dart'; import 'package:analyzer/file_system/physical_file_system.dart'; -import 'package:analyzer_utilities/package_root.dart' as package_root; +import 'package:analyzer_testing/package_root.dart' as package_root; import 'package:analyzer_utilities/verify_tests.dart'; void main() {
diff --git a/pkg/analyzer_testing/OWNERS b/pkg/analyzer_testing/OWNERS new file mode 100644 index 0000000..711393e --- /dev/null +++ b/pkg/analyzer_testing/OWNERS
@@ -0,0 +1,2 @@ +file:/tools/OWNERS_DEVELOPER_EXPERIENCE +file:/tools/OWNERS_MODEL
diff --git a/pkg/analyzer_utilities/lib/package_root.dart b/pkg/analyzer_testing/lib/package_root.dart similarity index 68% rename from pkg/analyzer_utilities/lib/package_root.dart rename to pkg/analyzer_testing/lib/package_root.dart index c799ac0..923ff8a 100644 --- a/pkg/analyzer_utilities/lib/package_root.dart +++ b/pkg/analyzer_testing/lib/package_root.dart
@@ -4,34 +4,34 @@ import 'dart:io'; -import 'package:path/path.dart' as pathos; +import 'package:path/path.dart' as path; /// Returns a path to the directory containing source code for packages such as /// kernel, front_end, and analyzer. String get packageRoot { // If the package root directory is specified on the command line using - // -DpkgRoot=..., use it. + // `-DpkgRoot=...`, use that. const pkgRootVar = bool.hasEnvironment('pkgRoot') ? String.fromEnvironment('pkgRoot') : null; if (pkgRootVar != null) { - var path = pathos.join(Directory.current.path, pkgRootVar); - if (!path.endsWith(pathos.separator)) path += pathos.separator; - return path; + var pkgRootPath = path.join(Directory.current.path, pkgRootVar); + if (!pkgRootPath.endsWith(path.separator)) pkgRootPath += path.separator; + return pkgRootPath; } // Otherwise try to guess based on the script path. - var scriptPath = pathos.fromUri(Platform.script); + var scriptPath = path.fromUri(Platform.script); var pathFromScript = _tryGetPkgRoot(scriptPath); if (pathFromScript != null) { return pathFromScript; } - // Try google3 environment. We expect that all packages that will be + // Try a Bazel environment. We expect that all packages that will be // accessed via this root are configured in the BUILD file, and located // inside this single root. var runFiles = Platform.environment['TEST_SRCDIR']; var analyzerPackagesRoot = Platform.environment['ANALYZER_PACKAGES_ROOT']; if (runFiles != null && analyzerPackagesRoot != null) { - return pathos.join(runFiles, analyzerPackagesRoot); + return path.join(runFiles, analyzerPackagesRoot); } // Finally, try the current working directory. @@ -43,12 +43,12 @@ throw StateError('Unable to find sdk/pkg/ in $scriptPath'); } -/// Try to find the path to the pkg folder from [path]. -String? _tryGetPkgRoot(String path) { - var parts = pathos.split(path); +/// Tries to find the path to the 'pkg' folder from [searchPath]. +String? _tryGetPkgRoot(String searchPath) { + var parts = path.split(searchPath); var pkgIndex = parts.indexOf('pkg'); if (pkgIndex != -1) { - return pathos.joinAll(parts.sublist(0, pkgIndex + 1)) + pathos.separator; + return path.joinAll(parts.sublist(0, pkgIndex + 1)) + path.separator; } return null; }
diff --git a/pkg/analyzer_testing/pubspec.yaml b/pkg/analyzer_testing/pubspec.yaml index 7814c0a..d3d6c29 100644 --- a/pkg/analyzer_testing/pubspec.yaml +++ b/pkg/analyzer_testing/pubspec.yaml
@@ -4,3 +4,13 @@ sdk: ^3.7.0 resolution: workspace + +dependencies: + path: ^1.9.0 + +# We use 'any' version constraints here as we get our package versions from +# the dart-lang/sdk repo's DEPS file. Note that this is a special case; the +# best practice for packages is to specify their compatible version ranges. +# See also https://dart.dev/tools/pub/dependencies. +dev_dependencies: + lints: any
diff --git a/pkg/analyzer_utilities/lib/test/mock_packages/mock_packages.dart b/pkg/analyzer_utilities/lib/test/mock_packages/mock_packages.dart index 9652899..2c01812 100644 --- a/pkg/analyzer_utilities/lib/test/mock_packages/mock_packages.dart +++ b/pkg/analyzer_utilities/lib/test/mock_packages/mock_packages.dart
@@ -6,7 +6,7 @@ import 'package:analyzer/file_system/physical_file_system.dart'; // ignore: implementation_imports import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart'; -import 'package:analyzer_utilities/package_root.dart' as package_root; +import 'package:analyzer_testing/package_root.dart' as package_root; import 'package:path/path.dart' as path; void _cacheFiles(Map<String, String> cachedFiles) {
diff --git a/pkg/analyzer_utilities/pubspec.yaml b/pkg/analyzer_utilities/pubspec.yaml index a4a2d7a..3845369 100644 --- a/pkg/analyzer_utilities/pubspec.yaml +++ b/pkg/analyzer_utilities/pubspec.yaml
@@ -9,6 +9,7 @@ # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: + analyzer_testing: any analyzer: any dart_style: any package_config: any
diff --git a/tests/language/records/simple/constants_and_field_access_test.dart b/tests/language/records/simple/constants_and_field_access_test.dart index 746b96e..7e7a5a3 100644 --- a/tests/language/records/simple/constants_and_field_access_test.dart +++ b/tests/language/records/simple/constants_and_field_access_test.dart
@@ -12,8 +12,12 @@ Expect.equals(e2, r.$2); } -void checkRecordP3(Object? e1, Object? e2, Object? e3, - (Object? e1, Object? e2, Object? e3) r) { +void checkRecordP3( + Object? e1, + Object? e2, + Object? e3, + (Object? e1, Object? e2, Object? e3) r, +) { Expect.equals(e1, r.$1); Expect.equals(e2, r.$2); Expect.equals(e3, r.$3); @@ -28,8 +32,12 @@ Expect.equals(bar, r.bar); } -void checkRecordN3(Object? foo, Object? bar, Object? baz, - ({Object? foo, Object? bar, Object? baz}) r) { +void checkRecordN3( + Object? foo, + Object? bar, + Object? baz, + ({Object? foo, Object? bar, Object? baz}) r, +) { Expect.equals(foo, r.foo); Expect.equals(bar, r.bar); Expect.equals(baz, r.baz); @@ -41,27 +49,25 @@ } void checkRecordP1N2( - Object? e1, - Object? foo, - Object? bar, - ( - Object? e1, { - Object? foo, - Object? bar, - }) r) { + Object? e1, + Object? foo, + Object? bar, + (Object? e1, {Object? foo, Object? bar}) r, +) { Expect.equals(e1, r.$1); Expect.equals(foo, r.foo); Expect.equals(bar, r.bar); } void checkRecordP3N3( - Object? e1, - Object? e2, - Object? e3, - Object? foo, - Object? bar, - Object? baz, - (Object?, Object?, Object?, {Object? foo, Object? baz, Object? bar}) r) { + Object? e1, + Object? e2, + Object? e3, + Object? foo, + Object? bar, + Object? baz, + (Object?, Object?, Object?, {Object? foo, Object? baz, Object? bar}) r, +) { Expect.equals(bar, r.bar); Expect.equals(foo, r.foo); Expect.equals(baz, r.baz); @@ -92,7 +98,10 @@ checkRecordN1(const [1, 2, 3], const (foo: [1, 2, 3])); checkRecordN2( - const {1, 2, 3}, const A(20), const (foo: const {1, 2, 3}, bar: A(20))); + const {1, 2, 3}, + const A(20), + const (foo: const {1, 2, 3}, bar: A(20)), + ); checkRecordN3(A(10), 1.0, 42, const (foo: A(10), bar: 1.0, baz: 40 + 2)); @@ -101,18 +110,12 @@ checkRecordP1N2(A(1), A(2), A(3), const (foo: A(2), A(1), bar: A(3))); checkRecordP3N3( - 1, - 2.0, - 'hey', - A(10), - const A(20), - const ['hi'], - const ( - 2 - 1, - 2.0, - 'h' + 'ey', - foo: A(3 + 7), - baz: ['hi'], - bar: A(10 * 2), - )); + 1, + 2.0, + 'hey', + A(10), + const A(20), + const ['hi'], + const (2 - 1, 2.0, 'h' + 'ey', foo: A(3 + 7), baz: ['hi'], bar: A(10 * 2)), + ); }
diff --git a/tests/language/records/simple/dynamic_field_access_test.dart b/tests/language/records/simple/dynamic_field_access_test.dart index f158317..eed9de7 100644 --- a/tests/language/records/simple/dynamic_field_access_test.dart +++ b/tests/language/records/simple/dynamic_field_access_test.dart
@@ -28,8 +28,9 @@ ? const (10, 'a', foo: [1], bar: (50, baz: 60)) as dynamic : A(); dynamic r4 = runtimeTrue ? (foo1, foo2: foo2) as dynamic : A(); -dynamic r5 = - runtimeTrue ? (10, $2: 20, $1000000000000000000: 'meow') as dynamic : A(); +dynamic r5 = runtimeTrue + ? (10, $2: 20, $1000000000000000000: 'meow') as dynamic + : A(); main() { Expect.equals(2, r1.$1); @@ -38,7 +39,8 @@ Expect.throwsNoSuchMethodError(() => r1.$4); Expect.throwsNoSuchMethodError(() => r1.$10000000000); Expect.throwsNoSuchMethodError( - () => r1.$99999999999999999999999999999999999999999999999); + () => r1.$99999999999999999999999999999999999999999999999, + ); Expect.throwsNoSuchMethodError(() => r1.foo); Expect.equals((2, 3).toString(), r1.toString()); Expect.throwsNoSuchMethodError(() {
diff --git a/tests/language/records/simple/equals_and_hashcode_test.dart b/tests/language/records/simple/equals_and_hashcode_test.dart index e07a8b3..d9a81d6 100644 --- a/tests/language/records/simple/equals_and_hashcode_test.dart +++ b/tests/language/records/simple/equals_and_hashcode_test.dart
@@ -46,10 +46,14 @@ main() { checkEqualsAndHash((1, 2), (1, 2)); checkEqualsAndHash((1, 2), const (1, 2)); - checkEqualsAndHash(const (42, foo: "hello3"), - (foo: "hello${int.parse("3")}", 40 + int.parse("2"))); - checkEqualsAndHash((1, 2, 3, foo: 4, bar: 5, baz: 6), - (baz: 6, 1, bar: 5, 2, foo: 4, int.parse("3"))); + checkEqualsAndHash( + const (42, foo: "hello3"), + (foo: "hello${int.parse("3")}", 40 + int.parse("2")), + ); + checkEqualsAndHash( + (1, 2, 3, foo: 4, bar: 5, baz: 6), + (baz: 6, 1, bar: 5, 2, foo: 4, int.parse("3")), + ); checkEqualsAndHash((foo: 1, 2), (2, foo: 1)); checkEqualsAndHash((foo: 3), (foo: 3));
diff --git a/tests/language/records/simple/literals_and_field_access_test.dart b/tests/language/records/simple/literals_and_field_access_test.dart index b5cd3f4..28604a5 100644 --- a/tests/language/records/simple/literals_and_field_access_test.dart +++ b/tests/language/records/simple/literals_and_field_access_test.dart
@@ -9,8 +9,12 @@ Expect.equals(e2, r.$2); } -void checkRecordP3(Object? e1, Object? e2, Object? e3, - (Object? e1, Object? e2, Object? e3) r) { +void checkRecordP3( + Object? e1, + Object? e2, + Object? e3, + (Object? e1, Object? e2, Object? e3) r, +) { Expect.equals(e1, r.$1); Expect.equals(e2, r.$2); Expect.equals(e3, r.$3); @@ -25,8 +29,12 @@ Expect.equals(bar, r.bar); } -void checkRecordN3(Object? foo, Object? bar, Object? baz, - ({Object? foo, Object? bar, Object? baz}) r) { +void checkRecordN3( + Object? foo, + Object? bar, + Object? baz, + ({Object? foo, Object? bar, Object? baz}) r, +) { Expect.equals(foo, r.foo); Expect.equals(bar, r.bar); Expect.equals(baz, r.baz); @@ -38,27 +46,25 @@ } void checkRecordP1N2( - Object? e1, - Object? foo, - Object? bar, - ( - Object? e1, { - Object? foo, - Object? bar, - }) r) { + Object? e1, + Object? foo, + Object? bar, + (Object? e1, {Object? foo, Object? bar}) r, +) { Expect.equals(e1, r.$1); Expect.equals(foo, r.foo); Expect.equals(bar, r.bar); } void checkRecordP3N3( - Object? e1, - Object? e2, - Object? e3, - Object? foo, - Object? bar, - Object? baz, - (Object?, Object?, Object?, {Object? foo, Object? baz, Object? bar}) r) { + Object? e1, + Object? e2, + Object? e3, + Object? foo, + Object? bar, + Object? baz, + (Object?, Object?, Object?, {Object? foo, Object? baz, Object? bar}) r, +) { Expect.equals(bar, r.bar); Expect.equals(foo, r.foo); Expect.equals(baz, r.baz); @@ -76,20 +82,16 @@ return getP1N1Rec(n - 1, x, y); } -( - dynamic, - dynamic, - dynamic, { - dynamic foo, - dynamic bar, - dynamic baz, -}) getP3N3(int i, String s) { +(dynamic, dynamic, dynamic, {dynamic foo, dynamic bar, dynamic baz}) getP3N3( + int i, + String s, +) { (dynamic, dynamic, {dynamic foo, dynamic qq, dynamic baz}) r1 = ( s.substring(i, i + 1), s.substring(i, i + 2), foo: s.substring(i, i + 4), qq: i, - baz: s.substring(i, i + 6) + baz: s.substring(i, i + 6), ); (dynamic, dynamic, dynamic, {dynamic foo, dynamic bar, dynamic baz}) r2 = ( r1.$1, @@ -97,7 +99,7 @@ s.substring(i, i + 3), foo: r1.foo, bar: s.substring(i, i + 5), - baz: r1.baz + baz: r1.baz, ); return r2; } @@ -116,16 +118,28 @@ final x = [1, 2, 3]; checkRecordN1(x, getN1(x)); - checkRecordN2("0 1 2", "[1, 2, 3]", - (foo: [for (int i = 0; i < 3; ++i) i].join(' '), bar: x.toString())); + checkRecordN2("0 1 2", "[1, 2, 3]", ( + foo: [for (int i = 0; i < 3; ++i) i].join(' '), + bar: x.toString(), + )); - checkRecordN3( - A(10), 1.0, 42, (foo: A(9 + int.parse("1")), bar: 1.0, baz: 40 + A(2).v)); + checkRecordN3(A(10), 1.0, 42, ( + foo: A(9 + int.parse("1")), + bar: 1.0, + baz: 40 + A(2).v, + )); checkRecordP1N1(10, "abc", getP1N1(10, "abc")); checkRecordP1N2(A(1), A(2), A(3), (foo: A(2), A(1), bar: A(3))); - checkRecordP3N3("h", "he", "hel", "hell", "hello", "hello,", - [for (int i = 0; i < 3; ++i) getP3N3(i, "hello, world")][0]); + checkRecordP3N3( + "h", + "he", + "hel", + "hell", + "hello", + "hello,", + [for (int i = 0; i < 3; ++i) getP3N3(i, "hello, world")][0], + ); }
diff --git a/tests/language/records/simple/runtime_type_test.dart b/tests/language/records/simple/runtime_type_test.dart index fb83a2c..9ea7afa 100644 --- a/tests/language/records/simple/runtime_type_test.dart +++ b/tests/language/records/simple/runtime_type_test.dart
@@ -41,7 +41,9 @@ Expect.equals(getType2<(B, A)>(), getType1((b1, a3))); Expect.equals(getType2<({A bar, B foo})>(), getType1((foo: b1, bar: a2))); Expect.equals( - getType2<(A, B, {A bar, B foo})>(), getType1((a1, foo: b1, b2, bar: a2))); + getType2<(A, B, {A bar, B foo})>(), + getType1((a1, foo: b1, b2, bar: a2)), + ); testRuntimeTypeEquality(true, (a1, a2), (a3, a4)); testRuntimeTypeEquality(false, (a1, a2), (a1, a2, a3));
diff --git a/tests/language/records/simple/to_string_test.dart b/tests/language/records/simple/to_string_test.dart index 19c6c5c..2b414f8 100644 --- a/tests/language/records/simple/to_string_test.dart +++ b/tests/language/records/simple/to_string_test.dart
@@ -26,14 +26,16 @@ Expect.equals("(1, foo: 2)", (foo: 2, 1).toString()); Expect.equals( - "(1, abc, bar: 3, foo: 2)", (1, foo: 2, "abc", bar: 3).toString()); + "(1, abc, bar: 3, foo: 2)", + (1, foo: 2, "abc", bar: 3).toString(), + ); Expect.equals( - "((A1, A2), (foo: A3), (A7, bar: A5, baz: A6, foo: A4))", - ( - (A("A1"), A("A2")), - const (foo: A("A3")), - (foo: A("A4"), bar: A("A5"), baz: A("A6"), A("A7")) - ) - .toString()); + "((A1, A2), (foo: A3), (A7, bar: A5, baz: A6, foo: A4))", + ( + (A("A1"), A("A2")), + const (foo: A("A3")), + (foo: A("A4"), bar: A("A5"), baz: A("A6"), A("A7")), + ).toString(), + ); }
diff --git a/tests/language/records/simple/type_checks2_test.dart b/tests/language/records/simple/type_checks2_test.dart index 77564eb..8aa340a 100644 --- a/tests/language/records/simple/type_checks2_test.dart +++ b/tests/language/records/simple/type_checks2_test.dart
@@ -27,10 +27,12 @@ } B<(num, num)> b1 = (int.parse('1') == 1) ? B<(int, int)>() : B<(num, num)>(); -B<({num foo})?> b2 = - (int.parse('1') == 1) ? B<({int foo})>() : B<({num foo})?>(); -B<(num?, {num? foo})?> b3 = - (int.parse('1') == 1) ? B<(int, {int? foo})?>() : B<(num?, {num? foo})?>(); +B<({num foo})?> b2 = (int.parse('1') == 1) + ? B<({int foo})>() + : B<({num foo})?>(); +B<(num?, {num? foo})?> b3 = (int.parse('1') == 1) + ? B<(int, {int? foo})?>() + : B<(num?, {num? foo})?>(); C d1 = (int.parse('1') == 1) ? D1() : C(); C d2 = (int.parse('1') == 1) ? D2() : C();
diff --git a/tests/language/records/simple/type_checks3_test.dart b/tests/language/records/simple/type_checks3_test.dart index 10f6840..0991277 100644 --- a/tests/language/records/simple/type_checks3_test.dart +++ b/tests/language/records/simple/type_checks3_test.dart
@@ -15,10 +15,12 @@ } B<(num, num)> b1 = (int.parse('1') == 1) ? B<(int, int)>() : B<(num, num)>(); -B<({num foo})?> b2 = - (int.parse('1') == 1) ? B<({int foo})>() : B<({num foo})?>(); -B<(num?, {num? foo})?> b3 = - (int.parse('1') == 1) ? B<(int, {int? foo})?>() : B<(num?, {num? foo})?>(); +B<({num foo})?> b2 = (int.parse('1') == 1) + ? B<({int foo})>() + : B<({num foo})?>(); +B<(num?, {num? foo})?> b3 = (int.parse('1') == 1) + ? B<(int, {int? foo})?>() + : B<(num?, {num? foo})?>(); doTests() { b1 as B<(int, int)>;
diff --git a/tests/language/records/simple/type_checks_test.dart b/tests/language/records/simple/type_checks_test.dart index 809d994..deed29c 100644 --- a/tests/language/records/simple/type_checks_test.dart +++ b/tests/language/records/simple/type_checks_test.dart
@@ -38,22 +38,43 @@ Expect.isFalse(getN2(<int>[], 10) is ({List foo, num bar, int baz})); Expect.isFalse(getN2(<int>[], 10) is (List foo, {num bar})); - Expect.isTrue(getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) - is (List<int>, Map<int, String>, {A<num> foo, int bar})); - Expect.isTrue(getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) - is (List<int?>, Map<int?, String?>, {A<num?> foo, int? bar})); - Expect.isTrue(getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) - is (List<dynamic>, Map<dynamic, dynamic>, {A<dynamic> foo, dynamic bar})); - Expect.isTrue(getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) - is (dynamic, dynamic, {dynamic foo, dynamic bar})); - Expect.isFalse(getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) - is (dynamic, dynamic, {dynamic foo, dynamic baz})); - Expect.isFalse(getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) - is (dynamic, dynamic, dynamic, {dynamic foo, dynamic bar})); - Expect.isFalse(getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) - is (dynamic, dynamic, dynamic foo, dynamic bar)); - Expect.isFalse(getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) - is (dynamic, dynamic, {dynamic foo, dynamic bar, dynamic baz})); + Expect.isTrue( + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) + is (List<int>, Map<int, String>, {A<num> foo, int bar}), + ); + Expect.isTrue( + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) + is (List<int?>, Map<int?, String?>, {A<num?> foo, int? bar}), + ); + Expect.isTrue( + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) + is ( + List<dynamic>, + Map<dynamic, dynamic>, { + A<dynamic> foo, + dynamic bar, + }), + ); + Expect.isTrue( + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) + is (dynamic, dynamic, {dynamic foo, dynamic bar}), + ); + Expect.isFalse( + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) + is (dynamic, dynamic, {dynamic foo, dynamic baz}), + ); + Expect.isFalse( + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) + is (dynamic, dynamic, dynamic, {dynamic foo, dynamic bar}), + ); + Expect.isFalse( + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) + is (dynamic, dynamic, dynamic foo, dynamic bar), + ); + Expect.isFalse( + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) + is (dynamic, dynamic, {dynamic foo, dynamic bar, dynamic baz}), + ); } verifyAsChecks() { @@ -77,47 +98,51 @@ Expect.throwsTypeError(() => getN2(<int>[], 10) as ({List bar, num foo})); Expect.throwsTypeError(() => getN2(<int>[], 10) as ({List foo})); Expect.throwsTypeError( - () => getN2(<int>[], 10) as ({List foo, num bar, int baz})); + () => getN2(<int>[], 10) as ({List foo, num bar, int baz}), + ); Expect.throwsTypeError(() => getN2(<int>[], 10) as (List foo, {num bar})); - results.add(getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) - as (List<int>, Map<int, String>, {A<num> foo, int bar})); - results.add(getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) - as (List<int?>, Map<int?, String?>, {A<num?> foo, int? bar})); - results.add(getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) - as (List<dynamic>, Map<dynamic, dynamic>, {A<dynamic> foo, dynamic bar})); - results.add(getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) - as (dynamic, dynamic, {dynamic foo, dynamic bar})); - Expect.throwsTypeError(() => - getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) as ( - dynamic, - dynamic, { - dynamic foo, - dynamic baz - })); - Expect.throwsTypeError(() => - getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) as ( - dynamic, - dynamic, - dynamic, { - dynamic foo, - dynamic bar - })); - Expect.throwsTypeError(() => - getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) as ( - dynamic, - dynamic, - dynamic foo, - dynamic bar - )); - Expect.throwsTypeError(() => - getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) as ( - dynamic, - dynamic, { - dynamic foo, - dynamic bar, - dynamic baz - })); + results.add( + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) + as (List<int>, Map<int, String>, {A<num> foo, int bar}), + ); + results.add( + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) + as (List<int?>, Map<int?, String?>, {A<num?> foo, int? bar}), + ); + results.add( + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) + as ( + List<dynamic>, + Map<dynamic, dynamic>, { + A<dynamic> foo, + dynamic bar, + }), + ); + results.add( + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) + as (dynamic, dynamic, {dynamic foo, dynamic bar}), + ); + Expect.throwsTypeError( + () => + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) + as (dynamic, dynamic, {dynamic foo, dynamic baz}), + ); + Expect.throwsTypeError( + () => + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) + as (dynamic, dynamic, dynamic, {dynamic foo, dynamic bar}), + ); + Expect.throwsTypeError( + () => + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) + as (dynamic, dynamic, dynamic foo, dynamic bar), + ); + Expect.throwsTypeError( + () => + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10) + as (dynamic, dynamic, {dynamic foo, dynamic bar, dynamic baz}), + ); return results; } @@ -139,60 +164,67 @@ checkParameterType<(int foo, String bar)>(getP2(10, 'abc')); checkParameterType<(int bar, String foo)>(getP2(10, 'abc')); Expect.throwsTypeError( - () => checkParameterType<(String bar, int foo)>(getP2(10, 'abc'))); + () => checkParameterType<(String bar, int foo)>(getP2(10, 'abc')), + ); Expect.throwsTypeError( - () => checkParameterType<({int foo, String bar})>(getP2(10, 'abc'))); + () => checkParameterType<({int foo, String bar})>(getP2(10, 'abc')), + ); Expect.throwsTypeError( - () => checkParameterType<(int foo, {String bar})>(getP2(10, 'abc'))); + () => checkParameterType<(int foo, {String bar})>(getP2(10, 'abc')), + ); checkParameterType<({List foo, num bar})>(getN2(<int>[], 10)); checkParameterType<({List<int> foo, Object bar})>(getN2(<int>[], 10)); checkParameterType<({List<num> foo, int bar})>(getN2(<int>[], 10)); checkParameterType<({num bar, List foo})>(getN2(<int>[], 10)); Expect.throwsTypeError( - () => checkParameterType<({List bar, num foo})>(getN2(<int>[], 10))); + () => checkParameterType<({List bar, num foo})>(getN2(<int>[], 10)), + ); Expect.throwsTypeError( - () => checkParameterType<({List foo})>(getN2(<int>[], 10))); - Expect.throwsTypeError(() => - checkParameterType<({List foo, num bar, int baz})>(getN2(<int>[], 10))); + () => checkParameterType<({List foo})>(getN2(<int>[], 10)), + ); Expect.throwsTypeError( - () => checkParameterType<(List foo, {num bar})>(getN2(<int>[], 10))); + () => + checkParameterType<({List foo, num bar, int baz})>(getN2(<int>[], 10)), + ); + Expect.throwsTypeError( + () => checkParameterType<(List foo, {num bar})>(getN2(<int>[], 10)), + ); checkParameterType<(List<int>, Map<int, String>, {A<num> foo, int bar})>( - getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10)); + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10), + ); checkParameterType<(List<int?>, Map<int?, String?>, {A<num?> foo, int? bar})>( - getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10)); + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10), + ); checkParameterType< - ( - List<dynamic>, - Map<dynamic, dynamic>, { - A<dynamic> foo, - dynamic bar - })>(getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10)); + (List<dynamic>, Map<dynamic, dynamic>, {A<dynamic> foo, dynamic bar}) + >(getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10)); checkParameterType<(dynamic, dynamic, {dynamic foo, dynamic bar})>( - getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10)); - Expect.throwsTypeError(() => - checkParameterType<(dynamic, dynamic, {dynamic foo, dynamic baz})>( - getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10))); - Expect.throwsTypeError(() => checkParameterType< - ( - dynamic, - dynamic, - dynamic, { - dynamic foo, - dynamic bar - })>(getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10))); - Expect.throwsTypeError(() => - checkParameterType<(dynamic, dynamic, dynamic foo, dynamic bar)>( - getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10))); - Expect.throwsTypeError(() => checkParameterType< - ( - dynamic, - dynamic, { - dynamic foo, - dynamic bar, - dynamic baz - })>(getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10))); + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10), + ); + Expect.throwsTypeError( + () => checkParameterType<(dynamic, dynamic, {dynamic foo, dynamic baz})>( + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10), + ), + ); + Expect.throwsTypeError( + () => + checkParameterType< + (dynamic, dynamic, dynamic, {dynamic foo, dynamic bar}) + >(getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10)), + ); + Expect.throwsTypeError( + () => checkParameterType<(dynamic, dynamic, dynamic foo, dynamic bar)>( + getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10), + ), + ); + Expect.throwsTypeError( + () => + checkParameterType< + (dynamic, dynamic, {dynamic foo, dynamic bar, dynamic baz}) + >(getP2N2(const <int>[42], <int, String>{1: 'hi'}, A<num>(), 10)), + ); } checkTypeParameterBound<T, Bound>() { @@ -206,33 +238,48 @@ checkTypeParameterBound<(int, int), (int, int?)>(); checkTypeParameterBound<(int, int), (int, int)?>(); Expect.throwsTypeError( - () => checkTypeParameterBound<(int, Object), (int, int)>()); + () => checkTypeParameterBound<(int, Object), (int, int)>(), + ); if (!unsoundNullSafety) { Expect.throwsTypeError( - () => checkTypeParameterBound<(int, int?), (int, int)>()); + () => checkTypeParameterBound<(int, int?), (int, int)>(), + ); Expect.throwsTypeError( - () => checkTypeParameterBound<(int, int)?, (int, int)>()); + () => checkTypeParameterBound<(int, int)?, (int, int)>(), + ); } checkTypeParameterBound<(String, {int foo}), (String, {int foo})>(); - Expect.throwsTypeError(() => - checkTypeParameterBound<(String, {int foo}), (String, {int bar})>()); - Expect.throwsTypeError(() => - checkTypeParameterBound<(String, {num foo}), (String, {int foo})>()); + Expect.throwsTypeError( + () => checkTypeParameterBound<(String, {int foo}), (String, {int bar})>(), + ); + Expect.throwsTypeError( + () => checkTypeParameterBound<(String, {num foo}), (String, {int foo})>(), + ); if (!unsoundNullSafety) { - Expect.throwsTypeError(() => - checkTypeParameterBound<(String, {int? foo}), (String, {int foo})>()); + Expect.throwsTypeError( + () => + checkTypeParameterBound<(String, {int? foo}), (String, {int foo})>(), + ); } checkTypeParameterBound<({int foo, Object bar}), ({Object bar, int foo})>(); - checkTypeParameterBound<({int foo, Object bar}), - ({Object foo, Object? bar})>(); - Expect.throwsTypeError(() => checkTypeParameterBound<({int foo, Object bar}), - ({Object foo, int bar})>()); + checkTypeParameterBound< + ({int foo, Object bar}), + ({Object foo, Object? bar}) + >(); + Expect.throwsTypeError( + () => + checkTypeParameterBound< + ({int foo, Object bar}), + ({Object foo, int bar}) + >(), + ); checkTypeParameterBound<(int, String, double), (num, String, num)>(); - Expect.throwsTypeError(() => - checkTypeParameterBound<(int, String, Object), (num, String, num)>()); + Expect.throwsTypeError( + () => checkTypeParameterBound<(int, String, Object), (num, String, num)>(), + ); } doTests() {
diff --git a/tests/language/records/type_inference_error_test.dart b/tests/language/records/type_inference_error_test.dart index 0b54f2d..808283b 100644 --- a/tests/language/records/type_inference_error_test.dart +++ b/tests/language/records/type_inference_error_test.dart
@@ -63,48 +63,60 @@ { // - Ki=_ and Si=Object?, so Ri=Object? and Si <: Ri; thus Ti=Si=Object?. var objQ = 0 as Object?; - contextRecordUnknown((objQ,) - ..expectStaticType<Exactly<(Object?,)>>() - ..$1.abs()); - // ^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE - // [cfe] The method 'abs' isn't defined for the class 'Object?'. - contextRecordNamedUnknown((f1: objQ) - ..expectStaticType<Exactly<({Object? f1})>>() - ..f1.abs()); - // ^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE - // [cfe] The method 'abs' isn't defined for the class 'Object?'. + contextRecordUnknown( + (objQ,) + ..expectStaticType<Exactly<(Object?,)>>() + ..$1.abs(), + // ^^^ + // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] The method 'abs' isn't defined for the class 'Object?'. + ); + contextRecordNamedUnknown( + (f1: objQ) + ..expectStaticType<Exactly<({Object? f1})>>() + ..f1.abs(), + // ^^^ + // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] The method 'abs' isn't defined for the class 'Object?'. + ); // - Ki=dynamic and Si=Object?, so Ri=dynamic and Si <: Ri; thus // Ti=Si=Object?. - context<(dynamic,)>((objQ,) - ..expectStaticType<Exactly<(Object?,)>>() - ..$1.abs()); - // ^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE - // [cfe] The method 'abs' isn't defined for the class 'Object?'. - context<({dynamic f1})>((f1: objQ) - ..expectStaticType<Exactly<({Object? f1})>>() - ..f1.abs()); - // ^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE - // [cfe] The method 'abs' isn't defined for the class 'Object?'. + context<(dynamic,)>( + (objQ,) + ..expectStaticType<Exactly<(Object?,)>>() + ..$1.abs(), + // ^^^ + // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] The method 'abs' isn't defined for the class 'Object?'. + ); + context<({dynamic f1})>( + (f1: objQ) + ..expectStaticType<Exactly<({Object? f1})>>() + ..f1.abs(), + // ^^^ + // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] The method 'abs' isn't defined for the class 'Object?'. + ); // - Ki=Object? and Si=Object?, so Ri=Object? and Si <: Ri; thus // Ti=Si=Object?. - context<(Object?,)>((objQ,) - ..expectStaticType<Exactly<(Object?,)>>() - ..$1.abs()); - // ^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE - // [cfe] The method 'abs' isn't defined for the class 'Object?'. - context<({Object? f1})>((f1: objQ) - ..expectStaticType<Exactly<({Object? f1})>>() - ..f1.abs()); - // ^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE - // [cfe] The method 'abs' isn't defined for the class 'Object?'. + context<(Object?,)>( + (objQ,) + ..expectStaticType<Exactly<(Object?,)>>() + ..$1.abs(), + // ^^^ + // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] The method 'abs' isn't defined for the class 'Object?'. + ); + context<({Object? f1})>( + (f1: objQ) + ..expectStaticType<Exactly<({Object? f1})>>() + ..f1.abs(), + // ^^^ + // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] The method 'abs' isn't defined for the class 'Object?'. + ); } // - Otherwise, if Si is dynamic, then we insert an implicit cast on ei to @@ -114,16 +126,20 @@ // TODO(paulberry): investigate why CFE doesn't produce the expected errors // here; it apparently is producing a type of `List<dynamic>`. var d = [1] as dynamic; - contextRecordListOfUnknown((d,) - ..expectStaticType<Exactly<(List<Object?>,)>>() - ..$1.first.abs()); - // ^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE - contextRecordNamedListOfUnknown((f1: d) - ..expectStaticType<Exactly<({List<Object?> f1})>>() - ..f1.first.abs); - // ^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + contextRecordListOfUnknown( + (d,) + ..expectStaticType<Exactly<(List<Object?>,)>>() + ..$1.first.abs(), + // ^^^ + // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + ); + contextRecordNamedListOfUnknown( + (f1: d) + ..expectStaticType<Exactly<({List<Object?> f1})>>() + ..f1.first.abs, + // ^^^ + // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + ); } // (No error tests are needed to cover the remaining of the spec text--this is
diff --git a/tests/language/records/type_inference_named_field_order_test.dart b/tests/language/records/type_inference_named_field_order_test.dart index f58ea2d..3fa57bd 100644 --- a/tests/language/records/type_inference_named_field_order_test.dart +++ b/tests/language/records/type_inference_named_field_order_test.dart
@@ -18,7 +18,7 @@ return ( a: o1 as int, b: [o1..expectStaticType<Exactly<int>>(), o2 as int], - c: o2..expectStaticType<Exactly<int>>() + c: o2..expectStaticType<Exactly<int>>(), ); } @@ -29,91 +29,105 @@ return ( c: o1 as int, b: [o1..expectStaticType<Exactly<int>>(), o2 as int], - a: o2..expectStaticType<Exactly<int>>() + a: o2..expectStaticType<Exactly<int>>(), ); } (Object, {Object a, Object b}) testSortedNamedFieldsAfterPositional( - Object o1, Object o2) { + Object o1, + Object o2, +) { // Check that `$1` is type inferred before `a` by promoting `o1` in `$1` and // checking its type in `a`. Check that `a` is type inferred before `b` by // promoting `o2` in `a` and checking its type in `b`. return ( o1 as int, a: [o1..expectStaticType<Exactly<int>>(), o2 as int], - b: o2..expectStaticType<Exactly<int>>() + b: o2..expectStaticType<Exactly<int>>(), ); } (Object, {Object a, Object b}) testReversedNamedFieldsAfterPositional( - Object o1, Object o2) { + Object o1, + Object o2, +) { // Check that `$1` is type inferred before `b` by promoting `o1` in `$1` and // checking its type in `b`. Check that `b` is type inferred before `a` by // promoting `o2` in `b` and checking its type in `a`. return ( o1 as int, b: [o1..expectStaticType<Exactly<int>>(), o2 as int], - a: o2..expectStaticType<Exactly<int>>() + a: o2..expectStaticType<Exactly<int>>(), ); } (Object, {Object a, Object b}) testSortedNamedFieldsBeforePositional( - Object o1, Object o2) { + Object o1, + Object o2, +) { // Check that `a` is type inferred before `b` by promoting `o1` in `a` and // checking its type in `b`. Check that `b` is type inferred before `$1` by // promoting `o2` in `b` and checking its type in `$1`. return ( a: o1 as int, b: [o1..expectStaticType<Exactly<int>>(), o2 as int], - o2..expectStaticType<Exactly<int>>() + o2..expectStaticType<Exactly<int>>(), ); } (Object, {Object a, Object b}) testReversedNamedFieldsBeforePositional( - Object o1, Object o2) { + Object o1, + Object o2, +) { // Check that `b` is type inferred before `a` by promoting `o1` in `b` and // checking its type in `a`. Check that `a` is type inferred before `$1` by // promoting `o2` in `a` and checking its type in `$1`. return ( b: o1 as int, a: [o1..expectStaticType<Exactly<int>>(), o2 as int], - o2..expectStaticType<Exactly<int>>() + o2..expectStaticType<Exactly<int>>(), ); } (Object, Object, {Object a}) testSingleNamedFieldAfterPositionals( - Object o1, Object o2) { + Object o1, + Object o2, +) { // Check that `$1` is type inferred before `$2` by promoting `o1` in `$1` and // checking its type in `$2`. Check that `$2` is type inferred before `a` by // promoting `o2` in `$2` and checking its type in `a`. return ( o1 as int, [o1..expectStaticType<Exactly<int>>(), o2 as int], - a: o2..expectStaticType<Exactly<int>>() + a: o2..expectStaticType<Exactly<int>>(), ); } (Object, Object, {Object a}) testSingleNamedFieldBetweenPositionals( - Object o1, Object o2) { + Object o1, + Object o2, +) { // Check that `$1` is type inferred before `a` by promoting `o1` in `$1` and // checking its type in `a`. Check that `a` is type inferred before `$2` by // promoting `o2` in `a` and checking its type in `$2`. return ( o1 as int, a: [o1..expectStaticType<Exactly<int>>(), o2 as int], - o2..expectStaticType<Exactly<int>>() + o2..expectStaticType<Exactly<int>>(), ); } (Object, Object, {Object a}) testSingleNamedFieldBeforePositionals( - Object o1, Object o2) { + Object o1, + Object o2, +) { // Check that `a` is type inferred before `$1` by promoting `o1` in `a` and // checking its type in `$1`. Check that `$1` is type inferred before `$2` by // promoting `o2` in `$1` and checking its type in `$2`. return ( a: o1 as int, [o1..expectStaticType<Exactly<int>>(), o2 as int], - o2..expectStaticType<Exactly<int>>() + o2..expectStaticType<Exactly<int>>(), ); }
diff --git a/tests/language/records/type_inference_test.dart b/tests/language/records/type_inference_test.dart index 60a41ef..1c50950 100644 --- a/tests/language/records/type_inference_test.dart +++ b/tests/language/records/type_inference_test.dart
@@ -57,16 +57,18 @@ contextType(1)..expectStaticType<Exactly<int>>(), contextType('')..expectStaticType<Exactly<String>>(), f1: contextType(1.0)..expectStaticType<Exactly<double>>(), - f2: contextType(1)..expectStaticType<Exactly<num>>() + f2: contextType(1)..expectStaticType<Exactly<num>>(), )); // Check that unknown contexts are properly propagated down: // - Positional field contextRecordListOfUnknown( - ([1, 2],)..expectStaticType<Exactly<(List<int>,)>>()); + ([1, 2],)..expectStaticType<Exactly<(List<int>,)>>(), + ); // - Named field contextRecordNamedListOfUnknown( - (f1: [1, 2])..expectStaticType<Exactly<({List<int> f1})>>()); + (f1: [1, 2])..expectStaticType<Exactly<({List<int> f1})>>(), + ); } // - Let Ri be the greatest closure of Ki @@ -77,56 +79,73 @@ // - Ki=Iterable<_> and Si=List<int>, so Ri=Iterable<Object?> and Si <: Ri; // thus Ti=Si=List<int>. contextRecordIterableOfUnknown( - (<int>[],)..expectStaticType<Exactly<(List<int>,)>>()); + (<int>[],)..expectStaticType<Exactly<(List<int>,)>>(), + ); contextRecordNamedIterableOfUnknown( - (f1: <int>[])..expectStaticType<Exactly<({List<int> f1})>>()); + (f1: <int>[])..expectStaticType<Exactly<({List<int> f1})>>(), + ); // - Ki=_ and Si=dynamic, so Ri=Object? and Si <: Ri; thus Ti=Si=dynamic. var d = 0 as dynamic; - contextRecordUnknown((d,) - ..expectStaticType<Exactly<(dynamic,)>>() - // Double check that it's truly `dynamic` (and not `Object?`) using a - // dynamic invocation. - ..$1.abs()); - contextRecordNamedUnknown((f1: d) - ..expectStaticType<Exactly<({dynamic f1})>>() - ..f1.abs()); + contextRecordUnknown( + (d,) + ..expectStaticType<Exactly<(dynamic,)>>() + // Double check that it's truly `dynamic` (and not `Object?`) using a + // dynamic invocation. + ..$1.abs(), + ); + contextRecordNamedUnknown( + (f1: d) + ..expectStaticType<Exactly<({dynamic f1})>>() + ..f1.abs(), + ); // - Ki=_ and Si=Object?, so Ri=Object? and Si <: Ri; thus Ti=Si=Object?. var objQ = 0 as Object?; contextRecordUnknown((objQ,)..expectStaticType<Exactly<(Object?,)>>()); contextRecordNamedUnknown( - (f1: objQ)..expectStaticType<Exactly<({Object? f1})>>()); + (f1: objQ)..expectStaticType<Exactly<({Object? f1})>>(), + ); // - Ki=dynamic and Si=dynamic, so Ri=dynamic and Si <: Ri; thus // Ti=Si=dynamic. - context<(dynamic,)>((d,) - ..expectStaticType<Exactly<(dynamic,)>>() - ..$1.abs()); - context<({dynamic f1})>((f1: d) - ..expectStaticType<Exactly<({dynamic f1})>>() - ..f1.abs()); + context<(dynamic,)>( + (d,) + ..expectStaticType<Exactly<(dynamic,)>>() + ..$1.abs(), + ); + context<({dynamic f1})>( + (f1: d) + ..expectStaticType<Exactly<({dynamic f1})>>() + ..f1.abs(), + ); // - Ki=dynamic and Si=Object?, so Ri=dynamic and Si <: Ri; thus // Ti=Si=Object?. context<(dynamic,)>((objQ,)..expectStaticType<Exactly<(Object?,)>>()); context<({dynamic f1})>( - (f1: objQ)..expectStaticType<Exactly<({Object? f1})>>()); + (f1: objQ)..expectStaticType<Exactly<({Object? f1})>>(), + ); // - Ki=Object? and Si=dynamic, so Ri=Object? and Si <: Ri; thus // Ti=Si=dynamic. - context<(Object?,)>((d,) - ..expectStaticType<Exactly<(dynamic,)>>() - ..$1.abs()); - context<({Object? f1})>((f1: d) - ..expectStaticType<Exactly<({dynamic f1})>>() - ..f1.abs()); + context<(Object?,)>( + (d,) + ..expectStaticType<Exactly<(dynamic,)>>() + ..$1.abs(), + ); + context<({Object? f1})>( + (f1: d) + ..expectStaticType<Exactly<({dynamic f1})>>() + ..f1.abs(), + ); // - Ki=Object? and Si=Object?, so Ri=Object? and Si <: Ri; thus // Ti=Si=Object?. context<(Object?,)>((objQ,)..expectStaticType<Exactly<(Object?,)>>()); context<({Object? f1})>( - (f1: objQ)..expectStaticType<Exactly<({Object? f1})>>()); + (f1: objQ)..expectStaticType<Exactly<({Object? f1})>>(), + ); } // - Otherwise, if Si is dynamic, then we insert an implicit cast on ei to @@ -135,9 +154,11 @@ // - Ki=List<_> and Si=dynamic, so Ri=List<Object?>; thus Ti=List<Object?>. var d = [1] as dynamic; contextRecordListOfUnknown( - (d,)..expectStaticType<Exactly<(List<Object?>,)>>()); + (d,)..expectStaticType<Exactly<(List<Object?>,)>>(), + ); contextRecordNamedListOfUnknown( - (f1: d)..expectStaticType<Exactly<({List<Object?> f1})>>()); + (f1: d)..expectStaticType<Exactly<({List<Object?> f1})>>(), + ); } // - Otherwise, if Si is coercible to Ri (via some sequence of call method @@ -149,9 +170,11 @@ // - Ki=_ Function() and Si=C, so Ri=Object? Function(); thus Ti=int // Function(). contextRecordFunctionReturningUnknown( - (C(),)..expectStaticType<Exactly<(int Function(),)>>()); + (C(),)..expectStaticType<Exactly<(int Function(),)>>(), + ); contextRecordNamedFunctionReturningUnknown( - (f1: C())..expectStaticType<Exactly<({int Function() f1})>>()); + (f1: C())..expectStaticType<Exactly<({int Function() f1})>>(), + ); } // - Otherwise, let Ti be Si.
diff --git a/tests/language/redirecting/constructor_initializer_test.dart b/tests/language/redirecting/constructor_initializer_test.dart index 6a2f451..f412960 100644 --- a/tests/language/redirecting/constructor_initializer_test.dart +++ b/tests/language/redirecting/constructor_initializer_test.dart
@@ -27,9 +27,7 @@ var w; // Call the redirecting constructor using super. - B() - : w = append('w'), - super(); + B() : w = append('w'), super(); } main() {
diff --git a/tests/language/redirecting/factory_default_values_runtime_test.dart b/tests/language/redirecting/factory_default_values_runtime_test.dart index a17a7d6..82c2dcf 100644 --- a/tests/language/redirecting/factory_default_values_runtime_test.dart +++ b/tests/language/redirecting/factory_default_values_runtime_test.dart
@@ -13,8 +13,6 @@ A(this.a, [this.b = 0]); factory A.f(int a) = A; - - int a; int b; } @@ -23,6 +21,4 @@ var x = new A.f(42); Expect.equals(x.a, 42); Expect.equals(x.b, 0); - - }
diff --git a/tests/language/redirecting/factory_default_values_test.dart b/tests/language/redirecting/factory_default_values_test.dart index 3c25607..f361a09 100644 --- a/tests/language/redirecting/factory_default_values_test.dart +++ b/tests/language/redirecting/factory_default_values_test.dart
@@ -33,8 +33,8 @@ Expect.equals(x.b, 0); var y = new A.f(42, 43); + // ^ + // [cfe] Too many positional arguments: 1 allowed, but 2 found. // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS - // ^^^^^^^^ - // [cfe] Too many positional arguments: 1 allowed, but 2 found. }
diff --git a/tests/language/redirecting/factory_incompatible_signature_runtime_test.dart b/tests/language/redirecting/factory_incompatible_signature_runtime_test.dart index b565714..b401c2e 100644 --- a/tests/language/redirecting/factory_incompatible_signature_runtime_test.dart +++ b/tests/language/redirecting/factory_incompatible_signature_runtime_test.dart
@@ -12,9 +12,6 @@ class A { A(a, b); - } -main() { - -} +main() {}
diff --git a/tests/language/redirecting/factory_malbounded_runtime_test.dart b/tests/language/redirecting/factory_malbounded_runtime_test.dart index 8cfc36b..2456bd7 100644 --- a/tests/language/redirecting/factory_malbounded_runtime_test.dart +++ b/tests/language/redirecting/factory_malbounded_runtime_test.dart
@@ -10,10 +10,7 @@ Foo.create() {} } -class Bar< - T - - > extends Foo<T> { +class Bar<T> extends Foo<T> { factory Bar() { return new Bar<T>.create(); }
diff --git a/tests/language/reg_exp/reg_exp_test.dart b/tests/language/reg_exp/reg_exp_test.dart index f606600..1419cb7 100644 --- a/tests/language/reg_exp/reg_exp_test.dart +++ b/tests/language/reg_exp/reg_exp_test.dart
@@ -18,8 +18,14 @@ // it includes the empty match at the end position. exp = new RegExp("a?"); str = "babba"; - Expect.listEquals(["", "a", "", "", "a", ""], - exp.allMatches(str).map((x) => x[0]).toList()); + Expect.listEquals([ + "", + "a", + "", + "", + "a", + "", + ], exp.allMatches(str).map((x) => x[0]).toList()); // Check that allMatches works with optional start index. exp = new RegExp("as{2}");
diff --git a/tests/language/regress/regress10204_test.dart b/tests/language/regress/regress10204_test.dart index 1f1619e..c25503a 100644 --- a/tests/language/regress/regress10204_test.dart +++ b/tests/language/regress/regress10204_test.dart
@@ -34,5 +34,7 @@ main() { Expect.equals( - 'nullnull', [new A()].last.visitInvokeDynamicMethod(new Node())); + 'nullnull', + [new A()].last.visitInvokeDynamicMethod(new Node()), + ); }
diff --git a/tests/language/regress/regress10783_test.dart b/tests/language/regress/regress10783_test.dart index ff1014d..06d6d8f 100644 --- a/tests/language/regress/regress10783_test.dart +++ b/tests/language/regress/regress10783_test.dart
@@ -12,7 +12,7 @@ main() { for (var b in [ - [false, 'pig'] + [false, 'pig'], ]) { var c; if (b[0] as bool) c = new C();
diff --git a/tests/language/regress/regress11724_runtime_test.dart b/tests/language/regress/regress11724_runtime_test.dart index 6cf180d..a8d70d7 100644 --- a/tests/language/regress/regress11724_runtime_test.dart +++ b/tests/language/regress/regress11724_runtime_test.dart
@@ -7,6 +7,4 @@ import "package:expect/expect.dart"; -void main() { - -} +void main() {}
diff --git a/tests/language/regress/regress11724_test.dart b/tests/language/regress/regress11724_test.dart index a408da1..90194e4 100644 --- a/tests/language/regress/regress11724_test.dart +++ b/tests/language/regress/regress11724_test.dart
@@ -6,7 +6,7 @@ void main() { method(<int>[]); -//^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_FUNCTION -// [cfe] Method not found: 'method'. + // [error column 3, length 6] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_FUNCTION + // [cfe] Method not found: 'method'. }
diff --git a/tests/language/regress/regress12284_test.dart b/tests/language/regress/regress12284_test.dart index aeaf366..c80004a 100644 --- a/tests/language/regress/regress12284_test.dart +++ b/tests/language/regress/regress12284_test.dart
@@ -22,6 +22,8 @@ // TODO(jmesserly): DDC throws an nSM if the argument types mismatch, // instead of a TypeError. // https://github.com/dart-lang/dev_compiler/issues/534 - Expect.throws(() => new A.redirect(), - (e) => e is ArgumentError || e is TypeError || e is NoSuchMethodError); + Expect.throws( + () => new A.redirect(), + (e) => e is ArgumentError || e is TypeError || e is NoSuchMethodError, + ); }
diff --git a/tests/language/regress/regress12561_test.dart b/tests/language/regress/regress12561_test.dart index 30bca27..d342884 100644 --- a/tests/language/regress/regress12561_test.dart +++ b/tests/language/regress/regress12561_test.dart
@@ -6,9 +6,9 @@ class C { noSuchMethod(int x, int y) => x + y; -//^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE -// [cfe] The method 'C.noSuchMethod' has more required arguments than those of overridden method 'Object.noSuchMethod'. + // [error column 3, length 12] + // [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE + // [cfe] The method 'C.noSuchMethod' has more required arguments than those of overridden method 'Object.noSuchMethod'. // ^ // [cfe] The parameter 'x' of the method 'C.noSuchMethod' has type 'int', which does not match the corresponding type, 'Invocation', in the overridden method, 'Object.noSuchMethod'. }
diff --git a/tests/language/regress/regress1363_runtime_test.dart b/tests/language/regress/regress1363_runtime_test.dart index 9a73e4b..4d937ce 100644 --- a/tests/language/regress/regress1363_runtime_test.dart +++ b/tests/language/regress/regress1363_runtime_test.dart
@@ -25,6 +25,5 @@ libCup = new lib.Cup<lib.C>(new lib.C()); C contents = myCup.getContents(); // expect no warning or error - } }
diff --git a/tests/language/regress/regress14014_2_test.dart b/tests/language/regress/regress14014_2_test.dart index c1193b9..3ddba92 100644 --- a/tests/language/regress/regress14014_2_test.dart +++ b/tests/language/regress/regress14014_2_test.dart
@@ -12,9 +12,9 @@ class B<T> extends A<T> { B({void f(T foo)?}) - : super((T a) { - f = (a) => 42; - }); + : super((T a) { + f = (a) => 42; + }); } main() {
diff --git a/tests/language/regress/regress15606_runtime_test.dart b/tests/language/regress/regress15606_runtime_test.dart index 539a0d7..8c402e1 100644 --- a/tests/language/regress/regress15606_runtime_test.dart +++ b/tests/language/regress/regress15606_runtime_test.dart
@@ -15,13 +15,12 @@ while (false) { // Comply to inlining heuristics. // Use an unresolved prefix. - var foo = - - bar( + var foo = bar( // Make dart2js generate a call to setRuntimeTypeInfo. new Foo<int>(), // Use a one-shot interceptor. - a[0].toString()); + a[0].toString(), + ); // Do an is test on `Foo` to require setRuntimeTypeInfo. print(foo is Foo<int>);
diff --git a/tests/language/regress/regress15606_test.dart b/tests/language/regress/regress15606_test.dart index ebee1e7..5fdd07b 100644 --- a/tests/language/regress/regress15606_test.dart +++ b/tests/language/regress/regress15606_test.dart
@@ -12,16 +12,16 @@ while (false) { // Comply to inlining heuristics. // Use an unresolved prefix. - var foo = - Unresolved. -// ^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Undefined name 'Unresolved'. - bar( + var foo = Unresolved.bar( + // ^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Undefined name 'Unresolved'. + // Make dart2js generate a call to setRuntimeTypeInfo. new Foo<int>(), // Use a one-shot interceptor. - a[0].toString()); + a[0].toString(), + ); // Do an is test on `Foo` to require setRuntimeTypeInfo. print(foo is Foo<int>);
diff --git a/tests/language/regress/regress1578_test.dart b/tests/language/regress/regress1578_test.dart index ad355ae..8f45f43 100644 --- a/tests/language/regress/regress1578_test.dart +++ b/tests/language/regress/regress1578_test.dart
@@ -5,10 +5,10 @@ // Regression test for issue 1578. ]~<)$ -// [error line 7, column 1, length 1] +// [error column 1, length 1] // [analyzer] SYNTACTIC_ERROR.EXPECTED_EXECUTABLE // [cfe] Expected a declaration, but got ']'. -// [error line 7, column 2, length 1] +// [error column 2, length 1] // [analyzer] SYNTACTIC_ERROR.EXPECTED_EXECUTABLE // [cfe] Expected a declaration, but got '~'. //^ @@ -19,7 +19,6 @@ // [cfe] Expected a declaration, but got ')'. // ^ // [analyzer] SYNTACTIC_ERROR.EXPECTED_TOKEN -// [cfe] Expected ';' after this. -// ^ // [analyzer] SYNTACTIC_ERROR.MISSING_CONST_FINAL_VAR_OR_TYPE +// [cfe] Expected ';' after this. // [cfe] Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
diff --git a/tests/language/regress/regress17382_test.dart b/tests/language/regress/regress17382_test.dart index a1e7714..c7bd1c1e 100644 --- a/tests/language/regress/regress17382_test.dart +++ b/tests/language/regress/regress17382_test.dart
@@ -16,9 +16,9 @@ main() { try { tl(m(0)); -// ^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_FUNCTION -// [cfe] Method not found: 'tl'. + // [error column 5, length 2] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_FUNCTION + // [cfe] Method not found: 'tl'. } catch (e) {} Expect.isTrue(mCalled); }
diff --git a/tests/language/regress/regress18628_1_runtime_test.dart b/tests/language/regress/regress18628_1_runtime_test.dart index 56d7377..88cf87f 100644 --- a/tests/language/regress/regress18628_1_runtime_test.dart +++ b/tests/language/regress/regress18628_1_runtime_test.dart
@@ -14,10 +14,8 @@ class C<T> { // This line is supposed to cause the warning; the other commented // line just doesn't make sense without this line. - } main() { C<Type> c = new C<Type>(); - }
diff --git a/tests/language/regress/regress18628_2_runtime_test.dart b/tests/language/regress/regress18628_2_runtime_test.dart index d604adb..947e748 100644 --- a/tests/language/regress/regress18628_2_runtime_test.dart +++ b/tests/language/regress/regress18628_2_runtime_test.dart
@@ -16,8 +16,4 @@ // This line is supposed to cause the warning; the other lines are // marked because they don't make sense when [Y] is not defined. - -main() { - - -} +main() {}
diff --git a/tests/language/regress/regress20394_runtime_test.dart b/tests/language/regress/regress20394_runtime_test.dart index fceb556..33e6285 100644 --- a/tests/language/regress/regress20394_runtime_test.dart +++ b/tests/language/regress/regress20394_runtime_test.dart
@@ -5,9 +5,7 @@ mixin M {} -class C extends Super with M { - -} +class C extends Super with M {} main() { new C();
diff --git a/tests/language/regress/regress20476_test.dart b/tests/language/regress/regress20476_test.dart index f0202be..cb6e471 100644 --- a/tests/language/regress/regress20476_test.dart +++ b/tests/language/regress/regress20476_test.dart
@@ -8,10 +8,12 @@ try { try { return 1; - } catch (e1) {} finally { + } catch (e1) { + } finally { return 3; } - } catch (e2) {} finally { + } catch (e2) { + } finally { return 5; } }
diff --git a/tests/language/regress/regress21793_runtime_test.dart b/tests/language/regress/regress21793_runtime_test.dart index 4bdd03b..40e9729 100644 --- a/tests/language/regress/regress21793_runtime_test.dart +++ b/tests/language/regress/regress21793_runtime_test.dart
@@ -9,12 +9,10 @@ import 'package:expect/expect.dart'; - class A { call(x) => x; } - main() { print(new A()(499)); }
diff --git a/tests/language/regress/regress21912_runtime_test.dart b/tests/language/regress/regress21912_runtime_test.dart index e44b17f..a02040f 100644 --- a/tests/language/regress/regress21912_runtime_test.dart +++ b/tests/language/regress/regress21912_runtime_test.dart
@@ -20,7 +20,5 @@ Function2<Function2<A, B>, Function2<B, A>> t1; Function2<AToB, BToA> t2; Function2<Function2<int, double>, Function2<int, double>> left; - - } }
diff --git a/tests/language/regress/regress21912_test.dart b/tests/language/regress/regress21912_test.dart index 7d261d3..34b0ea5 100644 --- a/tests/language/regress/regress21912_test.dart +++ b/tests/language/regress/regress21912_test.dart
@@ -14,9 +14,10 @@ void main() { test( - Function2<Function2<A, B>, Function2<B, A>> t1, - Function2<AToB, BToA> t2, - Function2<Function2<int, double>, Function2<int, double>> left) { + Function2<Function2<A, B>, Function2<B, A>> t1, + Function2<AToB, BToA> t2, + Function2<Function2<int, double>, Function2<int, double>> left, + ) { left = t1; // ^^ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
diff --git a/tests/language/regress/regress21998_3_test.dart b/tests/language/regress/regress21998_3_test.dart index ebd3782..2915550 100644 --- a/tests/language/regress/regress21998_3_test.dart +++ b/tests/language/regress/regress21998_3_test.dart
@@ -15,7 +15,6 @@ max(a) => a; m() { - return max( - Math.max<num>(lib2_max(1, 2), lib1.max('a', 'b', 'cd').length)); + return max(Math.max<num>(lib2_max(1, 2), lib1.max('a', 'b', 'cd').length)); } }
diff --git a/tests/language/regress/regress21998_4_test.dart b/tests/language/regress/regress21998_4_test.dart index 6bc8c03..c7ef030 100644 --- a/tests/language/regress/regress21998_4_test.dart +++ b/tests/language/regress/regress21998_4_test.dart
@@ -16,7 +16,11 @@ max(a) => a; m() { - return max(Math.max<num>( - lib3_max(0, lib2_max(1, 2)), lib1.max('a', 'b', 'cd').length)); + return max( + Math.max<num>( + lib3_max(0, lib2_max(1, 2)), + lib1.max('a', 'b', 'cd').length, + ), + ); } }
diff --git a/tests/language/regress/regress22936_test.dart b/tests/language/regress/regress22936_test.dart index ccbedef..265dbb0 100644 --- a/tests/language/regress/regress22936_test.dart +++ b/tests/language/regress/regress22936_test.dart
@@ -17,9 +17,9 @@ final x = null; try { x = foo(); -// ^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_LOCAL -// [cfe] Can't assign to the final variable 'x'. + // [error column 5, length 1] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_LOCAL + // [cfe] Can't assign to the final variable 'x'. } on NoSuchMethodError {} Expect.isTrue(fooCalled); }
diff --git a/tests/language/regress/regress22976_test.dart b/tests/language/regress/regress22976_test.dart index 3371f13..e6a9379a 100644 --- a/tests/language/regress/regress22976_test.dart +++ b/tests/language/regress/regress22976_test.dart
@@ -9,9 +9,8 @@ class B<T> implements A<T> {} class C<S, T> implements B<S>, A<T> {} -// [error line 11, column 7, length 1] -// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_GENERIC_INTERFACES // ^ +// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_GENERIC_INTERFACES // [cfe] 'C' can't implement both 'A<S>' and 'A<T>' main() { @@ -21,6 +20,5 @@ A<int> a1 = c2; // ^^ // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT - // ^ // [cfe] A value of type 'C<String, int>' can't be assigned to a variable of type 'A<int>'. }
diff --git a/tests/language/regress/regress23038_runtime_test.dart b/tests/language/regress/regress23038_runtime_test.dart index fb22db1..93823c9 100644 --- a/tests/language/regress/regress23038_runtime_test.dart +++ b/tests/language/regress/regress23038_runtime_test.dart
@@ -6,11 +6,7 @@ // BSD-style license that can be found in the LICENSE file. class C<T> { - const - - C() - - ; + const C(); } main() {
diff --git a/tests/language/regress/regress23038_test.dart b/tests/language/regress/regress23038_test.dart index 15e6699..c3a4515 100644 --- a/tests/language/regress/regress23038_test.dart +++ b/tests/language/regress/regress23038_test.dart
@@ -3,15 +3,11 @@ // BSD-style license that can be found in the LICENSE file. class C<T> { - const - factory - C() -//^ -// [cfe] Cyclic definition of factory 'C'. - = C<C<T>> - //^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.RECURSIVE_CONSTRUCTOR_REDIRECT - ; + const factory C() = C<C<T>>; + // ^ + // [cfe] Cyclic definition of factory 'C'. + // ^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.RECURSIVE_CONSTRUCTOR_REDIRECT } main() {
diff --git a/tests/language/regress/regress23089_test.dart b/tests/language/regress/regress23089_test.dart index a09ce13..a670cab 100644 --- a/tests/language/regress/regress23089_test.dart +++ b/tests/language/regress/regress23089_test.dart
@@ -27,22 +27,22 @@ // [analyzer] COMPILE_TIME_ERROR.NOT_INSTANTIATED_BOUND class _PeerRoom<P extends _Peer, C extends _P2PClient> -// ^^^^^ -// [analyzer] COMPILE_TIME_ERROR.NOT_INSTANTIATED_BOUND -// ^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.NOT_INSTANTIATED_BOUND - implements + // ^^^^^ + // [analyzer] COMPILE_TIME_ERROR.NOT_INSTANTIATED_BOUND + // ^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.NOT_INSTANTIATED_BOUND + implements IPeerRoom<P, C> {} abstract class _P2PClient<R extends _PeerRoom, P extends _Peer> -// ^ -// [cfe] Generic type '_P2PClient' can't be used without type arguments in the bounds of its own type variables. It is referenced indirectly through '_Peer'. -// [cfe] Generic type '_P2PClient' can't be used without type arguments in the bounds of its own type variables. It is referenced indirectly through '_PeerRoom'. -// ^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.NOT_INSTANTIATED_BOUND -// ^^^^^ -// [analyzer] COMPILE_TIME_ERROR.NOT_INSTANTIATED_BOUND - implements + // ^ + // [cfe] Generic type '_P2PClient' can't be used without type arguments in the bounds of its own type variables. It is referenced indirectly through '_Peer'. + // [cfe] Generic type '_P2PClient' can't be used without type arguments in the bounds of its own type variables. It is referenced indirectly through '_PeerRoom'. + // ^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.NOT_INSTANTIATED_BOUND + // ^^^^^ + // [analyzer] COMPILE_TIME_ERROR.NOT_INSTANTIATED_BOUND + implements IP2PClient<R> {} void main() {}
diff --git a/tests/language/regress/regress23244_test.dart b/tests/language/regress/regress23244_test.dart index c1163c3..b07f197 100644 --- a/tests/language/regress/regress23244_test.dart +++ b/tests/language/regress/regress23244_test.dart
@@ -7,9 +7,7 @@ import 'dart:isolate'; import 'package:expect/async_helper.dart'; -enum Fisk { - torsk, -} +enum Fisk { torsk } isolate1(Object port) { (port as SendPort).send(Fisk.torsk);
diff --git a/tests/language/regress/regress23996_test.dart b/tests/language/regress/regress23996_test.dart index d25d33a..f7560ff 100644 --- a/tests/language/regress/regress23996_test.dart +++ b/tests/language/regress/regress23996_test.dart
@@ -17,9 +17,10 @@ Completer pauseEventReceived = new Completer(); Completer resumeEventReceived = new Completer(); StreamController controller = new StreamController( - onListen: () => listenEventReceived.complete(), - onPause: () => pauseEventReceived.complete(), - onResume: () => resumeEventReceived.complete()); + onListen: () => listenEventReceived.complete(), + onPause: () => pauseEventReceived.complete(), + onResume: () => resumeEventReceived.complete(), + ); Completer forLoopEntered = new Completer();
diff --git a/tests/language/regress/regress25389_part.dart b/tests/language/regress/regress25389_part.dart index 254c87b..16a0957 100644 --- a/tests/language/regress/regress25389_part.dart +++ b/tests/language/regress/regress25389_part.dart
@@ -6,8 +6,11 @@ abstract class ComponentState<S extends ComponentState<S>> {} -abstract class AbstractListEditorState<D, - S extends AbstractListEditorState<D, S>> extends ComponentState<S> {} +abstract class AbstractListEditorState< + D, + S extends AbstractListEditorState<D, S> +> + extends ComponentState<S> {} class IssueListEditorState extends AbstractListEditorState<String, IssueListEditorState>
diff --git a/tests/language/regress/regress25568_test.dart b/tests/language/regress/regress25568_test.dart index 14d4986..300f6f3 100644 --- a/tests/language/regress/regress25568_test.dart +++ b/tests/language/regress/regress25568_test.dart
@@ -12,8 +12,11 @@ class BacklogsState extends MutableEntityState<BacklogsState> {} -abstract class AbstractListEditorState<ES extends ComponentState<ES>, - S extends AbstractListEditorState<ES, S>> extends ComponentState<S> {} +abstract class AbstractListEditorState< + ES extends ComponentState<ES>, + S extends AbstractListEditorState<ES, S> +> + extends ComponentState<S> {} abstract class ComponentState<S extends ComponentState<S>> {} @@ -21,4 +24,5 @@ extends ComponentState<ES> {} abstract class MutableEntityState<S extends MutableEntityState<S>> - extends EntityState<S> implements ComponentState<S> {} + extends EntityState<S> + implements ComponentState<S> {}
diff --git a/tests/language/regress/regress25935_test.dart b/tests/language/regress/regress25935_test.dart index 5b2e4e1..76ab7c3 100644 --- a/tests/language/regress/regress25935_test.dart +++ b/tests/language/regress/regress25935_test.dart
@@ -6,13 +6,17 @@ AddIssueSourceMember2 m = new AddIssueSourceMember2(); } -abstract class RepoListEditorState2<M extends RepoListMember2<M>, - S extends RepoListEditorState2<M, S>> +abstract class RepoListEditorState2< + M extends RepoListMember2<M>, + S extends RepoListEditorState2<M, S> +> extends AbstractListEditorState2<M, S> {} abstract class AbstractListEditorState2< - M extends AbstractListMember2<Object, M>, - S extends AbstractListEditorState2<M, S>> extends ComponentState2<S> {} + M extends AbstractListMember2<Object, M>, + S extends AbstractListEditorState2<M, S> +> + extends ComponentState2<S> {} class AddIssueSourceMember2 extends RepoListMember2<AddIssueSourceMember2> {}
diff --git a/tests/language/regress/regress26175_test.dart b/tests/language/regress/regress26175_test.dart index 9298a06..df398f7 100644 --- a/tests/language/regress/regress26175_test.dart +++ b/tests/language/regress/regress26175_test.dart
@@ -55,7 +55,9 @@ cell = 'a'; try { Expect.equals( - 'unreachable', '${throw 0}${await asyncWriteCell('b')}${cell}'); + 'unreachable', + '${throw 0}${await asyncWriteCell('b')}${cell}', + ); } catch (_) { Expect.equals('a', cell); }
diff --git a/tests/language/regress/regress26230_test.dart b/tests/language/regress/regress26230_test.dart index 3433f96..6d40a58 100644 --- a/tests/language/regress/regress26230_test.dart +++ b/tests/language/regress/regress26230_test.dart
@@ -21,8 +21,10 @@ mixin class ContainerParentDataMixin<ChildType extends RenderObject> {} -mixin class ContainerRenderObjectMixin<ChildType extends RenderObject, - ParentDataType extends ContainerParentDataMixin<ChildType>> {} +mixin class ContainerRenderObjectMixin< + ChildType extends RenderObject, + ParentDataType extends ContainerParentDataMixin<ChildType> +> {} class SectorChildListParentData extends SectorParentData with ContainerParentDataMixin<RenderSector> {} @@ -33,10 +35,13 @@ with ContainerRenderObjectMixin<RenderSector, SectorChildListParentData> {} class ContainerBoxParentDataMixin<ChildType extends RenderObject> - extends BoxParentData with ContainerParentDataMixin<ChildType> {} + extends BoxParentData + with ContainerParentDataMixin<ChildType> {} -mixin class RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, - ParentDataType extends ContainerBoxParentDataMixin<ChildType>> +mixin class RenderBoxContainerDefaultsMixin< + ChildType extends RenderBox, + ParentDataType extends ContainerBoxParentDataMixin<ChildType> +> implements ContainerRenderObjectMixin<ChildType, ParentDataType> {} class FlexParentData extends ContainerBoxParentDataMixin<RenderBox> {}
diff --git a/tests/language/regress/regress26543_2_test.dart b/tests/language/regress/regress26543_2_test.dart index ac7b5f5..82a109c 100644 --- a/tests/language/regress/regress26543_2_test.dart +++ b/tests/language/regress/regress26543_2_test.dart
@@ -6,9 +6,7 @@ class C { var x, y; - C() - : x = null ?? <int, int>{}, - y = 0 {} + C() : x = null ?? <int, int>{}, y = 0 {} } main() {
diff --git a/tests/language/regress/regress26543_3_test.dart b/tests/language/regress/regress26543_3_test.dart index 91bbfa4..0872753 100644 --- a/tests/language/regress/regress26543_3_test.dart +++ b/tests/language/regress/regress26543_3_test.dart
@@ -6,9 +6,7 @@ class C { var x, y; - C() - : x = 0, - y = null ?? <int, int>{} {} + C() : x = 0, y = null ?? <int, int>{} {} } main() {
diff --git a/tests/language/regress/regress26855_runtime_test.dart b/tests/language/regress/regress26855_runtime_test.dart index a5cc175..a8caef6 100644 --- a/tests/language/regress/regress26855_runtime_test.dart +++ b/tests/language/regress/regress26855_runtime_test.dart
@@ -5,24 +5,11 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. - - - - - - class C { C(); var x; - - } main() { - - - C c = new C(); - - }
diff --git a/tests/language/regress/regress27617_runtime_test.dart b/tests/language/regress/regress27617_runtime_test.dart index e75bc21..4b8d44d 100644 --- a/tests/language/regress/regress27617_runtime_test.dart +++ b/tests/language/regress/regress27617_runtime_test.dart
@@ -10,9 +10,6 @@ Foo._(this.greeting) {} // Const constructor must not redirect to non-const constructor. - } -main() { - -} +main() {}
diff --git a/tests/language/regress/regress28498_test.dart b/tests/language/regress/regress28498_test.dart index c27b66c..28f7e54 100644 --- a/tests/language/regress/regress28498_test.dart +++ b/tests/language/regress/regress28498_test.dart
@@ -22,8 +22,13 @@ // !ok iff asserts are enabled. asyncStart(); - test().then((_) => Expect.isTrue(ok), onError: (error) { - // !ok implies error is AssertionError. - Expect.isTrue(ok || error is AssertionError); - }).whenComplete(asyncEnd); + test() + .then( + (_) => Expect.isTrue(ok), + onError: (error) { + // !ok implies error is AssertionError. + Expect.isTrue(ok || error is AssertionError); + }, + ) + .whenComplete(asyncEnd); }
diff --git a/tests/language/regress/regress29243_test.dart b/tests/language/regress/regress29243_test.dart index 60b0cb7..bb08906 100644 --- a/tests/language/regress/regress29243_test.dart +++ b/tests/language/regress/regress29243_test.dart
@@ -6,7 +6,7 @@ int Function() x = () => 42; int Function(int Function()) y = (int Function() x) => x(); -List<int Function()> l = <int Function()>[()=>42, x]; +List<int Function()> l = <int Function()>[() => 42, x]; main() { Expect.equals(42, y(l[1])); }
diff --git a/tests/language/regress/regress29349_test.dart b/tests/language/regress/regress29349_test.dart index ea91b79..a81764e 100644 --- a/tests/language/regress/regress29349_test.dart +++ b/tests/language/regress/regress29349_test.dart
@@ -6,6 +6,6 @@ List<T> get2<T>(T item) => <T>[item]; void main() { - print(get(1)); - print(get2(1)); + print(get(1)); + print(get2(1)); }
diff --git a/tests/language/regress/regress29784_runtime_test.dart b/tests/language/regress/regress29784_runtime_test.dart index f145ed4..570955d 100644 --- a/tests/language/regress/regress29784_runtime_test.dart +++ b/tests/language/regress/regress29784_runtime_test.dart
@@ -13,12 +13,7 @@ import 'package:expect/expect.dart'; class A { - - var a, b; } -main() { - - -} +main() {}
diff --git a/tests/language/regress/regress30339_test.dart b/tests/language/regress/regress30339_test.dart index c3a6861..eaa4529 100644 --- a/tests/language/regress/regress30339_test.dart +++ b/tests/language/regress/regress30339_test.dart
@@ -24,14 +24,20 @@ Future<int> bar() async => x; main() { - foo().then((_) { - Expect.isFalse(isCheckedMode()); - }, onError: (e) { - Expect.isTrue(isCheckedMode() && (e is TypeError)); - }); - bar().then((_) { - Expect.isFalse(isCheckedMode()); - }, onError: (e) { - Expect.isTrue(isCheckedMode() && (e is TypeError)); - }); + foo().then( + (_) { + Expect.isFalse(isCheckedMode()); + }, + onError: (e) { + Expect.isTrue(isCheckedMode() && (e is TypeError)); + }, + ); + bar().then( + (_) { + Expect.isFalse(isCheckedMode()); + }, + onError: (e) { + Expect.isTrue(isCheckedMode() && (e is TypeError)); + }, + ); }
diff --git a/tests/language/regress/regress30516_test.dart b/tests/language/regress/regress30516_test.dart index b8189cc..2e1f2de 100644 --- a/tests/language/regress/regress30516_test.dart +++ b/tests/language/regress/regress30516_test.dart
@@ -5,8 +5,11 @@ typedef void RecognizerCallback<T>(); typedef void GestureTapCancelCallback(); GestureTapCancelCallback? onTapCancel; -T? invokeCallback<T>(String name, RecognizerCallback<T>? callback, - {String debugReport()?}) {} +T? invokeCallback<T>( + String name, + RecognizerCallback<T>? callback, { + String debugReport()?, +}) {} main() { invokeCallback<void>('spontaneous onTapCancel', onTapCancel); }
diff --git a/tests/language/regress/regress31057_test.dart b/tests/language/regress/regress31057_test.dart index aa443ef..604caea 100644 --- a/tests/language/regress/regress31057_test.dart +++ b/tests/language/regress/regress31057_test.dart
@@ -18,6 +18,8 @@ } main() { - Expect.equals('bool int double String', - ((new Foo<bool>().a<int>())<double>())<String>()); + Expect.equals( + 'bool int double String', + ((new Foo<bool>().a<int>())<double>())<String>(), + ); }
diff --git a/tests/language/regress/regress31106_test.dart b/tests/language/regress/regress31106_test.dart index 0c484d1..be6d245 100644 --- a/tests/language/regress/regress31106_test.dart +++ b/tests/language/regress/regress31106_test.dart
@@ -15,9 +15,7 @@ class User { final String first; - const User({ - required this.first, - }); + const User({required this.first}); } class Schema<T> { @@ -27,15 +25,12 @@ const Schema({ required this.name, required Map<String, Object> Function(T) decode, - }) - : _decode = decode; + }) : _decode = decode; } class UserSchema extends Schema<User> { static Map<String, Object> _decode$(User user) { - return { - 'first': user.first, - }; + return {'first': user.first}; } const UserSchema() : super(name: 'users', decode: _decode$);
diff --git a/tests/language/regress/regress31596_runtime_test.dart b/tests/language/regress/regress31596_runtime_test.dart index 90ed9c3..db91ca4 100644 --- a/tests/language/regress/regress31596_runtime_test.dart +++ b/tests/language/regress/regress31596_runtime_test.dart
@@ -39,7 +39,8 @@ B2? b2 = null; i.f(b2, b); // Ok since B2 assignable to A - void Function(Object, B) g = d.f as dynamic; // Ok; D.f reified as (Object, B) -> void + void Function(Object, B) g = + d.f as dynamic; // Ok; D.f reified as (Object, B) -> void Expect.throwsTypeError(() { d.f(a as B, b); });
diff --git a/tests/language/regress/regress31596_super_runtime_1_test.dart b/tests/language/regress/regress31596_super_runtime_1_test.dart index f43e9e8..6cad46d 100644 --- a/tests/language/regress/regress31596_super_runtime_1_test.dart +++ b/tests/language/regress/regress31596_super_runtime_1_test.dart
@@ -41,20 +41,13 @@ // not ok since B2 is not assignable to B - var superF = super.f; // Inferred static type: void Function(B) // ok since I0 is assignable to B - // not ok since B2 is not assignable to B - // Should pass since superF's runtime type is void Function(Object) - - - - } }
diff --git a/tests/language/regress/regress31596_super_runtime_2_test.dart b/tests/language/regress/regress31596_super_runtime_2_test.dart index 6dfe63a..13fe072 100644 --- a/tests/language/regress/regress31596_super_runtime_2_test.dart +++ b/tests/language/regress/regress31596_super_runtime_2_test.dart
@@ -38,10 +38,8 @@ // ok since I0 is assignable to B - // not ok since B2 is not assignable to B - var superF = super.f; // Inferred static type: void Function(B) // ok since I0 is assignable to B @@ -49,12 +47,7 @@ // not ok since B2 is not assignable to B - // Should pass since superF's runtime type is void Function(Object) - - - - } }
diff --git a/tests/language/regress/regress31596_super_runtime_3_test.dart b/tests/language/regress/regress31596_super_runtime_3_test.dart index 9a593c5..732d212 100644 --- a/tests/language/regress/regress31596_super_runtime_3_test.dart +++ b/tests/language/regress/regress31596_super_runtime_3_test.dart
@@ -38,18 +38,14 @@ // ok since I0 is assignable to B - // not ok since B2 is not assignable to B - var superF = super.f; // Inferred static type: void Function(B) // ok since I0 is assignable to B - // not ok since B2 is not assignable to B - // Should pass since superF's runtime type is void Function(Object) Expect.isTrue(superF is void Function(B)); Expect.isTrue(superF is void Function(I0));
diff --git a/tests/language/regress/regress31596_super_runtime_test.dart b/tests/language/regress/regress31596_super_runtime_test.dart index 37e466d..d332f84 100644 --- a/tests/language/regress/regress31596_super_runtime_test.dart +++ b/tests/language/regress/regress31596_super_runtime_test.dart
@@ -38,23 +38,15 @@ // ok since I0 is assignable to B - // not ok since B2 is not assignable to B - var superF = super.f; // Inferred static type: void Function(B) // ok since I0 is assignable to B - // not ok since B2 is not assignable to B - // Should pass since superF's runtime type is void Function(Object) - - - - } }
diff --git a/tests/language/regress/regress31596_test.dart b/tests/language/regress/regress31596_test.dart index e7b9ee0..d785398 100644 --- a/tests/language/regress/regress31596_test.dart +++ b/tests/language/regress/regress31596_test.dart
@@ -39,7 +39,8 @@ // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE // [cfe] The argument type 'B2?' can't be assigned to the parameter type 'B?'. i.f(b2, b); // Ok since B2 assignable to A - void Function(Object, B) g = d.f as dynamic; // Ok; D.f reified as (Object, B) -> void + void Function(Object, B) g = + d.f as dynamic; // Ok; D.f reified as (Object, B) -> void Expect.throwsTypeError(() { d.f(a as B, b); });
diff --git a/tests/language/regress/regress32353_test.dart b/tests/language/regress/regress32353_test.dart index 5117c50..e3e1af2 100644 --- a/tests/language/regress/regress32353_test.dart +++ b/tests/language/regress/regress32353_test.dart
@@ -14,16 +14,23 @@ noSuchMethod(invocation) => null; } -abstract class _LocalFileSystemEntity<T extends FileSystemEntity, - D extends io_FileSystemEntity> extends ForwardingFileSystemEntity<T, D> {} +abstract class _LocalFileSystemEntity< + T extends FileSystemEntity, + D extends io_FileSystemEntity +> + extends ForwardingFileSystemEntity<T, D> {} abstract class FileSystemEntity implements io_FileSystemEntity {} -abstract class ForwardingFileSystemEntity<T extends FileSystemEntity, - D extends io_FileSystemEntity> implements FileSystemEntity {} +abstract class ForwardingFileSystemEntity< + T extends FileSystemEntity, + D extends io_FileSystemEntity +> + implements FileSystemEntity {} mixin ForwardingDirectory<T extends Directory> - on ForwardingFileSystemEntity<T, io_Directory> implements Directory { + on ForwardingFileSystemEntity<T, io_Directory> + implements Directory { get t => T; }
diff --git a/tests/language/regress/regress33235_01_runtime_test.dart b/tests/language/regress/regress33235_01_runtime_test.dart index f886a35..1b6b502 100644 --- a/tests/language/regress/regress33235_01_runtime_test.dart +++ b/tests/language/regress/regress33235_01_runtime_test.dart
@@ -10,8 +10,6 @@ // Files 01 to 16 should be compile time errors, files 17 to 21 should not. class C { - - static int get n { return 42; }
diff --git a/tests/language/regress/regress33235_01_test.dart b/tests/language/regress/regress33235_01_test.dart index 83c4c0f..a00fca1 100644 --- a/tests/language/regress/regress33235_01_test.dart +++ b/tests/language/regress/regress33235_01_test.dart
@@ -8,12 +8,12 @@ class C { C.n() {} -// ^ -// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_CONSTRUCTOR_AND_STATIC_MEMBER + //^ + // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_CONSTRUCTOR_AND_STATIC_MEMBER static int get n { - // ^ - // [cfe] The member conflicts with constructor 'C.n'. + // ^ + // [cfe] The member conflicts with constructor 'C.n'. return 42; } }
diff --git a/tests/language/regress/regress33235_02_runtime_test.dart b/tests/language/regress/regress33235_02_runtime_test.dart index 36e10c1..26e43ab 100644 --- a/tests/language/regress/regress33235_02_runtime_test.dart +++ b/tests/language/regress/regress33235_02_runtime_test.dart
@@ -10,8 +10,6 @@ // Files 01 to 16 should be compile time errors, files 17 to 21 should not. class C { - - static int n() { return 42; }
diff --git a/tests/language/regress/regress33235_02_test.dart b/tests/language/regress/regress33235_02_test.dart index 9f43cd8..b13c1e5 100644 --- a/tests/language/regress/regress33235_02_test.dart +++ b/tests/language/regress/regress33235_02_test.dart
@@ -8,12 +8,12 @@ class C { C.n() {} -// ^ -// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_CONSTRUCTOR_AND_STATIC_MEMBER + //^ + // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_CONSTRUCTOR_AND_STATIC_MEMBER static int n() { - // ^ - // [cfe] The member conflicts with constructor 'C.n'. + // ^ + // [cfe] The member conflicts with constructor 'C.n'. return 42; } }
diff --git a/tests/language/regress/regress33235_03_runtime_test.dart b/tests/language/regress/regress33235_03_runtime_test.dart index b704bb3..62ece19 100644 --- a/tests/language/regress/regress33235_03_runtime_test.dart +++ b/tests/language/regress/regress33235_03_runtime_test.dart
@@ -10,8 +10,6 @@ // Files 01 to 16 should be compile time errors, files 17 to 21 should not. class C { - - static set n(int x) {} }
diff --git a/tests/language/regress/regress33235_03_test.dart b/tests/language/regress/regress33235_03_test.dart index 1e2c32a..a7db0b3 100644 --- a/tests/language/regress/regress33235_03_test.dart +++ b/tests/language/regress/regress33235_03_test.dart
@@ -8,8 +8,8 @@ class C { C.n() {} -// ^ -// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_CONSTRUCTOR_AND_STATIC_MEMBER + //^ + // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_CONSTRUCTOR_AND_STATIC_MEMBER static set n(int x) {} // ^
diff --git a/tests/language/regress/regress33235_04_runtime_test.dart b/tests/language/regress/regress33235_04_runtime_test.dart index d36f9d8..728e6bb 100644 --- a/tests/language/regress/regress33235_04_runtime_test.dart +++ b/tests/language/regress/regress33235_04_runtime_test.dart
@@ -10,8 +10,6 @@ // Files 01 to 16 should be compile time errors, files 17 to 21 should not. class C { - - static int n() => 42; }
diff --git a/tests/language/regress/regress33235_05_runtime_test.dart b/tests/language/regress/regress33235_05_runtime_test.dart index b6acd1e..1c56aae 100644 --- a/tests/language/regress/regress33235_05_runtime_test.dart +++ b/tests/language/regress/regress33235_05_runtime_test.dart
@@ -13,17 +13,11 @@ int get n => 43; } -class B extends A { +class B extends A {} -} - -abstract class B2 implements A { - -} +abstract class B2 implements A {} class C { - - int get n => 43; }
diff --git a/tests/language/regress/regress33235_06_runtime_test.dart b/tests/language/regress/regress33235_06_runtime_test.dart index 2f5cd43..4859e6e 100644 --- a/tests/language/regress/regress33235_06_runtime_test.dart +++ b/tests/language/regress/regress33235_06_runtime_test.dart
@@ -13,17 +13,11 @@ int n() => 43; } -class B extends A { +class B extends A {} -} - -abstract class B2 implements A { - -} +abstract class B2 implements A {} class C { - - int n() => 43; }
diff --git a/tests/language/regress/regress33235_07_runtime_test.dart b/tests/language/regress/regress33235_07_runtime_test.dart index 04bbc5d..1320b73 100644 --- a/tests/language/regress/regress33235_07_runtime_test.dart +++ b/tests/language/regress/regress33235_07_runtime_test.dart
@@ -13,17 +13,11 @@ void set n(int i) {} } -class B extends A { +class B extends A {} -} - -abstract class B2 implements A { - -} +abstract class B2 implements A {} class C { - - void set n(int i) {} }
diff --git a/tests/language/regress/regress33235_08_runtime_test.dart b/tests/language/regress/regress33235_08_runtime_test.dart index b6acd1e..1c56aae 100644 --- a/tests/language/regress/regress33235_08_runtime_test.dart +++ b/tests/language/regress/regress33235_08_runtime_test.dart
@@ -13,17 +13,11 @@ int get n => 43; } -class B extends A { +class B extends A {} -} - -abstract class B2 implements A { - -} +abstract class B2 implements A {} class C { - - int get n => 43; }
diff --git a/tests/language/regress/regress33235_09_runtime_test.dart b/tests/language/regress/regress33235_09_runtime_test.dart index 2f5cd43..4859e6e 100644 --- a/tests/language/regress/regress33235_09_runtime_test.dart +++ b/tests/language/regress/regress33235_09_runtime_test.dart
@@ -13,17 +13,11 @@ int n() => 43; } -class B extends A { +class B extends A {} -} - -abstract class B2 implements A { - -} +abstract class B2 implements A {} class C { - - int n() => 43; }
diff --git a/tests/language/regress/regress33235_10_runtime_test.dart b/tests/language/regress/regress33235_10_runtime_test.dart index 04bbc5d..1320b73 100644 --- a/tests/language/regress/regress33235_10_runtime_test.dart +++ b/tests/language/regress/regress33235_10_runtime_test.dart
@@ -13,17 +13,11 @@ void set n(int i) {} } -class B extends A { +class B extends A {} -} - -abstract class B2 implements A { - -} +abstract class B2 implements A {} class C { - - void set n(int i) {} }
diff --git a/tests/language/regress/regress33235_11_runtime_test.dart b/tests/language/regress/regress33235_11_runtime_test.dart index d36f9d8..728e6bb 100644 --- a/tests/language/regress/regress33235_11_runtime_test.dart +++ b/tests/language/regress/regress33235_11_runtime_test.dart
@@ -10,8 +10,6 @@ // Files 01 to 16 should be compile time errors, files 17 to 21 should not. class C { - - static int n() => 42; }
diff --git a/tests/language/regress/regress33235_12_runtime_test.dart b/tests/language/regress/regress33235_12_runtime_test.dart index c2a72ab..2a1bc91 100644 --- a/tests/language/regress/regress33235_12_runtime_test.dart +++ b/tests/language/regress/regress33235_12_runtime_test.dart
@@ -13,17 +13,11 @@ int get n => 42; } -class B extends A { +class B extends A {} -} - -abstract class B2 implements A { - -} +abstract class B2 implements A {} class C { - - int get n => 42; }
diff --git a/tests/language/regress/regress33235_13_runtime_test.dart b/tests/language/regress/regress33235_13_runtime_test.dart index 551fed5..1fdad4d 100644 --- a/tests/language/regress/regress33235_13_runtime_test.dart +++ b/tests/language/regress/regress33235_13_runtime_test.dart
@@ -13,17 +13,11 @@ int n() => 42; } -class B extends A { +class B extends A {} -} - -abstract class B2 implements A { - -} +abstract class B2 implements A {} class C { - - int n() => 42; }
diff --git a/tests/language/regress/regress33235_14_runtime_test.dart b/tests/language/regress/regress33235_14_runtime_test.dart index 6f7bd93..92dfb0c 100644 --- a/tests/language/regress/regress33235_14_runtime_test.dart +++ b/tests/language/regress/regress33235_14_runtime_test.dart
@@ -12,17 +12,11 @@ void set n(int x) {} } -class B extends A { +class B extends A {} -} - -abstract class B2 implements A { - -} +abstract class B2 implements A {} class C { - - void set n(int x) {} }
diff --git a/tests/language/regress/regress33235_15_runtime_test.dart b/tests/language/regress/regress33235_15_runtime_test.dart index 2f5cd43..4859e6e 100644 --- a/tests/language/regress/regress33235_15_runtime_test.dart +++ b/tests/language/regress/regress33235_15_runtime_test.dart
@@ -13,17 +13,11 @@ int n() => 43; } -class B extends A { +class B extends A {} -} - -abstract class B2 implements A { - -} +abstract class B2 implements A {} class C { - - int n() => 43; }
diff --git a/tests/language/regress/regress33235_16_runtime_test.dart b/tests/language/regress/regress33235_16_runtime_test.dart index 2f5cd43..4859e6e 100644 --- a/tests/language/regress/regress33235_16_runtime_test.dart +++ b/tests/language/regress/regress33235_16_runtime_test.dart
@@ -13,17 +13,11 @@ int n() => 43; } -class B extends A { +class B extends A {} -} - -abstract class B2 implements A { - -} +abstract class B2 implements A {} class C { - - int n() => 43; }
diff --git a/tests/language/regress/regress33479_runtime_test.dart b/tests/language/regress/regress33479_runtime_test.dart index c6f47a2..665aa1d 100644 --- a/tests/language/regress/regress33479_runtime_test.dart +++ b/tests/language/regress/regress33479_runtime_test.dart
@@ -3,9 +3,9 @@ class Hest<TypeX extends Fisk> {} -typedef Fisk = void Function // don't merge lines - - (); +typedef Fisk = + void Function // don't merge lines + (); main() { Hest hest = new Hest();
diff --git a/tests/language/regress/regress33479_test.dart b/tests/language/regress/regress33479_test.dart index fe9ca03..2864048 100644 --- a/tests/language/regress/regress33479_test.dart +++ b/tests/language/regress/regress33479_test.dart
@@ -2,11 +2,11 @@ // ^^^^ // [analyzer] COMPILE_TIME_ERROR.NOT_INSTANTIATED_BOUND -typedef Fisk = void Function // don't merge lines -// ^^^^ -// [analyzer] COMPILE_TIME_ERROR.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF -// ^ -// [cfe] Generic type 'Fisk' can't be used without type arguments in the bounds of its own type variables. It is referenced indirectly through 'Hest'. +typedef Fisk = + // ^^^^ + // [analyzer] COMPILE_TIME_ERROR.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF + // [cfe] Generic type 'Fisk' can't be used without type arguments in the bounds of its own type variables. It is referenced indirectly through 'Hest'. + void Function // don't merge lines <TypeY extends Hest>(); // ^^^^ // [analyzer] COMPILE_TIME_ERROR.NOT_INSTANTIATED_BOUND
diff --git a/tests/language/regress/regress34091.dart b/tests/language/regress/regress34091.dart index 5756024..62a94fb 100644 --- a/tests/language/regress/regress34091.dart +++ b/tests/language/regress/regress34091.dart
@@ -22,9 +22,10 @@ } */ final uri = Uri.parse( - "data:application/dart;charset=utf8,import%20%22dart%3Aisolate%22%3Bvoi" + - "d%20main(_%2Cp)%7Btry%7Bthrow(%22Hello%20World%22)%3B%7Dcatch(e%2C" + - "%20s)%7Bp.send(%22%24e%5Cn%24s%22)%3B%7D%7D"); + "data:application/dart;charset=utf8,import%20%22dart%3Aisolate%22%3Bvoi" + + "d%20main(_%2Cp)%7Btry%7Bthrow(%22Hello%20World%22)%3B%7Dcatch(e%2C" + + "%20s)%7Bp.send(%22%24e%5Cn%24s%22)%3B%7D%7D", + ); ReceivePort port = new ReceivePort(); Isolate.spawnUri(uri, [], port.sendPort); port.listen((trace) {
diff --git a/tests/language/regress/regress34235_legacy_test.dart b/tests/language/regress/regress34235_legacy_test.dart index 48bec5a..51408e1 100644 --- a/tests/language/regress/regress34235_legacy_test.dart +++ b/tests/language/regress/regress34235_legacy_test.dart
@@ -11,8 +11,7 @@ class M1 { void foo( // Prevent formatter from joining the line below to the one above - {x} - ) {} + {x}) {} } class BaseWithM1 = Base with M1; @@ -22,7 +21,7 @@ } class Derived extends BaseWithM1 with M2 {} -// ^^^^^^^ +// ^ // [cfe] Applying the mixin 'M2' to 'BaseWithM1' introduces an erroneous override of 'foo'. // ^^ // [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
diff --git a/tests/language/regress/regress34235_test.dart b/tests/language/regress/regress34235_test.dart index 32b9171..a8296f9 100644 --- a/tests/language/regress/regress34235_test.dart +++ b/tests/language/regress/regress34235_test.dart
@@ -17,7 +17,7 @@ } class Derived extends BaseWithM1 with M2 {} -// ^^^^^^^ +// ^ // [cfe] Applying the mixin 'M2' to 'BaseWithM1' introduces an erroneous override of 'foo'. // ^^ // [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
diff --git a/tests/language/regress/regress34488_runtime_test.dart b/tests/language/regress/regress34488_runtime_test.dart index 5f44a68..9ff9e7e 100644 --- a/tests/language/regress/regress34488_runtime_test.dart +++ b/tests/language/regress/regress34488_runtime_test.dart
@@ -30,10 +30,4 @@ main() { var d = new Derived(); - - - - - - }
diff --git a/tests/language/regress/regress34489_runtime_test.dart b/tests/language/regress/regress34489_runtime_test.dart index 8cadeed..ca90de7 100644 --- a/tests/language/regress/regress34489_runtime_test.dart +++ b/tests/language/regress/regress34489_runtime_test.dart
@@ -9,6 +9,4 @@ var field = T; } -main() { - -} +main() {}
diff --git a/tests/language/regress/regress34495_runtime_test.dart b/tests/language/regress/regress34495_runtime_test.dart index f31c56d..1268945 100644 --- a/tests/language/regress/regress34495_runtime_test.dart +++ b/tests/language/regress/regress34495_runtime_test.dart
@@ -5,6 +5,4 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. - - main() {}
diff --git a/tests/language/regress/regress34498_test.dart b/tests/language/regress/regress34498_test.dart index 17a4cda..db269ba 100644 --- a/tests/language/regress/regress34498_test.dart +++ b/tests/language/regress/regress34498_test.dart
@@ -7,9 +7,9 @@ class A { core.List get core => throw "uncalled"; -//^^^^ -// [analyzer] COMPILE_TIME_ERROR.PREFIX_SHADOWED_BY_LOCAL_DECLARATION -// [cfe] 'core.List' can't be used as a type because 'core' doesn't refer to an import prefix. + // [error column 3, length 4] + // [analyzer] COMPILE_TIME_ERROR.PREFIX_SHADOWED_BY_LOCAL_DECLARATION + // [cfe] 'core.List' can't be used as a type because 'core' doesn't refer to an import prefix. } main() {
diff --git a/tests/language/regress/regress35043_runtime_test.dart b/tests/language/regress/regress35043_runtime_test.dart index f31c56d..1268945 100644 --- a/tests/language/regress/regress35043_runtime_test.dart +++ b/tests/language/regress/regress35043_runtime_test.dart
@@ -5,6 +5,4 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. - - main() {}
diff --git a/tests/language/regress/regress35258_runtime_test.dart b/tests/language/regress/regress35258_runtime_test.dart index 480fd21..7c3f08c 100644 --- a/tests/language/regress/regress35258_runtime_test.dart +++ b/tests/language/regress/regress35258_runtime_test.dart
@@ -12,6 +12,5 @@ class C { final d; - C(this.d) {} }
diff --git a/tests/language/regress/regress35258_test.dart b/tests/language/regress/regress35258_test.dart index a5707b0..7179bc1 100644 --- a/tests/language/regress/regress35258_test.dart +++ b/tests/language/regress/regress35258_test.dart
@@ -16,10 +16,10 @@ // [cfe] Final field 'd' is not initialized. C() {} -//^ -// [analyzer] COMPILE_TIME_ERROR.FINAL_NOT_INITIALIZED_CONSTRUCTOR + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.FINAL_NOT_INITIALIZED_CONSTRUCTOR C(this.d) {} -//^ -// [analyzer] COMPILE_TIME_ERROR.DUPLICATE_CONSTRUCTOR -// [cfe] 'C' is already declared in this scope. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.DUPLICATE_CONSTRUCTOR + // [cfe] 'C' is already declared in this scope. }
diff --git a/tests/language/regress/regress35259_runtime_test.dart b/tests/language/regress/regress35259_runtime_test.dart index cabe50a..7cb3e0b 100644 --- a/tests/language/regress/regress35259_runtime_test.dart +++ b/tests/language/regress/regress35259_runtime_test.dart
@@ -5,10 +5,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -class Supertype { - - -} +class Supertype {} main() { print(new Supertype());
diff --git a/tests/language/regress/regress35259_test.dart b/tests/language/regress/regress35259_test.dart index eb9b24c..d3e29ae 100644 --- a/tests/language/regress/regress35259_test.dart +++ b/tests/language/regress/regress35259_test.dart
@@ -7,18 +7,15 @@ // ^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.REDIRECT_TO_NON_CLASS // [cfe] Couldn't find constructor 'Unresolved'. - // ^ // [cfe] Redirection constructor target not found: 'Unresolved' factory Supertype() = Unresolved; -// ^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.DUPLICATE_CONSTRUCTOR -// ^ -// [cfe] 'Supertype' is already declared in this scope. -// ^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.REDIRECT_TO_NON_CLASS -// [cfe] Couldn't find constructor 'Unresolved'. -// ^ -// [cfe] Redirection constructor target not found: 'Unresolved' + // ^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.DUPLICATE_CONSTRUCTOR + // [cfe] 'Supertype' is already declared in this scope. + // ^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.REDIRECT_TO_NON_CLASS + // [cfe] Couldn't find constructor 'Unresolved'. + // [cfe] Redirection constructor target not found: 'Unresolved' } main() {
diff --git a/tests/language/regress/regress35260_runtime_test.dart b/tests/language/regress/regress35260_runtime_test.dart index b8ce1a7..85fd007 100644 --- a/tests/language/regress/regress35260_runtime_test.dart +++ b/tests/language/regress/regress35260_runtime_test.dart
@@ -7,7 +7,6 @@ class Supertype { factory Supertype() = X; - } class X implements Supertype {
diff --git a/tests/language/regress/regress35260_test.dart b/tests/language/regress/regress35260_test.dart index e2d5622..3eecb57 100644 --- a/tests/language/regress/regress35260_test.dart +++ b/tests/language/regress/regress35260_test.dart
@@ -5,10 +5,9 @@ class Supertype { factory Supertype() = X; factory Supertype() = X; -// ^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.DUPLICATE_CONSTRUCTOR -// ^ -// [cfe] 'Supertype' is already declared in this scope. + // ^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.DUPLICATE_CONSTRUCTOR + // [cfe] 'Supertype' is already declared in this scope. } class X implements Supertype {
diff --git a/tests/language/regress/regress35266_runtime_test.dart b/tests/language/regress/regress35266_runtime_test.dart index 00ff9ca..3c43345 100644 --- a/tests/language/regress/regress35266_runtime_test.dart +++ b/tests/language/regress/regress35266_runtime_test.dart
@@ -8,7 +8,6 @@ class B<T> extends C<T> { B(); factory B.foo() = B<T>; - } class C<K> {
diff --git a/tests/language/regress/regress35266_test.dart b/tests/language/regress/regress35266_test.dart index 713c328..04c45da 100644 --- a/tests/language/regress/regress35266_test.dart +++ b/tests/language/regress/regress35266_test.dart
@@ -6,10 +6,9 @@ B(); factory B.foo() = B<T>; factory B.foo() = B<T>; -// ^^^^^ -// [analyzer] COMPILE_TIME_ERROR.DUPLICATE_CONSTRUCTOR -// ^ -// [cfe] 'B.foo' is already declared in this scope. + // ^^^^^ + // [analyzer] COMPILE_TIME_ERROR.DUPLICATE_CONSTRUCTOR + // [cfe] 'B.foo' is already declared in this scope. } class C<K> {
diff --git a/tests/language/regress/regress41890_test.dart b/tests/language/regress/regress41890_test.dart index df066b9..f8d3546 100644 --- a/tests/language/regress/regress41890_test.dart +++ b/tests/language/regress/regress41890_test.dart
@@ -43,7 +43,8 @@ for (int i = 0; i < items.length; i++) { var item = items[i]; String code = answers[i]; - bool expected = code == 'T' || + bool expected = + code == 'T' || (code == 'S' && !unsoundNullSafety) || (code == 'W' && hasUnsoundNullSafety); Expect.equals(expected, predicate(item), "$predicate '$code' $item");
diff --git a/tests/language/regress/regress45313_test.dart b/tests/language/regress/regress45313_test.dart index 840e809..95f16d1 100644 --- a/tests/language/regress/regress45313_test.dart +++ b/tests/language/regress/regress45313_test.dart
@@ -2,11 +2,10 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. - import "package:expect/expect.dart"; -typedef TEST_TYPEDEF<TT extends T Function<T>(T)> = void - Function<TTT extends TT>(); +typedef TEST_TYPEDEF<TT extends T Function<T>(T)> = + void Function<TTT extends TT>(); void testme<TT extends T Function<T>(T)>() {} main() {
diff --git a/tests/language/regress/regress45443_test.dart b/tests/language/regress/regress45443_test.dart index d7f6aa6..467da89 100644 --- a/tests/language/regress/regress45443_test.dart +++ b/tests/language/regress/regress45443_test.dart
@@ -2,7 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. - class C1<T extends void Function<TT extends T>()> {} class C2<T extends TT Function<TT extends T>()> {}
diff --git a/tests/language/regress/regress45763_test.dart b/tests/language/regress/regress45763_test.dart index df83793..3ebcf45 100644 --- a/tests/language/regress/regress45763_test.dart +++ b/tests/language/regress/regress45763_test.dart
@@ -2,7 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. - import "package:expect/expect.dart"; Type? capturedTypeArgument;
diff --git a/tests/language/regress/regress47166_test.dart b/tests/language/regress/regress47166_test.dart index b44d28b..96ea230 100644 --- a/tests/language/regress/regress47166_test.dart +++ b/tests/language/regress/regress47166_test.dart
@@ -41,9 +41,10 @@ log5 = triggerTheProblem(true); log6 = g(); // Use 'g'. Expect.equals( - 'log1=0 log2=100 log3=100 log4=100 log5=100 log6=100', - 'log1=$log1 log2=$log2 log3=$log3 log4=$log4 log5=$log5 log6=$log6', - 'throwing'); + 'log1=0 log2=100 log3=100 log4=100 log5=100 log6=100', + 'log1=$log1 log2=$log2 log3=$log3 log4=$log4 log5=$log5 log6=$log6', + 'throwing', + ); // Run the test with 'doThrow' being false to avoid any confounding // optimizations due to constant propagation. @@ -51,7 +52,8 @@ log5 = triggerTheProblem(false); log6 = g(); // Use 'g'. Expect.equals( - 'log1=1 log2=0 log3=1 log4=1 log5=1 log6=1', - 'log1=$log1 log2=$log2 log3=$log3 log4=$log4 log5=$log5 log6=$log6', - 'not throwing'); + 'log1=1 log2=0 log3=1 log4=1 log5=1 log6=1', + 'log1=$log1 log2=$log2 log3=$log3 log4=$log4 log5=$log5 log6=$log6', + 'not throwing', + ); }
diff --git a/tests/language/regress/regress56314_test.dart b/tests/language/regress/regress56314_test.dart index a306bea..171a353 100644 --- a/tests/language/regress/regress56314_test.dart +++ b/tests/language/regress/regress56314_test.dart
@@ -28,7 +28,8 @@ } class D3 extends B3 { - String foo3({num a = 1.5, num b = 2.5}) => '$a, $b, ' + String foo3({num a = 1.5, num b = 2.5}) => + '$a, $b, ' '${a is int ? "int" : "double"}, ' '${b is int ? "int" : "double"}'; } @@ -70,14 +71,8 @@ @pragma('dart2js:never-inline') void check3(B3 b, bool first) { - Expect.equals( - first ? '100, 200' : '1.5, 2.5, double, double', - b.foo3(), - ); - Expect.equals( - first ? '666, 200' : '666, 2.5, int, double', - b.foo3(a: 666), - ); + Expect.equals(first ? '100, 200' : '1.5, 2.5, double, double', b.foo3()); + Expect.equals(first ? '666, 200' : '666, 2.5, int, double', b.foo3(a: 666)); Expect.equals( first ? '666, 777' : '666, 777, int, int', b.foo3(a: 666, b: 777), @@ -87,12 +82,13 @@ @pragma('dart2js:never-inline') void check4(B4 b, bool isB) { Expect.equals( - isB - ? 1 - : jsNumbers - ? 0xfffffff1 // Should be 'unsigned' when using JS numbers. - : -15, - b.foo4()); + isB + ? 1 + : jsNumbers + ? 0xfffffff1 // Should be 'unsigned' when using JS numbers. + : -15, + b.foo4(), + ); Expect.equals(3, b.foo4(2)); }
diff --git a/tests/language/regress/regress6725_runtime_test.dart b/tests/language/regress/regress6725_runtime_test.dart index 6b07ac0..1b91b80 100644 --- a/tests/language/regress/regress6725_runtime_test.dart +++ b/tests/language/regress/regress6725_runtime_test.dart
@@ -9,8 +9,4 @@ library crash_6725; - - -main() { - -} +main() {}
diff --git a/tests/language/regress/regress9687_test.dart b/tests/language/regress/regress9687_test.dart index 15d7eca..7b7e3c2 100644 --- a/tests/language/regress/regress9687_test.dart +++ b/tests/language/regress/regress9687_test.dart
@@ -11,9 +11,7 @@ final finalField; final otherFinalField; - A() - : finalField = 42, - otherFinalField = 54; + A() : finalField = 42, otherFinalField = 54; expectFinalField(arg1, arg2) { Expect.equals(arg1, arg2); @@ -40,7 +38,9 @@ // Using [: finalField :] twice will make the compiler want to // allocate one temporary for it. var a = untypedReceiver.expectFinalField( - typedReceiver.finalField, typedReceiver.finalField); + typedReceiver.finalField, + typedReceiver.finalField, + ); // Having a check instruction in between two allocations of // temporary variables used to trigger a bug in the compiler. @@ -50,5 +50,8 @@ // allocate one temporary for it. The compiler used to assign the // same temporary for [: otherFinalField :] and [: finalField :]. untypedReceiver.expectOtherFinalField( - b, typedReceiver.otherFinalField, typedReceiver.otherFinalField); + b, + typedReceiver.otherFinalField, + typedReceiver.otherFinalField, + ); }
diff --git a/tests/language/rewrite/implicit_this_runtime_test.dart b/tests/language/rewrite/implicit_this_runtime_test.dart index 7fd2b78..c20ac5e 100644 --- a/tests/language/rewrite/implicit_this_runtime_test.dart +++ b/tests/language/rewrite/implicit_this_runtime_test.dart
@@ -12,81 +12,61 @@ class Foo { String x = 'x'; - easy(z) { - - } + easy(z) {} // Shadow the 'y' field in various ways - shadow_y_parameter(y) { - - } + shadow_y_parameter(y) {} shadow_y_local(z) { var y = z; - } shadow_y_capturedLocal(z) { var y = z; - foo() { - - } + foo() {} return foo(); } shadow_y_closureParam(z) { - foo(y) { - - } + foo(y) {} return foo(z); } shadow_y_localInsideClosure(z) { foo() { var y = z; - } return foo(); } // Shadow the 'x' field in various ways - shadow_x_parameter(x) { - - } + shadow_x_parameter(x) {} shadow_x_local(z) { var x = z; - } shadow_x_capturedLocal(z) { var x = z; - foo() { - - } + foo() {} return foo(); } shadow_x_closureParam(z) { - foo(x) { - - } + foo(x) {} return foo(z); } shadow_x_localInsideClosure(z) { foo() { var x = z; - } return foo(); } - shadow_x_toplevel() { - - } + shadow_x_toplevel() {} } class Sub extends Foo { @@ -94,18 +74,4 @@ String toplevel = 'B'; } -main() { - - - - - - - - - - - - - -} +main() {}
diff --git a/tests/language/rewrite/implicit_this_test.dart b/tests/language/rewrite/implicit_this_test.dart index 28adbcf..d424545 100644 --- a/tests/language/rewrite/implicit_this_test.dart +++ b/tests/language/rewrite/implicit_this_test.dart
@@ -10,56 +10,58 @@ String x = 'x'; easy(z) { - return x + y + z; - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER - // [cfe] The getter 'y' isn't defined for the class 'Foo'. + return x + y + z; + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] The getter 'y' isn't defined for the class 'Foo'. } // Shadow the 'y' field in various ways shadow_y_parameter(y) { - return x + this.y + y; - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'y' isn't defined for the class 'Foo'. + return x + this.y + y; + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'y' isn't defined for the class 'Foo'. } shadow_y_local(z) { var y = z; - return x + this.y + y; - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'y' isn't defined for the class 'Foo'. + return x + this.y + y; + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'y' isn't defined for the class 'Foo'. } shadow_y_capturedLocal(z) { var y = z; foo() { - return x + this.y + y; - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'y' isn't defined for the class 'Foo'. + return x + this.y + y; + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'y' isn't defined for the class 'Foo'. } + return foo(); } shadow_y_closureParam(z) { foo(y) { - return x + this.y + y; - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'y' isn't defined for the class 'Foo'. + return x + this.y + y; + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'y' isn't defined for the class 'Foo'. } + return foo(z); } shadow_y_localInsideClosure(z) { foo() { var y = z; - return x + this.y + y; - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'y' isn't defined for the class 'Foo'. + return x + this.y + y; + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'y' isn't defined for the class 'Foo'. } return foo(); @@ -67,61 +69,63 @@ // Shadow the 'x' field in various ways shadow_x_parameter(x) { - return this.x + y + x; - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER - // [cfe] The getter 'y' isn't defined for the class 'Foo'. + return this.x + y + x; + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] The getter 'y' isn't defined for the class 'Foo'. } shadow_x_local(z) { var x = z; - return this.x + y + x; - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER - // [cfe] The getter 'y' isn't defined for the class 'Foo'. + return this.x + y + x; + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] The getter 'y' isn't defined for the class 'Foo'. } shadow_x_capturedLocal(z) { var x = z; foo() { - return this.x + y + x; - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER - // [cfe] The getter 'y' isn't defined for the class 'Foo'. + return this.x + y + x; + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] The getter 'y' isn't defined for the class 'Foo'. } + return foo(); } shadow_x_closureParam(z) { foo(x) { - return this.x + y + x; - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER - // [cfe] The getter 'y' isn't defined for the class 'Foo'. + return this.x + y + x; + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] The getter 'y' isn't defined for the class 'Foo'. } + return foo(z); } shadow_x_localInsideClosure(z) { foo() { var x = z; - return this.x + y + x; - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER - // [cfe] The getter 'y' isn't defined for the class 'Foo'. + return this.x + y + x; + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] The getter 'y' isn't defined for the class 'Foo'. } return foo(); } shadow_x_toplevel() { - return x + this.y + toplevel + this.toplevel; - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'y' isn't defined for the class 'Foo'. - // ^^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'toplevel' isn't defined for the class 'Foo'. + return x + this.y + toplevel + this.toplevel; + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'y' isn't defined for the class 'Foo'. + // ^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'toplevel' isn't defined for the class 'Foo'. } } @@ -131,17 +135,17 @@ } main() { - Expect.equals('xyz', new Sub().easy('z')); - Expect.equals('xyz', new Sub().shadow_y_parameter('z')); - Expect.equals('xyz', new Sub().shadow_y_local('z')); - Expect.equals('xyz', new Sub().shadow_y_capturedLocal('z')); - Expect.equals('xyz', new Sub().shadow_y_closureParam('z')); - Expect.equals('xyz', new Sub().shadow_y_localInsideClosure('z')); - Expect.equals('xyz', new Sub().shadow_x_parameter('z')); - Expect.equals('xyz', new Sub().shadow_x_local('z')); - Expect.equals('xyz', new Sub().shadow_x_capturedLocal('z')); - Expect.equals('xyz', new Sub().shadow_x_closureParam('z')); - Expect.equals('xyz', new Sub().shadow_x_localInsideClosure('z')); + Expect.equals('xyz', new Sub().easy('z')); + Expect.equals('xyz', new Sub().shadow_y_parameter('z')); + Expect.equals('xyz', new Sub().shadow_y_local('z')); + Expect.equals('xyz', new Sub().shadow_y_capturedLocal('z')); + Expect.equals('xyz', new Sub().shadow_y_closureParam('z')); + Expect.equals('xyz', new Sub().shadow_y_localInsideClosure('z')); + Expect.equals('xyz', new Sub().shadow_x_parameter('z')); + Expect.equals('xyz', new Sub().shadow_x_local('z')); + Expect.equals('xyz', new Sub().shadow_x_capturedLocal('z')); + Expect.equals('xyz', new Sub().shadow_x_closureParam('z')); + Expect.equals('xyz', new Sub().shadow_x_localInsideClosure('z')); - Expect.equals('xyAB', new Sub().shadow_x_toplevel()); + Expect.equals('xyAB', new Sub().shadow_x_toplevel()); }
diff --git a/tests/language/rewrite/logical_test.dart b/tests/language/rewrite/logical_test.dart index 4fc4060..1f4dba2 100644 --- a/tests/language/rewrite/logical_test.dart +++ b/tests/language/rewrite/logical_test.dart
@@ -77,35 +77,67 @@ } value_and(x, y) { - return x ? y ? true : false : false; + return x + ? y + ? true + : false + : false; } value_or(x, y) { - return x ? true : y ? true : false; + return x + ? true + : y + ? true + : false; } value_and_not(x, y) { - return x ? y ? false : true : false; + return x + ? y + ? false + : true + : false; } value_not_and(x, y) { - return x ? false : y ? true : false; + return x + ? false + : y + ? true + : false; } value_not_and_not(x, y) { - return x ? false : y ? false : true; + return x + ? false + : y + ? false + : true; } value_or_not(x, y) { - return x ? true : y ? false : true; + return x + ? true + : y + ? false + : true; } value_not_or(x, y) { - return x ? y ? true : false : true; + return x + ? y + ? true + : false + : true; } value_not_or_not(x, y) { - return x ? y ? false : true : true; + return x + ? y + ? false + : true + : true; } if_negate(x) { @@ -117,7 +149,11 @@ } if_and(x, y) { - if (x ? y ? true : false : false) { + if (x + ? y + ? true + : false + : false) { return 1; } else { return 0; @@ -133,7 +169,11 @@ } if_and_not(x, y) { - if (x ? y ? false : true : false) { + if (x + ? y + ? false + : true + : false) { return 1; } else { return 0; @@ -149,7 +189,11 @@ } if_not_and_not(x, y) { - if (x ? false : y ? false : true) { + if (x + ? false + : y + ? false + : true) { return 1; } else { return 0; @@ -157,7 +201,11 @@ } if_or_not(x, y) { - if (x ? true : y ? false : true) { + if (x + ? true + : y + ? false + : true) { return 1; } else { return 0; @@ -173,7 +221,11 @@ } if_not_or_not(x, y) { - if (x ? y ? false : true : true) { + if (x + ? y + ? false + : true + : true) { return 1; } else { return 0;
diff --git a/tests/language/rewrite/nested_if1_test.dart b/tests/language/rewrite/nested_if1_test.dart index d86cc55..0f14edf 100644 --- a/tests/language/rewrite/nested_if1_test.dart +++ b/tests/language/rewrite/nested_if1_test.dart
@@ -19,7 +19,8 @@ } check_false_true(x, y, v) { - if (x) {} else { + if (x) { + } else { if (y) { setGlobal(v); } @@ -28,15 +29,18 @@ check_true_false(x, y, v) { if (x) { - if (y) {} else { + if (y) { + } else { setGlobal(v); } } } check_false_false(x, y, v) { - if (x) {} else { - if (y) {} else { + if (x) { + } else { + if (y) { + } else { setGlobal(v); } }
diff --git a/tests/language/rewrite/nested_if2_test.dart b/tests/language/rewrite/nested_if2_test.dart index 2a71680..49a8ab5 100644 --- a/tests/language/rewrite/nested_if2_test.dart +++ b/tests/language/rewrite/nested_if2_test.dart
@@ -14,7 +14,8 @@ } check_false_true(x, y) { - if (x) {} else { + if (x) { + } else { if (y) { return true; } @@ -24,7 +25,8 @@ check_true_false(x, y) { if (x) { - if (y) {} else { + if (y) { + } else { return true; } } @@ -32,8 +34,10 @@ } check_false_false(x, y) { - if (x) {} else { - if (y) {} else { + if (x) { + } else { + if (y) { + } else { return true; } }
diff --git a/tests/language/rewrite/nested_if3_test.dart b/tests/language/rewrite/nested_if3_test.dart index b985df8..dbc3172 100644 --- a/tests/language/rewrite/nested_if3_test.dart +++ b/tests/language/rewrite/nested_if3_test.dart
@@ -17,7 +17,8 @@ } check_false_true(x, y) { - if (x) {} else { + if (x) { + } else { if (y) { return true; } @@ -28,7 +29,8 @@ check_true_false(x, y) { if (x) { - if (y) {} else { + if (y) { + } else { return true; } } @@ -37,8 +39,10 @@ } check_false_false(x, y) { - if (x) {} else { - if (y) {} else { + if (x) { + } else { + if (y) { + } else { return true; } }
diff --git a/tests/language/scaling/medium_offset_type_parameter_test.dart b/tests/language/scaling/medium_offset_type_parameter_test.dart index 1817192..e5a6c05 100644 --- a/tests/language/scaling/medium_offset_type_parameter_test.dart +++ b/tests/language/scaling/medium_offset_type_parameter_test.dart
@@ -5,523 +5,525 @@ // VMOptions=--optimization-counter-threshold=100 --no-use-osr --no-background-compilation class C< - T0, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - T9, - T10, - T11, - T12, - T13, - T14, - T15, - T16, - T17, - T18, - T19, - T20, - T21, - T22, - T23, - T24, - T25, - T26, - T27, - T28, - T29, - T30, - T31, - T32, - T33, - T34, - T35, - T36, - T37, - T38, - T39, - T40, - T41, - T42, - T43, - T44, - T45, - T46, - T47, - T48, - T49, - T50, - T51, - T52, - T53, - T54, - T55, - T56, - T57, - T58, - T59, - T60, - T61, - T62, - T63, - T64, - T65, - T66, - T67, - T68, - T69, - T70, - T71, - T72, - T73, - T74, - T75, - T76, - T77, - T78, - T79, - T80, - T81, - T82, - T83, - T84, - T85, - T86, - T87, - T88, - T89, - T90, - T91, - T92, - T93, - T94, - T95, - T96, - T97, - T98, - T99, - T100, - T101, - T102, - T103, - T104, - T105, - T106, - T107, - T108, - T109, - T110, - T111, - T112, - T113, - T114, - T115, - T116, - T117, - T118, - T119, - T120, - T121, - T122, - T123, - T124, - T125, - T126, - T127, - T128, - T129, - T130, - T131, - T132, - T133, - T134, - T135, - T136, - T137, - T138, - T139, - T140, - T141, - T142, - T143, - T144, - T145, - T146, - T147, - T148, - T149, - T150, - T151, - T152, - T153, - T154, - T155, - T156, - T157, - T158, - T159, - T160, - T161, - T162, - T163, - T164, - T165, - T166, - T167, - T168, - T169, - T170, - T171, - T172, - T173, - T174, - T175, - T176, - T177, - T178, - T179, - T180, - T181, - T182, - T183, - T184, - T185, - T186, - T187, - T188, - T189, - T190, - T191, - T192, - T193, - T194, - T195, - T196, - T197, - T198, - T199, - T200, - T201, - T202, - T203, - T204, - T205, - T206, - T207, - T208, - T209, - T210, - T211, - T212, - T213, - T214, - T215, - T216, - T217, - T218, - T219, - T220, - T221, - T222, - T223, - T224, - T225, - T226, - T227, - T228, - T229, - T230, - T231, - T232, - T233, - T234, - T235, - T236, - T237, - T238, - T239, - T240, - T241, - T242, - T243, - T244, - T245, - T246, - T247, - T248, - T249, - T250, - T251, - T252, - T253, - T254, - T255, - T256> { + T0, + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19, + T20, + T21, + T22, + T23, + T24, + T25, + T26, + T27, + T28, + T29, + T30, + T31, + T32, + T33, + T34, + T35, + T36, + T37, + T38, + T39, + T40, + T41, + T42, + T43, + T44, + T45, + T46, + T47, + T48, + T49, + T50, + T51, + T52, + T53, + T54, + T55, + T56, + T57, + T58, + T59, + T60, + T61, + T62, + T63, + T64, + T65, + T66, + T67, + T68, + T69, + T70, + T71, + T72, + T73, + T74, + T75, + T76, + T77, + T78, + T79, + T80, + T81, + T82, + T83, + T84, + T85, + T86, + T87, + T88, + T89, + T90, + T91, + T92, + T93, + T94, + T95, + T96, + T97, + T98, + T99, + T100, + T101, + T102, + T103, + T104, + T105, + T106, + T107, + T108, + T109, + T110, + T111, + T112, + T113, + T114, + T115, + T116, + T117, + T118, + T119, + T120, + T121, + T122, + T123, + T124, + T125, + T126, + T127, + T128, + T129, + T130, + T131, + T132, + T133, + T134, + T135, + T136, + T137, + T138, + T139, + T140, + T141, + T142, + T143, + T144, + T145, + T146, + T147, + T148, + T149, + T150, + T151, + T152, + T153, + T154, + T155, + T156, + T157, + T158, + T159, + T160, + T161, + T162, + T163, + T164, + T165, + T166, + T167, + T168, + T169, + T170, + T171, + T172, + T173, + T174, + T175, + T176, + T177, + T178, + T179, + T180, + T181, + T182, + T183, + T184, + T185, + T186, + T187, + T188, + T189, + T190, + T191, + T192, + T193, + T194, + T195, + T196, + T197, + T198, + T199, + T200, + T201, + T202, + T203, + T204, + T205, + T206, + T207, + T208, + T209, + T210, + T211, + T212, + T213, + T214, + T215, + T216, + T217, + T218, + T219, + T220, + T221, + T222, + T223, + T224, + T225, + T226, + T227, + T228, + T229, + T230, + T231, + T232, + T233, + T234, + T235, + T236, + T237, + T238, + T239, + T240, + T241, + T242, + T243, + T244, + T245, + T246, + T247, + T248, + T249, + T250, + T251, + T252, + T253, + T254, + T255, + T256 +> { @pragma("vm:never-inline") static create<T>() { return new C< - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - T>(); + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + T + >(); } @pragma("vm:never-inline")
diff --git a/tests/language/script/script1_test.dart b/tests/language/script/script1_test.dart index 8d714e9..457468e 100644 --- a/tests/language/script/script1_test.dart +++ b/tests/language/script/script1_test.dart
@@ -6,7 +6,7 @@ part "script1_part.dart"; import "script1_lib.dart"; -// [error line 8, column 1, length 6] +// [error column 1, length 6] // [analyzer] SYNTACTIC_ERROR.IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE // [cfe] Import directives must precede part directives.
diff --git a/tests/language/sealed_class/sealed_class_as_mixin_error_test.dart b/tests/language/sealed_class/sealed_class_as_mixin_error_test.dart index 7fea3b3..ec6dbed 100644 --- a/tests/language/sealed_class/sealed_class_as_mixin_error_test.dart +++ b/tests/language/sealed_class/sealed_class_as_mixin_error_test.dart
@@ -14,11 +14,11 @@ // [cfe] The class 'SealedClass' can't be used as a mixin because it isn't a mixin class nor a mixin. class OutsideB with SealedClass { -// ^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.CLASS_USED_AS_MIXIN -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY -// [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. -// [cfe] The class 'SealedClass' can't be used as a mixin because it isn't a mixin class nor a mixin. + // ^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.CLASS_USED_AS_MIXIN + // [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY + // [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. + // [cfe] The class 'SealedClass' can't be used as a mixin because it isn't a mixin class nor a mixin. int foo = 2; int bar(int value) => value; } @@ -46,3 +46,4 @@ // [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. // [cfe] The class 'SealedClass' can't be used as a mixin because it isn't a mixin class nor a mixin. +
diff --git a/tests/language/sealed_class/sealed_class_extend_error_test.dart b/tests/language/sealed_class/sealed_class_extend_error_test.dart index 13d4148..71e3703 100644 --- a/tests/language/sealed_class/sealed_class_extend_error_test.dart +++ b/tests/language/sealed_class/sealed_class_extend_error_test.dart
@@ -12,9 +12,9 @@ // [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. class OutsideB extends SealedClass { -// ^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY -// [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. + // ^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY + // [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. int foo = 2; int bar(int value) => value; }
diff --git a/tests/language/sealed_class/sealed_class_implement_error_test.dart b/tests/language/sealed_class/sealed_class_implement_error_test.dart index 5749bc6..0c4c9af 100644 --- a/tests/language/sealed_class/sealed_class_implement_error_test.dart +++ b/tests/language/sealed_class/sealed_class_implement_error_test.dart
@@ -12,9 +12,9 @@ // [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. class OutsideB implements SealedClass { -// ^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY -// [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. + // ^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY + // [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. int nonAbstractFoo = 2; int foo = 2; int nonAbstractBar(int value) => value; @@ -30,3 +30,4 @@ // ^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'ClassForEnum' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. +
diff --git a/tests/language/sealed_class/sealed_class_typedef_error_test.dart b/tests/language/sealed_class/sealed_class_typedef_error_test.dart index 40953e0..7625836 100644 --- a/tests/language/sealed_class/sealed_class_typedef_error_test.dart +++ b/tests/language/sealed_class/sealed_class_typedef_error_test.dart
@@ -13,8 +13,8 @@ // [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. class BTypeDef implements SealedClassTypeDef { -// ^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY -// [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. + // ^^^^^^^^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY + // [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. int foo = 1; }
diff --git a/tests/language/sealed_class/sealed_class_typedef_used_outside_error_test.dart b/tests/language/sealed_class/sealed_class_typedef_used_outside_error_test.dart index bdfeeea..6ec2ae0 100644 --- a/tests/language/sealed_class/sealed_class_typedef_used_outside_error_test.dart +++ b/tests/language/sealed_class/sealed_class_typedef_used_outside_error_test.dart
@@ -16,8 +16,8 @@ // [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. class B implements ATypeDef { -// ^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY -// [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. + // ^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY + // [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. int foo = 1; }
diff --git a/tests/language/set_literals/const_set_literal_test.dart b/tests/language/set_literals/const_set_literal_test.dart index 0e7c57d..1b0c229 100644 --- a/tests/language/set_literals/const_set_literal_test.dart +++ b/tests/language/set_literals/const_set_literal_test.dart
@@ -70,18 +70,25 @@ checkSet<Symbol>(const {#foo, #bar}, [#foo, #bar]); checkSet<Symbol>(const {#_foo, #_bar}, [#_foo, #_bar]); const object = Object(); - checkSet<Object>(const {#foo, 1, "string", object, true}, - [#foo, 1, "string", object, true]); + checkSet<Object>( + const {#foo, 1, "string", object, true}, + [#foo, 1, "string", object, true], + ); // Nested constant literals. - const Object o = {{2}}; + const Object o = { + {2}, + }; Expect.type<Set<Set<int>>>(o); Set<Set<int>> set = o as Set<Set<int>>; Expect.equals(1, set.length); Expect.equals(1, set.first.length); Expect.equals(2, set.first.first); - const Object o2 = {{2}, <int>{}}; + const Object o2 = { + {2}, + <int>{}, + }; Expect.type<Set<Set<int>>>(o); set = o2 as Set<Set<int>>; Expect.equals(2, set.length); @@ -97,7 +104,10 @@ Expect.equals(1, o4.length); Expect.equals(0, o4.first.length); - const o5 = {{1}, {}}; // Set<Object> + const o5 = { + {1}, + {}, + }; // Set<Object> Expect.type<Set<Object>>(o5); Expect.notType<Set<Set<Object>>>(o5);
diff --git a/tests/language/set_literals/in_annotations_test.dart b/tests/language/set_literals/in_annotations_test.dart index d59dfa9..7abb574 100644 --- a/tests/language/set_literals/in_annotations_test.dart +++ b/tests/language/set_literals/in_annotations_test.dart
@@ -26,7 +26,7 @@ @Meta({}) enum E { @Meta({}) - v + v, } class Meta {
diff --git a/tests/language/set_literals/set_literal_test.dart b/tests/language/set_literals/set_literal_test.dart index ee2d27c..2a05308 100644 --- a/tests/language/set_literals/set_literal_test.dart +++ b/tests/language/set_literals/set_literal_test.dart
@@ -79,12 +79,17 @@ entries.add(entry); return value; } + checkSet<Equality>( - {log(e1a, 1), log(e2b, 2), log(e1b, 3), log(e2a, 4)}, [e1a, e2b]); + {log(e1a, 1), log(e2b, 2), log(e1b, 3), log(e2a, 4)}, + [e1a, e2b], + ); Expect.listEquals([1, 2, 3, 4], entries); // Nested literals. - Object o = {{2}}; + Object o = { + {2}, + }; Expect.type<LinkedHashSet<Set<int>>>(o); Expect.type<LinkedHashSet<int>>((o as Set).first); Set<Set<int>> set = o as Set<Set<int>>; @@ -92,7 +97,10 @@ Expect.equals(1, set.first.length); Expect.equals(2, set.first.first); - o = {{2}, <int>{}}; + o = { + {2}, + <int>{}, + }; Expect.type<LinkedHashSet<Set<int>>>(o); Expect.type<LinkedHashSet<int>>((o as Set).first); set = o as Set<Set<int>>; @@ -105,17 +113,26 @@ Expect.equals(1, set2.length); Expect.equals(0, set2.first.length); - var set3 = {{1}, {}}; // Set<Object> + var set3 = { + {1}, + {}, + }; // Set<Object> Expect.type<Set<Object>>(set3); Expect.notType<Set<Set<Object>>>(set3); // Trailing comma. Iterable<Object> i; + // Don't let the formatter remove the trailing commas. + // dart format off i = {1,}; + // dart format on Expect.type<Set<Object>>(i); Expect.equals(1, i.length); + // Don't let the formatter remove the trailing commas. + // dart format off Object o2 = {1, 2, 3,}; + // dart format on Expect.type<Set<int>>(o2); Set<Object> set4 = o2 as Set<Object>; Expect.equals(3, set4.length); @@ -126,6 +143,6 @@ final String name; const Equality(this.id, this.name); int get hashCode => id; - bool operator==(Object other) => other is Equality && id == other.id; + bool operator ==(Object other) => other is Equality && id == other.id; String toString() => "$id:$name"; }
diff --git a/tests/language/setter/declaration_test.dart b/tests/language/setter/declaration_test.dart index 78d5e81..a89958a 100644 --- a/tests/language/setter/declaration_test.dart +++ b/tests/language/setter/declaration_test.dart
@@ -18,18 +18,18 @@ // ^ // [cfe] A setter should have exactly one formal parameter. -/*space*/ int? set wrongReturnType1(_) => 1; -// ^^^^ +int? set wrongReturnType1(_) => 1; +// [error column 1, length 4] // [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER // [cfe] The return type of the setter must be 'void' or absent. -/*space*/ FutureOr<void> set wrongReturnType2(_) {} -// ^^^^^^^^^^^^^^ +FutureOr<void> set wrongReturnType2(_) {} +// [error column 1, length 14] // [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER // [cfe] The return type of the setter must be 'void' or absent. -/*space*/ Never set wrongReturnType3(_) => throw 1; -// ^^^^^ +Never set wrongReturnType3(_) => throw 1; +// [error column 1, length 5] // [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER // [cfe] The return type of the setter must be 'void' or absent. @@ -73,18 +73,18 @@ // [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER // [cfe] The return type of the setter must be 'void' or absent. - /*space*/ int? set wrongReturnType1(_) => 1; - // ^^^^ + int? set wrongReturnType1(_) => 1; + // [error column 3, length 4] // [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER // [cfe] The return type of the setter must be 'void' or absent. - /*space*/ FutureOr<void> set wrongReturnType2(_) {} - // ^^^^^^^^^^^^^^ + FutureOr<void> set wrongReturnType2(_) {} + // [error column 3, length 14] // [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER // [cfe] The return type of the setter must be 'void' or absent. - /*space*/ Never set wrongReturnType3(_) => throw 1; - // ^^^^^ + Never set wrongReturnType3(_) => throw 1; + // [error column 3, length 5] // [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER // [cfe] The return type of the setter must be 'void' or absent.
diff --git a/tests/language/setter/no_getter_call_runtime_test.dart b/tests/language/setter/no_getter_call_runtime_test.dart index d243de3..121c1ae 100644 --- a/tests/language/setter/no_getter_call_runtime_test.dart +++ b/tests/language/setter/no_getter_call_runtime_test.dart
@@ -9,7 +9,6 @@ var topLevelClosure; - get topLevel => topLevelClosure; set topLevel(var value) {}
diff --git a/tests/language/setter/no_getter_test.dart b/tests/language/setter/no_getter_test.dart index 53c8b58..194d299 100644 --- a/tests/language/setter/no_getter_test.dart +++ b/tests/language/setter/no_getter_test.dart
@@ -10,8 +10,8 @@ main() { print(topLevel++); - // ^ - // [analyzer] unspecified + // ^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER // [cfe] Getter not found: 'topLevel'. Example ex = new Example();
diff --git a/tests/language/setter/setter3_runtime_test.dart b/tests/language/setter/setter3_runtime_test.dart index 42d3d74..64ee100 100644 --- a/tests/language/setter/setter3_runtime_test.dart +++ b/tests/language/setter/setter3_runtime_test.dart
@@ -12,8 +12,6 @@ class A { set foo(x) {} void set bar(x) {} - - } main() {
diff --git a/tests/language/setter/setter3_test.dart b/tests/language/setter/setter3_test.dart index 59a6a7e..e0d6d7b3 100644 --- a/tests/language/setter/setter3_test.dart +++ b/tests/language/setter/setter3_test.dart
@@ -10,13 +10,13 @@ set foo(x) {} void set bar(x) {} dynamic set baz(x) {} -//^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER -// [cfe] The return type of the setter must be 'void' or absent. + // [error column 3, length 7] + // [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER + // [cfe] The return type of the setter must be 'void' or absent. bool set bob(x) {} -//^^^^ -// [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER -// [cfe] The return type of the setter must be 'void' or absent. + // [error column 3, length 4] + // [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER + // [cfe] The return type of the setter must be 'void' or absent. } main() {
diff --git a/tests/language/spread_collections/await_test.dart b/tests/language/spread_collections/await_test.dart index e540e70..2d064d2 100644 --- a/tests/language/spread_collections/await_test.dart +++ b/tests/language/spread_collections/await_test.dart
@@ -27,8 +27,13 @@ Expect.listEquals(list, [...await future12, 3, ...await future45]); // Await in null-aware spread. - Expect.listEquals( - list, [...?await nullableFuture12, 3, ...?await futureNull, 4, 5]); + Expect.listEquals(list, [ + ...?await nullableFuture12, + 3, + ...?await futureNull, + 4, + 5, + ]); } Future<void> testMap() async { @@ -41,8 +46,13 @@ Expect.mapEquals(map, {...await future12, 3: 3, ...await future45}); // Await in null-aware spread. - Expect.mapEquals(map, - {...?await nullableFuture12, 3: 3, ...?await futureNull, 4: 4, 5: 5}); + Expect.mapEquals(map, { + ...?await nullableFuture12, + 3: 3, + ...?await futureNull, + 4: 4, + 5: 5, + }); } Future<void> testSet() async { @@ -55,6 +65,11 @@ Expect.setEquals(set, {...await future12, 3, ...await future45}); // Await in null-aware spread. - Expect.setEquals( - set, {...?await nullableFuture12, 3, ...?await futureNull, 4, 5}); + Expect.setEquals(set, { + ...?await nullableFuture12, + 3, + ...?await futureNull, + 4, + 5, + }); }
diff --git a/tests/language/spread_collections/const_test.dart b/tests/language/spread_collections/const_test.dart index cab125f..5e57612 100644 --- a/tests/language/spread_collections/const_test.dart +++ b/tests/language/spread_collections/const_test.dart
@@ -22,40 +22,82 @@ Expect.identical(list, const <int>[...set]); // Spread at beginning. - Expect.identical(list, const <int>[...<int>[1, 2], 3, 4]); + Expect.identical(list, const <int>[ + ...<int>[1, 2], + 3, + 4, + ]); // Spread in middle. - Expect.identical(list, const <int>[1, ...<int>[2, 3], 4]); + Expect.identical(list, const <int>[ + 1, + ...<int>[2, 3], + 4, + ]); // Spread at end. - Expect.identical(list, const <int>[1, 2, ...<int>[3, 4]]); + Expect.identical(list, const <int>[ + 1, + 2, + ...<int>[3, 4], + ]); // Empty spreads. - Expect.identical(list, - const <int>[...<int>[], 1, 2, ...<int>[], 3, 4, ...<int>[]]); + Expect.identical(list, const <int>[ + ...<int>[], + 1, + 2, + ...<int>[], + 3, + 4, + ...<int>[], + ]); // Multiple spreads. - Expect.identical(list, - const <int>[...<int>[1], 2, ...<int>[3, 4]]); + Expect.identical(list, const <int>[ + ...<int>[1], + 2, + ...<int>[3, 4], + ]); // Nested spreads. - Expect.identical(list, - const <int>[...<int>[...<int>[1, 2], ...<int>[3, 4]]]); + Expect.identical(list, const <int>[ + ...<int>[ + ...<int>[1, 2], + ...<int>[3, 4], + ], + ]); // Null-aware. const list23 = <int>[2, 3] as List<int>?; const list4 = <int>[4] as List<int>?; - Expect.identical(list, - const <int>[1, ...?list23, ...?(null), ...?list4]); + Expect.identical(list, const <int>[1, ...?list23, ...?(null), ...?list4]); // Does not deep flatten. Expect.identical( - const <Object>[1, 2, <int>[3], 4], - const <Object>[1, ...<Object>[2, <int>[3], 4]]); + const <Object>[ + 1, + 2, + <int>[3], + 4, + ], + const <Object>[ + 1, + ...<Object>[ + 2, + <int>[3], + 4, + ], + ], + ); // Establishes const context. - Expect.identical(const <Symbol>[Symbol("sym")], - const <Symbol>[...<Symbol>[Symbol("sym")]]); + Expect.identical( + const <Symbol>[Symbol("sym")], + const <Symbol>[ + ...<Symbol>[Symbol("sym")], + ], + ); } void testMap() { @@ -63,16 +105,25 @@ Expect.identical(map, const <int, int>{...map}); // Spread at beginning. - Expect.identical(map, - const <int, int>{...<int, int>{1: 1, 2: 2}, 3: 3, 4: 4}); + Expect.identical(map, const <int, int>{ + ...<int, int>{1: 1, 2: 2}, + 3: 3, + 4: 4, + }); // Spread in middle. - Expect.identical(map, - const <int, int>{1: 1, ...<int, int>{2: 2, 3: 3}, 4: 4}); + Expect.identical(map, const <int, int>{ + 1: 1, + ...<int, int>{2: 2, 3: 3}, + 4: 4, + }); // Spread at end. - Expect.identical(map, - const <int, int>{1: 1, 2: 2, ...<int, int>{3: 3, 4: 4}}); + Expect.identical(map, const <int, int>{ + 1: 1, + 2: 2, + ...<int, int>{3: 3, 4: 4}, + }); // Empty spreads. Expect.identical(map, const <int, int>{ @@ -82,19 +133,22 @@ ...<int, int>{}, 3: 3, 4: 4, - ...<int, int>{} + ...<int, int>{}, }); // Multiple spreads. - Expect.identical(map, - const <int, int>{...<int, int>{1: 1}, 2: 2, ...<int, int>{3: 3, 4: 4}}); + Expect.identical(map, const <int, int>{ + ...<int, int>{1: 1}, + 2: 2, + ...<int, int>{3: 3, 4: 4}, + }); // Nested spreads. Expect.identical(map, const <int, int>{ ...<int, int>{ ...<int, int>{1: 1, 2: 2}, - ...<int, int>{3: 3, 4: 4} - } + ...<int, int>{3: 3, 4: 4}, + }, }); // Null-aware. @@ -104,30 +158,34 @@ 1: 1, ...?map23, ...?(null), - ...?map4 + ...?map4, }); // Does not deep flatten. - Expect.identical(const <int, Object>{ - 1: 1, - 2: 2, - 3: <int, int>{3: 3}, - 4: 4 - }, const <int, Object>{ - 1: 1, - ...<int, Object>{ + Expect.identical( + const <int, Object>{ + 1: 1, 2: 2, 3: <int, int>{3: 3}, - 4: 4 - } - }); + 4: 4, + }, + const <int, Object>{ + 1: 1, + ...<int, Object>{ + 2: 2, + 3: <int, int>{3: 3}, + 4: 4, + }, + }, + ); // Establishes const context. - Expect.identical(const <Symbol, Symbol>{ - Symbol("sym"): Symbol("bol") - }, const <Symbol, Symbol>{ - ...<Symbol, Symbol>{Symbol("sym"): Symbol("bol")} - }); + Expect.identical( + const <Symbol, Symbol>{Symbol("sym"): Symbol("bol")}, + const <Symbol, Symbol>{ + ...<Symbol, Symbol>{Symbol("sym"): Symbol("bol")}, + }, + ); } void testSet() { @@ -136,51 +194,123 @@ Expect.identical(set, const <int>{...list}); // Spread at beginning. - Expect.identical(set, const <int>{...<int>[1, 2], 3, 4}); + Expect.identical(set, const <int>{ + ...<int>[1, 2], + 3, + 4, + }); // Spread in middle. - Expect.identical(set, const <int>{1, ...<int>[2, 3], 4}); + Expect.identical(set, const <int>{ + 1, + ...<int>[2, 3], + 4, + }); // Spread at end. - Expect.identical(set, const <int>{1, 2, ...<int>[3, 4]}); + Expect.identical(set, const <int>{ + 1, + 2, + ...<int>[3, 4], + }); // Empty spreads. - Expect.identical(set, - const <int>{...<int>[], 1, 2, ...<int>[], 3, 4, ...<int>[]}); + Expect.identical(set, const <int>{ + ...<int>[], + 1, + 2, + ...<int>[], + 3, + 4, + ...<int>[], + }); // Multiple spreads. - Expect.identical(set, const <int>{...<int>[1], 2, ...<int>[3, 4]}); + Expect.identical(set, const <int>{ + ...<int>[1], + 2, + ...<int>[3, 4], + }); // Nested spreads. - Expect.identical(set, const <int>{...<int>{...<int>[1, 2], ...<int>[3, 4]}}); + Expect.identical(set, const <int>{ + ...<int>{ + ...<int>[1, 2], + ...<int>[3, 4], + }, + }); // Null-aware. const list23 = <int>[2, 3] as List<int>?; const list4 = <int>[4] as List<int>?; - Expect.identical(set, - const <int>{1, ...?list23, ...?(null), ...?list4}); + Expect.identical(set, const <int>{1, ...?list23, ...?(null), ...?list4}); // Does not deep flatten. - Expect.identical(const <Object>{1, 2, <int>{3}, 4}, - const <Object>{1, ...<Object>{2, <int>{3}, 4}}); + Expect.identical( + const <Object>{ + 1, + 2, + <int>{3}, + 4, + }, + const <Object>{ + 1, + ...<Object>{ + 2, + <int>{3}, + 4, + }, + }, + ); // Establishes const context. - Expect.identical(const <Symbol>{Symbol("sym")}, - const <Symbol>{...<Symbol>{Symbol("sym")}}); + Expect.identical( + const <Symbol>{Symbol("sym")}, + const <Symbol>{ + ...<Symbol>{Symbol("sym")}, + }, + ); } void testKeyOrder() { // Canonicalization isn't affected by which elements are spread. - Expect.identical(map, - const <int, int>{1: 1, ...<int, int>{2: 2, 3: 3}, 4: 4}); - Expect.identical(map, - const <int, int>{1: 1, ...<int, int>{2: 2}, 3: 3, ...<int, int>{4: 4}}); + Expect.identical(map, const <int, int>{ + 1: 1, + ...<int, int>{2: 2, 3: 3}, + 4: 4, + }); + Expect.identical(map, const <int, int>{ + 1: 1, + ...<int, int>{2: 2}, + 3: 3, + ...<int, int>{4: 4}, + }); - Expect.identical(set, const <int>{1, ...<int>{2, 3}, 4}); - Expect.identical(set, const <int>{1, ...<int>{2}, 3, ...<int>{4}}); + Expect.identical(set, const <int>{ + 1, + ...<int>{2, 3}, + 4, + }); + Expect.identical(set, const <int>{ + 1, + ...<int>{2}, + 3, + ...<int>{4}, + }); // Ordering does affect canonicalization. - Expect.notIdentical(const <int, int>{1: 1, 2: 2, 3: 3}, - const <int, int>{1: 1, ...<int, int>{3: 3, 2: 2}}); - Expect.notIdentical(const <int>{1, 2, 3}, const <int>{1, ...<int>{3, 2}}); + Expect.notIdentical( + const <int, int>{1: 1, 2: 2, 3: 3}, + const <int, int>{ + 1: 1, + ...<int, int>{3: 3, 2: 2}, + }, + ); + Expect.notIdentical( + const <int>{1, 2, 3}, + const <int>{ + 1, + ...<int>{3, 2}, + }, + ); }
diff --git a/tests/language/spread_collections/helper_classes.dart b/tests/language/spread_collections/helper_classes.dart index 3e10706..d7a0322 100644 --- a/tests/language/spread_collections/helper_classes.dart +++ b/tests/language/spread_collections/helper_classes.dart
@@ -39,9 +39,11 @@ String? remove(Object? key) => throw UnsupportedError("unsupported"); void removeWhere(bool Function(int key, String value) predicate) => throw UnsupportedError("unsupported"); - String update(int key, String Function(String value) update, - {String Function()? ifAbsent}) => - throw UnsupportedError("unsupported"); + String update( + int key, + String Function(String value) update, { + String Function()? ifAbsent, + }) => throw UnsupportedError("unsupported"); void updateAll(String Function(int key, String value) update) => throw UnsupportedError("unsupported"); }
diff --git a/tests/language/spread_collections/inference_test.dart b/tests/language/spread_collections/inference_test.dart index c0dff36..0259859 100644 --- a/tests/language/spread_collections/inference_test.dart +++ b/tests/language/spread_collections/inference_test.dart
@@ -14,37 +14,97 @@ // Lists. Expect.type<List<dynamic>>([...[]]); Expect.type<List<int>>([...<int>[]]); - Expect.type<List<int>>([...[1]]); - Expect.type<List<int>>([1, ...[2]]); - Expect.type<List<num>>([1, ...[0.2]]); - Expect.type<List<int>>([...[1, 2]]); - Expect.type<List<num>>([...[1, 0.2]]); - Expect.type<List<int>>([...[1], ...[2]]); - Expect.type<List<num>>([...[1], ...[0.2]]); + Expect.type<List<int>>([ + ...[1], + ]); + Expect.type<List<int>>([ + 1, + ...[2], + ]); + Expect.type<List<num>>([ + 1, + ...[0.2], + ]); + Expect.type<List<int>>([ + ...[1, 2], + ]); + Expect.type<List<num>>([ + ...[1, 0.2], + ]); + Expect.type<List<int>>([ + ...[1], + ...[2], + ]); + Expect.type<List<num>>([ + ...[1], + ...[0.2], + ]); // Maps. Expect.type<Map<dynamic, dynamic>>({...{}}); Expect.type<Map<int, int>>({...<int, int>{}}); - Expect.type<Map<int, int>>({...{1: 1}}); - Expect.type<Map<int, int>>({1: 1, ...{2: 2}}); - Expect.type<Map<num, num>>({1: 1, ...{0.2: 0.2}}); - Expect.type<Map<int, int>>({...{1: 1, 2: 2}}); - Expect.type<Map<num, num>>({...{1: 1, 0.2: 0.2}}); - Expect.type<Map<int, int>>({...{1: 1}, ...{2: 2}}); - Expect.type<Map<num, num>>({...{1: 1}, ...{0.2: 0.2}}); + Expect.type<Map<int, int>>({ + ...{1: 1}, + }); + Expect.type<Map<int, int>>({ + 1: 1, + ...{2: 2}, + }); + Expect.type<Map<num, num>>({ + 1: 1, + ...{0.2: 0.2}, + }); + Expect.type<Map<int, int>>({ + ...{1: 1, 2: 2}, + }); + Expect.type<Map<num, num>>({ + ...{1: 1, 0.2: 0.2}, + }); + Expect.type<Map<int, int>>({ + ...{1: 1}, + ...{2: 2}, + }); + Expect.type<Map<num, num>>({ + ...{1: 1}, + ...{0.2: 0.2}, + }); // Sets. Expect.type<Set<dynamic>>({...[]}); Expect.type<Set<int>>({...<int>[]}); - Expect.type<Set<int>>({...[1]}); - Expect.type<Set<int>>({1, ...[2]}); - Expect.type<Set<num>>({1, ...[0.2]}); - Expect.type<Set<int>>({...[1, 2]}); - Expect.type<Set<num>>({...[1, 0.2]}); - Expect.type<Set<int>>({...[1], ...[2]}); - Expect.type<Set<num>>({...[1], ...[0.2]}); - Expect.type<Set<num>>({...{1}, ...[0.2]}); - Expect.type<Set<num>>({...{1}, ...{0.2}}); + Expect.type<Set<int>>({ + ...[1], + }); + Expect.type<Set<int>>({ + 1, + ...[2], + }); + Expect.type<Set<num>>({ + 1, + ...[0.2], + }); + Expect.type<Set<int>>({ + ...[1, 2], + }); + Expect.type<Set<num>>({ + ...[1, 0.2], + }); + Expect.type<Set<int>>({ + ...[1], + ...[2], + }); + Expect.type<Set<num>>({ + ...[1], + ...[0.2], + }); + Expect.type<Set<num>>({ + ...{1}, + ...[0.2], + }); + Expect.type<Set<num>>({ + ...{1}, + ...{0.2}, + }); // If the iterable's type is dynamic, the element type is inferred as dynamic. Expect.type<List<dynamic>>([...([] as dynamic)]); @@ -92,8 +152,10 @@ Expect.mapEquals(<int, String>{}, <int, String>{...expectIntStringMap()}); // Bottom up-inference from elements is not pushed back down into spread. - Expect.mapEquals(<int, String>{1: "s"}, - {1: "s", ...expectDynamicDynamicMap()}); + Expect.mapEquals( + <int, String>{1: "s"}, + {1: "s", ...expectDynamicDynamicMap()}, + ); // Sets. Set<T> expectIntSet<T>() {
diff --git a/tests/language/spread_collections/issue_45174_error_test.dart b/tests/language/spread_collections/issue_45174_error_test.dart index 377498c..55adb3c 100644 --- a/tests/language/spread_collections/issue_45174_error_test.dart +++ b/tests/language/spread_collections/issue_45174_error_test.dart
@@ -8,7 +8,6 @@ // [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_SET_OR_MAP_LITERAL_EITHER // ^^^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE - // ^ // [cfe] Unexpected type 'Object?' of a map spread entry. Expected 'dynamic' or a Map. }
diff --git a/tests/language/spread_collections/null_spread_context_test.dart b/tests/language/spread_collections/null_spread_context_test.dart index 63cba55..b3f1684 100644 --- a/tests/language/spread_collections/null_spread_context_test.dart +++ b/tests/language/spread_collections/null_spread_context_test.dart
@@ -11,27 +11,28 @@ main() { { List<int> notNullAware = [ - ...(contextType(<int>[])..expectStaticType<Exactly<Iterable<int>>>()) + ...(contextType(<int>[])..expectStaticType<Exactly<Iterable<int>>>()), ]; List<int> nullAware = [ - ...?(contextType(<int>[])..expectStaticType<Exactly<Iterable<int>?>>()) + ...?(contextType(<int>[])..expectStaticType<Exactly<Iterable<int>?>>()), ]; } { Set<int> notNullAware = { - ...(contextType(<int>[])..expectStaticType<Exactly<Iterable<int>>>()) + ...(contextType(<int>[])..expectStaticType<Exactly<Iterable<int>>>()), }; Set<int> nullAware = { - ...?(contextType(<int>[])..expectStaticType<Exactly<Iterable<int>?>>()) + ...?(contextType(<int>[])..expectStaticType<Exactly<Iterable<int>?>>()), }; } { Map<int, int> notNullAware = { - ...(contextType(<int, int>{})..expectStaticType<Exactly<Map<int, int>>>()) + ...(contextType(<int, int>{}) + ..expectStaticType<Exactly<Map<int, int>>>()), }; Map<int, int> nullAware = { ...?(contextType(<int, int>{}) - ..expectStaticType<Exactly<Map<int, int>?>>()) + ..expectStaticType<Exactly<Map<int, int>?>>()), }; } }
diff --git a/tests/language/spread_collections/spread_test.dart b/tests/language/spread_collections/spread_test.dart index baee04c..de20d74 100644 --- a/tests/language/spread_collections/spread_test.dart +++ b/tests/language/spread_collections/spread_test.dart
@@ -24,23 +24,51 @@ Expect.listEquals(list, <int>[...list]); // Spread at beginning. - Expect.listEquals(list, <int>[...<int>[1, 2], 3, 4]); + Expect.listEquals(list, <int>[ + ...<int>[1, 2], + 3, + 4, + ]); // Spread in middle. - Expect.listEquals(list, <int>[1, ...<int>[2, 3], 4]); + Expect.listEquals(list, <int>[ + 1, + ...<int>[2, 3], + 4, + ]); // Spread at end. - Expect.listEquals(list, <int>[1, 2, ...<int>[3, 4]]); + Expect.listEquals(list, <int>[ + 1, + 2, + ...<int>[3, 4], + ]); // Empty spreads. - Expect.listEquals(list, - <int>[...<int>[], 1, 2, ...<int>[], 3, 4, ...<int>[]]); + Expect.listEquals(list, <int>[ + ...<int>[], + 1, + 2, + ...<int>[], + 3, + 4, + ...<int>[], + ]); // Multiple spreads. - Expect.listEquals(list, <int>[...<int>[1], 2, ...<int>[3, 4]]); + Expect.listEquals(list, <int>[ + ...<int>[1], + 2, + ...<int>[3, 4], + ]); // Nested spreads. - Expect.listEquals(list, <int>[...<int>[...<int>[1, 2], ...<int>[3, 4]]]); + Expect.listEquals(list, <int>[ + ...<int>[ + ...<int>[1, 2], + ...<int>[3, 4], + ], + ]); // Null-aware. var list23 = [2, 3] as List<int>?; @@ -50,11 +78,17 @@ // Does not deep flatten. var innerList = <int>[3]; Expect.listEquals( - <Object>[1, 2, innerList, 4], - <Object>[1, ...<Object>[2, innerList, 4]]); + <Object>[1, 2, innerList, 4], + <Object>[ + 1, + ...<Object>[2, innerList, 4], + ], + ); // Downcast element from dynamic. - Expect.listEquals(list, <int>[...<dynamic>[1, 2, 3, 4]]); + Expect.listEquals(list, <int>[ + ...<dynamic>[1, 2, 3, 4], + ]); } void testMap() { @@ -62,13 +96,25 @@ Expect.mapEquals(map, <int, int>{...map}); // Spread at beginning. - Expect.mapEquals(map, <int, int>{...<int, int>{1: 1, 2: 2}, 3: 3, 4: 4}); + Expect.mapEquals(map, <int, int>{ + ...<int, int>{1: 1, 2: 2}, + 3: 3, + 4: 4, + }); // Spread in middle. - Expect.mapEquals(map, <int, int>{1: 1, ...<int, int>{2: 2, 3: 3}, 4: 4}); + Expect.mapEquals(map, <int, int>{ + 1: 1, + ...<int, int>{2: 2, 3: 3}, + 4: 4, + }); // Spread at end. - Expect.mapEquals(map, <int, int>{1: 1, 2: 2, ...<int, int>{3: 3, 4: 4}}); + Expect.mapEquals(map, <int, int>{ + 1: 1, + 2: 2, + ...<int, int>{3: 3, 4: 4}, + }); // Empty spreads. Expect.mapEquals(map, <int, int>{ @@ -78,50 +124,43 @@ ...<int, int>{}, 3: 3, 4: 4, - ...<int, int>{} + ...<int, int>{}, }); // Multiple spreads. - Expect.mapEquals(map, - <int, int>{...<int, int>{1: 1}, 2: 2, ...<int, int>{3: 3, 4: 4}}); + Expect.mapEquals(map, <int, int>{ + ...<int, int>{1: 1}, + 2: 2, + ...<int, int>{3: 3, 4: 4}, + }); // Nested spreads. Expect.mapEquals(map, <int, int>{ ...<int, int>{ ...<int, int>{1: 1, 2: 2}, - ...<int, int>{3: 3, 4: 4} - } + ...<int, int>{3: 3, 4: 4}, + }, }); // Null-aware. var map23 = {2: 2, 3: 3} as Map<int, int>?; var map4 = {4: 4} as Map<int, int>?; - Expect.mapEquals(map, <int, int>{ - 1: 1, - ...?map23, - ...?(null), - ...?map4 - }); + Expect.mapEquals(map, <int, int>{1: 1, ...?map23, ...?(null), ...?map4}); // Does not deep flatten. var innerMap = <int, int>{3: 3}; - Expect.mapEquals(<int, Object>{ - 1: 1, - 2: 2, - 3: innerMap, - 4: 4 - }, <int, Object>{ - 1: 1, - ...<int, Object>{ - 2: 2, - 3: innerMap, - 4: 4 - } - }); + Expect.mapEquals( + <int, Object>{1: 1, 2: 2, 3: innerMap, 4: 4}, + <int, Object>{ + 1: 1, + ...<int, Object>{2: 2, 3: innerMap, 4: 4}, + }, + ); // Downcast element from dynamic. - Expect.mapEquals( - map, <int, int>{...<dynamic, dynamic>{1: 1, 2: 2, 3: 3, 4: 4}}); + Expect.mapEquals(map, <int, int>{ + ...<dynamic, dynamic>{1: 1, 2: 2, 3: 3, 4: 4}, + }); } void testSet() { @@ -129,22 +168,43 @@ Expect.setEquals(set, <int>{...set}); // Spread at beginning. - Expect.setEquals(set, <int>{...<int>[1, 2], 3, 4}); + Expect.setEquals(set, <int>{ + ...<int>[1, 2], + 3, + 4, + }); // Spread in middle. - Expect.setEquals(set, <int>{1, ...<int>[2, 3], 4}); + Expect.setEquals(set, <int>{ + 1, + ...<int>[2, 3], + 4, + }); // Spread at end. - Expect.setEquals(set, <int>{1, 2, ...<int>[3, 4]}); + Expect.setEquals(set, <int>{ + 1, + 2, + ...<int>[3, 4], + }); // Empty spreads. Expect.setEquals(set, <int>{...<int>[], 1, 2, ...<int>[], 3, 4, ...<int>[]}); // Multiple spreads. - Expect.setEquals(set, <int>{...<int>[1], 2, ...<int>[3, 4]}); + Expect.setEquals(set, <int>{ + ...<int>[1], + 2, + ...<int>[3, 4], + }); // Nested spreads. - Expect.setEquals(set, <int>{...<int>{...<int>[1, 2], ...<int>[3, 4]}}); + Expect.setEquals(set, <int>{ + ...<int>{ + ...<int>[1, 2], + ...<int>[3, 4], + }, + }); // Null-aware. var list23 = [2, 3] as List<int>?; @@ -153,11 +213,18 @@ // Does not deep flatten. var innerSet = <int>{3}; - Expect.setEquals(<Object>{1, 2, innerSet, 4}, - <Object>{1, ...<Object>[2, innerSet, 4]}); + Expect.setEquals( + <Object>{1, 2, innerSet, 4}, + <Object>{ + 1, + ...<Object>[2, innerSet, 4], + }, + ); // Downcast element from dynamic. - Expect.setEquals(set, <int>{...<dynamic>[1, 2, 3, 4]}); + Expect.setEquals(set, <int>{ + ...<dynamic>[1, 2, 3, 4], + }); } void testDuplicateKeys() { @@ -166,9 +233,15 @@ 2: 2, ...<int, int>{2: 2, 3: 3, 4: 4}, ...<int, int>{3: 3}, - 4: 4 + 4: 4, }); - Expect.setEquals(set, <int>{1, 2, ...<int>[1, 2, 3, 4], ...<int>[2, 3], 4}); + Expect.setEquals(set, <int>{ + 1, + 2, + ...<int>[1, 2, 3, 4], + ...<int>[2, 3], + 4, + }); } void testKeyOrder() { @@ -178,10 +251,16 @@ var e2a = Equality(2, "a"); var e2b = Equality(2, "b"); - var map = <Equality, int>{e1a: 1, ...<Equality, int>{e1b: 2, e2a: 3, e2b: 4}}; + var map = <Equality, int>{ + e1a: 1, + ...<Equality, int>{e1b: 2, e2a: 3, e2b: 4}, + }; Expect.equals("1:a,2:a", map.keys.join(",")); - var set = <Equality>{e1a, ...<Equality>[e1b, e2a, e2b]}; + var set = <Equality>{ + e1a, + ...<Equality>[e1b, e2a, e2b], + }; Expect.equals("1:a,2:a", set.join(",")); // All elements are evaluated, left to right. @@ -193,11 +272,14 @@ map = <Equality, int>{ log(e1a): log(1), - ...<Equality, int>{log(e1b): log(2), log(e2a): log(3), log(e2b): log(4)} + ...<Equality, int>{log(e1b): log(2), log(e2a): log(3), log(e2b): log(4)}, }; Expect.equals("1:a,1,1:b,2,2:a,3,2:b,4", transcript.join(",")); transcript.clear(); - set = <Equality>{log(e1a), ...<Equality>[log(e1b), log(e2a), log(e2b)]}; + set = <Equality>{ + log(e1a), + ...<Equality>[log(e1b), log(e2a), log(e2b)], + }; Expect.equals("1:a,1:b,2:a,2:b", transcript.join(",")); }
diff --git a/tests/language/spread_collections/syntax_test.dart b/tests/language/spread_collections/syntax_test.dart index ed6676f..43e67d8 100644 --- a/tests/language/spread_collections/syntax_test.dart +++ b/tests/language/spread_collections/syntax_test.dart
@@ -7,16 +7,45 @@ void main() { // Trailing comma. - Expect.listEquals([1, 2], [...[1, 2],]); - Expect.mapEquals({1: 1, 2: 2}, {...{1: 1, 2: 2},}); - Expect.setEquals({1, 2}, {...{1, 2},}); + Expect.listEquals( + [1, 2], + [ + ...[1, 2], + ], + ); + Expect.mapEquals( + {1: 1, 2: 2}, + { + ...{1: 1, 2: 2}, + }, + ); + Expect.setEquals( + {1, 2}, + { + ...{1, 2}, + }, + ); // Precedence. - Expect.listEquals([1, 2, 3], [1, ...true ? [2] : [], 3]); + Expect.listEquals( + [1, 2, 3], + [ + 1, + ...true ? [2] : [], + 3, + ], + ); Expect.listEquals([1, 3], [1, ...?true ? null : [], 3]); var a = [0]; - Expect.listEquals([1, 2, 3], [1, ...a = [2], 3]); + Expect.listEquals( + [1, 2, 3], + [ + 1, + ...a = [2], + 3, + ], + ); var nullableA = [0] as List<int>?; Expect.listEquals([1, 3], [1, ...?nullableA = null, 3]);
diff --git a/tests/language/static/call_wrong_argument_count_test.dart b/tests/language/static/call_wrong_argument_count_test.dart index ca34e7cd..b101845 100644 --- a/tests/language/static/call_wrong_argument_count_test.dart +++ b/tests/language/static/call_wrong_argument_count_test.dart
@@ -13,8 +13,8 @@ Niesen.goodCall(1, 2, 3); Niesen.goodCall(1, 2, 3, 4); + // ^ + // [cfe] Too many positional arguments: 3 allowed, but 4 found. // ^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS - // ^^^^^^^^^^^^ - // [cfe] Too many positional arguments: 3 allowed, but 4 found. }
diff --git a/tests/language/static/const_field_test.dart b/tests/language/static/const_field_test.dart index 2a6547e..6c86099 100644 --- a/tests/language/static/const_field_test.dart +++ b/tests/language/static/const_field_test.dart
@@ -30,10 +30,7 @@ static const artist2 = Switzerland.AG; static const architect1 = Spain.AG; static const array1 = const <int>[1, 2]; - static const map1 = const { - "Monday": 1, - "Tuesday": 2, - }; + static const map1 = const {"Monday": 1, "Tuesday": 2}; } class StaticFinalFieldTest {
diff --git a/tests/language/static/field1_runtime_test.dart b/tests/language/static/field1_runtime_test.dart index 6db193e..1c30475 100644 --- a/tests/language/static/field1_runtime_test.dart +++ b/tests/language/static/field1_runtime_test.dart
@@ -15,7 +15,6 @@ static testMain() { if (false) { var foo = new Foo(); - } } }
diff --git a/tests/language/static/field1a_runtime_test.dart b/tests/language/static/field1a_runtime_test.dart index 1f6b798..2675130 100644 --- a/tests/language/static/field1a_runtime_test.dart +++ b/tests/language/static/field1a_runtime_test.dart
@@ -15,7 +15,6 @@ static testMain() { if (false) { var foo = new Foo(); - } } }
diff --git a/tests/language/static/field3_runtime_test.dart b/tests/language/static/field3_runtime_test.dart index d2c9f3a..65c1264 100644 --- a/tests/language/static/field3_runtime_test.dart +++ b/tests/language/static/field3_runtime_test.dart
@@ -13,10 +13,5 @@ } main() { - if (false) { - - - - - } + if (false) {} }
diff --git a/tests/language/static/final_field2_runtime_test.dart b/tests/language/static/final_field2_runtime_test.dart index b69448d..7711ec8 100644 --- a/tests/language/static/final_field2_runtime_test.dart +++ b/tests/language/static/final_field2_runtime_test.dart
@@ -18,8 +18,6 @@ } main() { - new B(); print(B.b); - }
diff --git a/tests/language/static/final_field2_test.dart b/tests/language/static/final_field2_test.dart index da8ea37..fb6721d 100644 --- a/tests/language/static/final_field2_test.dart +++ b/tests/language/static/final_field2_test.dart
@@ -19,9 +19,9 @@ main() { A.x = 2; -// ^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_CONST -// [cfe] Setter not found: 'x'. + //^ + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_CONST + // [cfe] Setter not found: 'x'. new B(); print(B.b); print(B.a);
diff --git a/tests/language/static/getter_no_setter1_runtime_test.dart b/tests/language/static/getter_no_setter1_runtime_test.dart index 13567db..d0f0e7f 100644 --- a/tests/language/static/getter_no_setter1_runtime_test.dart +++ b/tests/language/static/getter_no_setter1_runtime_test.dart
@@ -10,9 +10,7 @@ class Class { static int get getter => 0; - method() { - - } + method() {} } main() {
diff --git a/tests/language/static/getter_no_setter1_test.dart b/tests/language/static/getter_no_setter1_test.dart index dd307ec..975d694 100644 --- a/tests/language/static/getter_no_setter1_test.dart +++ b/tests/language/static/getter_no_setter1_test.dart
@@ -9,9 +9,9 @@ method() { getter++; -// ^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'getter'. + // [error column 5, length 6] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'getter'. } }
diff --git a/tests/language/static/getter_no_setter2_runtime_test.dart b/tests/language/static/getter_no_setter2_runtime_test.dart index 82663cb..a737427 100644 --- a/tests/language/static/getter_no_setter2_runtime_test.dart +++ b/tests/language/static/getter_no_setter2_runtime_test.dart
@@ -10,9 +10,7 @@ class Class { static int get getter => 0; - method() { - - } + method() {} noSuchMethod(i) => 42; }
diff --git a/tests/language/static/getter_no_setter2_test.dart b/tests/language/static/getter_no_setter2_test.dart index e84b2b8..eb42434 100644 --- a/tests/language/static/getter_no_setter2_test.dart +++ b/tests/language/static/getter_no_setter2_test.dart
@@ -9,9 +9,9 @@ method() { getter++; -// ^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'getter'. + // [error column 5, length 6] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'getter'. } noSuchMethod(i) => 42;
diff --git a/tests/language/static/setter_get_runtime_test.dart b/tests/language/static/setter_get_runtime_test.dart index b04380c..dcf6349 100644 --- a/tests/language/static/setter_get_runtime_test.dart +++ b/tests/language/static/setter_get_runtime_test.dart
@@ -13,6 +13,4 @@ noSuchMethod(_) => 42; } -main() { - -} +main() {}
diff --git a/tests/language/static/top_level_runtime_test.dart b/tests/language/static/top_level_runtime_test.dart index 0c0b8ce..950b440 100644 --- a/tests/language/static/top_level_runtime_test.dart +++ b/tests/language/static/top_level_runtime_test.dart
@@ -5,14 +5,4 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. - - - - - - - - - - void main() {}
diff --git a/tests/language/static/top_level_test.dart b/tests/language/static/top_level_test.dart index 8d788cf..b0b577c 100644 --- a/tests/language/static/top_level_test.dart +++ b/tests/language/static/top_level_test.dart
@@ -3,36 +3,36 @@ // BSD-style license that can be found in the LICENSE file. static method() { } -// [error line 5, column 1, length 6] +// [error column 1, length 6] // [analyzer] SYNTACTIC_ERROR.EXTRANEOUS_MODIFIER // [cfe] Can't have modifier 'static' here. static var field; -// [error line 9, column 1, length 6] +// [error column 1, length 6] // [analyzer] SYNTACTIC_ERROR.EXTRANEOUS_MODIFIER // [cfe] Can't have modifier 'static' here. static const finalField = 42; -// [error line 13, column 1, length 6] +// [error column 1, length 6] // [analyzer] SYNTACTIC_ERROR.EXTRANEOUS_MODIFIER // [cfe] Can't have modifier 'static' here. static const constant = 123; -// [error line 17, column 1, length 6] +// [error column 1, length 6] // [analyzer] SYNTACTIC_ERROR.EXTRANEOUS_MODIFIER // [cfe] Can't have modifier 'static' here. static int typedMethod() => 87; -// [error line 22, column 1, length 6] +// [error column 1, length 6] // [analyzer] SYNTACTIC_ERROR.EXTRANEOUS_MODIFIER // [cfe] Can't have modifier 'static' here. static int typedField = -1; -// [error line 26, column 1, length 6] +// [error column 1, length 6] // [analyzer] SYNTACTIC_ERROR.EXTRANEOUS_MODIFIER // [cfe] Can't have modifier 'static' here. static const int typedFinalField = 99; -// [error line 30, column 1, length 6] +// [error column 1, length 6] // [analyzer] SYNTACTIC_ERROR.EXTRANEOUS_MODIFIER // [cfe] Can't have modifier 'static' here. static const int typedConstant = 1; -// [error line 34, column 1, length 6] +// [error column 1, length 6] // [analyzer] SYNTACTIC_ERROR.EXTRANEOUS_MODIFIER // [cfe] Can't have modifier 'static' here.
diff --git a/tests/language/string/adjacent_const_string_literals_test.dart b/tests/language/string/adjacent_const_string_literals_test.dart index 0af09ba..e7cde22 100644 --- a/tests/language/string/adjacent_const_string_literals_test.dart +++ b/tests/language/string/adjacent_const_string_literals_test.dart
@@ -21,97 +21,310 @@ } testEmpty() { - Expect.equals("", (const Conster("" "" "")).toString()); - Expect.equals("", (const Conster("" '' "")).toString()); - Expect.equals("", (const Conster("" "" r"")).toString()); + Expect.equals( + "", + (const Conster( + "" + "" + "", + )).toString(), + ); + Expect.equals( + "", + (const Conster( + "" + '' + "", + )).toString(), + ); + Expect.equals( + "", + (const Conster( + "" + "" + r"", + )).toString(), + ); - Expect.equals("a", (const Conster("a" "")).toString()); - Expect.equals("a", (const Conster("a" '')).toString()); - Expect.equals("a", (const Conster("a" r'')).toString()); + Expect.equals( + "a", + (const Conster( + "a" + "", + )).toString(), + ); + Expect.equals( + "a", + (const Conster( + "a" + '', + )).toString(), + ); + Expect.equals( + "a", + (const Conster( + "a" + r'', + )).toString(), + ); - Expect.equals("b", (const Conster('b' "")).toString()); - Expect.equals("b", (const Conster('b' '')).toString()); - Expect.equals("b", (const Conster('b' r'')).toString()); + Expect.equals( + "b", + (const Conster( + 'b' + "", + )).toString(), + ); + Expect.equals( + "b", + (const Conster( + 'b' + '', + )).toString(), + ); + Expect.equals( + "b", + (const Conster( + 'b' + r'', + )).toString(), + ); - Expect.equals("c", (const Conster(r'c' "")).toString()); - Expect.equals("c", (const Conster(r'c' '')).toString()); - Expect.equals("c", (const Conster(r'c' r'')).toString()); + Expect.equals( + "c", + (const Conster( + r'c' + "", + )).toString(), + ); + Expect.equals( + "c", + (const Conster( + r'c' + '', + )).toString(), + ); + Expect.equals( + "c", + (const Conster( + r'c' + r'', + )).toString(), + ); - Expect.equals("a", (const Conster("" "a")).toString()); - Expect.equals("a", (const Conster("" 'a')).toString()); - Expect.equals("a", (const Conster("" r'a')).toString()); + Expect.equals( + "a", + (const Conster( + "" + "a", + )).toString(), + ); + Expect.equals( + "a", + (const Conster( + "" + 'a', + )).toString(), + ); + Expect.equals( + "a", + (const Conster( + "" + r'a', + )).toString(), + ); - Expect.equals("b", (const Conster('' "b")).toString()); - Expect.equals("b", (const Conster('' 'b')).toString()); - Expect.equals("b", (const Conster('' r'b')).toString()); + Expect.equals( + "b", + (const Conster( + '' + "b", + )).toString(), + ); + Expect.equals( + "b", + (const Conster( + '' + 'b', + )).toString(), + ); + Expect.equals( + "b", + (const Conster( + '' + r'b', + )).toString(), + ); - Expect.equals("c", (const Conster(r'' "c")).toString()); - Expect.equals("c", (const Conster(r'' 'c')).toString()); - Expect.equals("c", (const Conster(r'' r'c')).toString()); + Expect.equals( + "c", + (const Conster( + r'' + "c", + )).toString(), + ); + Expect.equals( + "c", + (const Conster( + r'' + 'c', + )).toString(), + ); + Expect.equals( + "c", + (const Conster( + r'' + r'c', + )).toString(), + ); } const s = "a"; testInterpolation() { - Expect.equals(r"ab", (const Conster("$s" "b")).toString()); - Expect.equals(r"ab", (const Conster('$s' "b")).toString()); - Expect.equals(r"$sb", (const Conster(r'$s' "b")).toString()); + Expect.equals( + r"ab", + (const Conster( + "$s" + "b", + )).toString(), + ); + Expect.equals( + r"ab", + (const Conster( + '$s' + "b", + )).toString(), + ); + Expect.equals( + r"$sb", + (const Conster( + r'$s' + "b", + )).toString(), + ); - Expect.equals(r"-a-b", (const Conster("-$s-" "b")).toString()); - Expect.equals(r"-a-b", (const Conster('-$s-' "b")).toString()); - Expect.equals(r"-$s-b", (const Conster(r'-$s-' "b")).toString()); + Expect.equals( + r"-a-b", + (const Conster( + "-$s-" + "b", + )).toString(), + ); + Expect.equals( + r"-a-b", + (const Conster( + '-$s-' + "b", + )).toString(), + ); + Expect.equals( + r"-$s-b", + (const Conster( + r'-$s-' + "b", + )).toString(), + ); - Expect.equals(r"ba", (const Conster('b' "$s")).toString()); - Expect.equals(r"ba", (const Conster('b' '$s')).toString()); - Expect.equals(r"b$s", (const Conster('b' r'$s')).toString()); + Expect.equals( + r"ba", + (const Conster( + 'b' + "$s", + )).toString(), + ); + Expect.equals( + r"ba", + (const Conster( + 'b' + '$s', + )).toString(), + ); + Expect.equals( + r"b$s", + (const Conster( + 'b' + r'$s', + )).toString(), + ); - Expect.equals(r"b-a-", (const Conster('b' "-$s-")).toString()); - Expect.equals(r"b-a-", (const Conster('b' '-$s-')).toString()); - Expect.equals(r"b-$s-", (const Conster('b' r'-$s-')).toString()); + Expect.equals( + r"b-a-", + (const Conster( + 'b' + "-$s-", + )).toString(), + ); + Expect.equals( + r"b-a-", + (const Conster( + 'b' + '-$s-', + )).toString(), + ); + Expect.equals( + r"b-$s-", + (const Conster( + 'b' + r'-$s-', + )).toString(), + ); } testMultiline() { Expect.equals( - "abe", - (const Conster("a" - "b" - "e")) - .toString()); + "abe", + (const Conster( + "a" + "b" + "e", + )).toString(), + ); Expect.equals( - "a b e", - (const Conster("a " - "b " - "e")) - .toString()); + "a b e", + (const Conster( + "a " + "b " + "e", + )).toString(), + ); Expect.equals( - "a b e", - (const Conster("a" - " b" - " e")) - .toString()); + "a b e", + (const Conster( + "a" + " b" + " e", + )).toString(), + ); Expect.equals( - "abe", - (const Conster(""" + "abe", + (const Conster( + """ a""" - "b" - "e")) - .toString()); + "b" + "e", + )).toString(), + ); Expect.equals( - "a b e", - (const Conster(""" + "a b e", + (const Conster( + """ a""" - " b" - " e")) - .toString()); + " b" + " e", + )).toString(), + ); Expect.equals( - "abe", - (const Conster(""" + "abe", + (const Conster( + """ a""" - """ + """ b""" - """ -e""")) - .toString()); + """ +e""", + )).toString(), + ); }
diff --git a/tests/language/string/adjacent_string_literals_test.dart b/tests/language/string/adjacent_string_literals_test.dart index 48f8ba2..33ad9af 100644 --- a/tests/language/string/adjacent_string_literals_test.dart +++ b/tests/language/string/adjacent_string_literals_test.dart
@@ -11,90 +11,231 @@ } testEmpty() { - Expect.equals("", "" "" ""); - Expect.equals("", "" '' ""); - Expect.equals("", "" "" r""); + Expect.equals( + "", + "" + "" + "", + ); + Expect.equals( + "", + "" + '' + "", + ); + Expect.equals( + "", + "" + "" + r"", + ); - Expect.equals("a", "a" ""); - Expect.equals("a", "a" ''); - Expect.equals("a", "a" r''); + Expect.equals( + "a", + "a" + "", + ); + Expect.equals( + "a", + "a" + '', + ); + Expect.equals( + "a", + "a" + r'', + ); - Expect.equals("b", 'b' ""); - Expect.equals("b", 'b' ''); - Expect.equals("b", 'b' r''); + Expect.equals( + "b", + 'b' + "", + ); + Expect.equals( + "b", + 'b' + '', + ); + Expect.equals( + "b", + 'b' + r'', + ); - Expect.equals("c", r'c' ""); - Expect.equals("c", r'c' ''); - Expect.equals("c", r'c' r''); + Expect.equals( + "c", + r'c' + "", + ); + Expect.equals( + "c", + r'c' + '', + ); + Expect.equals( + "c", + r'c' + r'', + ); - Expect.equals("a", "" "a"); - Expect.equals("a", "" 'a'); - Expect.equals("a", "" r'a'); + Expect.equals( + "a", + "" + "a", + ); + Expect.equals( + "a", + "" + 'a', + ); + Expect.equals( + "a", + "" + r'a', + ); - Expect.equals("b", '' "b"); - Expect.equals("b", '' 'b'); - Expect.equals("b", '' r'b'); + Expect.equals( + "b", + '' + "b", + ); + Expect.equals( + "b", + '' + 'b', + ); + Expect.equals( + "b", + '' + r'b', + ); - Expect.equals("c", r'' "c"); - Expect.equals("c", r'' 'c'); - Expect.equals("c", r'' r'c'); + Expect.equals( + "c", + r'' + "c", + ); + Expect.equals( + "c", + r'' + 'c', + ); + Expect.equals( + "c", + r'' + r'c', + ); } testInterpolation() { var s = "a"; - Expect.equals(r"ab", "$s" "b"); - Expect.equals(r"ab", '$s' "b"); - Expect.equals(r"$sb", r'$s' "b"); + Expect.equals( + r"ab", + "$s" + "b", + ); + Expect.equals( + r"ab", + '$s' + "b", + ); + Expect.equals( + r"$sb", + r'$s' + "b", + ); - Expect.equals(r"-a-b", "-$s-" "b"); - Expect.equals(r"-a-b", '-$s-' "b"); - Expect.equals(r"-$s-b", r'-$s-' "b"); + Expect.equals( + r"-a-b", + "-$s-" + "b", + ); + Expect.equals( + r"-a-b", + '-$s-' + "b", + ); + Expect.equals( + r"-$s-b", + r'-$s-' + "b", + ); - Expect.equals(r"ba", 'b' "$s"); - Expect.equals(r"ba", 'b' '$s'); - Expect.equals(r"b$s", 'b' r'$s'); + Expect.equals( + r"ba", + 'b' + "$s", + ); + Expect.equals( + r"ba", + 'b' + '$s', + ); + Expect.equals( + r"b$s", + 'b' + r'$s', + ); - Expect.equals(r"b-a-", 'b' "-$s-"); - Expect.equals(r"b-a-", 'b' '-$s-'); - Expect.equals(r"b-$s-", 'b' r'-$s-'); + Expect.equals( + r"b-a-", + 'b' + "-$s-", + ); + Expect.equals( + r"b-a-", + 'b' + '-$s-', + ); + Expect.equals( + r"b-$s-", + 'b' + r'-$s-', + ); } testMultiline() { Expect.equals( - "abe", - "a" - "b" - "e"); + "abe", + "a" + "b" + "e", + ); Expect.equals( - "a b e", - "a " - "b " - "e"); + "a b e", + "a " + "b " + "e", + ); Expect.equals( - "a b e", - "a" - " b" - " e"); + "a b e", + "a" + " b" + " e", + ); Expect.equals( - "abe", - """ + "abe", + """ a""" - "b" - "e"); + "b" + "e", + ); Expect.equals( - "a b e", - """ + "a b e", + """ a""" - " b" - " e"); + " b" + " e", + ); Expect.equals( - "abe", - """ + "abe", + """ a""" - """ + """ b""" - """ -e"""); + """ +e""", + ); }
diff --git a/tests/language/string/bad_raw_string_runtime_test.dart b/tests/language/string/bad_raw_string_runtime_test.dart index 4046aa5..bf010f9 100644 --- a/tests/language/string/bad_raw_string_runtime_test.dart +++ b/tests/language/string/bad_raw_string_runtime_test.dart
@@ -7,20 +7,14 @@ main() { // Raw String may not contain newline (may not be multi-line). - String x = '' - - - - + String x = + '' // Test that a raw string containing just one character, a \n char, fails. // Enclose the test string in a bigger multiline string, except in case 03: - """ r' ' - """ - - ; + """; }
diff --git a/tests/language/string/bad_raw_string_test.dart b/tests/language/string/bad_raw_string_test.dart index 7091ebae..38ac076 100644 --- a/tests/language/string/bad_raw_string_test.dart +++ b/tests/language/string/bad_raw_string_test.dart
@@ -11,7 +11,7 @@ // ^ // [analyzer] SYNTACTIC_ERROR.UNTERMINATED_STRING_LITERAL ' -// [error line 13, column 1, length 1] +// [error column 1, length 1] // [analyzer] SYNTACTIC_ERROR.UNTERMINATED_STRING_LITERAL // [cfe] String starting with ' must end with '. r" @@ -20,7 +20,7 @@ // ^ // [analyzer] SYNTACTIC_ERROR.UNTERMINATED_STRING_LITERAL " -// [error line 22, column 1, length 1] +// [error column 1, length 1] // [analyzer] SYNTACTIC_ERROR.UNTERMINATED_STRING_LITERAL // [cfe] String starting with " must end with ". @@ -35,7 +35,7 @@ // ^ // [analyzer] SYNTACTIC_ERROR.UNTERMINATED_STRING_LITERAL ' -// [error line 37, column 1, length 1] +// [error column 1, length 1] // [analyzer] SYNTACTIC_ERROR.UNTERMINATED_STRING_LITERAL // [cfe] String starting with ' must end with '. '''
diff --git a/tests/language/string/const_interpolation2_test.dart b/tests/language/string/const_interpolation2_test.dart index 78912b7..ed6a468 100644 --- a/tests/language/string/const_interpolation2_test.dart +++ b/tests/language/string/const_interpolation2_test.dart
@@ -62,16 +62,18 @@ // (Single string, the linebreak to fit this into 80 chars is inside an // interpolation, which is allowed, even for single-line strings). const interpolation2 = - "${u1} ${u2} ${u3} ${u4} ${u5} ${u6} ${n1} ${n2} ${n3} ${n4} ${n5} ${n6} ${ - s1} ${s2} ${s3} ${s4} ${b1} ${b2} ${b3} ${b4}"; + "${u1} ${u2} ${u3} ${u4} ${u5} ${u6} ${n1} ${n2} ${n3} ${n4} ${n5} ${n6} ${s1} ${s2} ${s3} ${s4} ${b1} ${b2} ${b3} ${b4}"; // Adjacent string literals are combined. -const interpolation3 = "$u1 $u2 $u3 $u4 $u5 " +const interpolation3 = + "$u1 $u2 $u3 $u4 $u5 " '$u6 $n1 $n2 $n3 $n4 ' """$n5 $n6 $s1 $s2 $s3 """ '''$s4 $b1 $b2 $b3 $b4'''; // Nested interpolations. -const interpolation4 = "${"$u1 $u2 $u3 $u4 $u5 " '$u6 $n1 $n2 $n3 $n4'} ${ - """$n5 $n6 $s1 $s2 $s3 """ '''$s4 $b1 $b2 $b3 $b4'''}"; +const interpolation4 = + "${"$u1 $u2 $u3 $u4 $u5 " + '$u6 $n1 $n2 $n3 $n4'} ${"""$n5 $n6 $s1 $s2 $s3 """ + '''$s4 $b1 $b2 $b3 $b4'''}"; main() { Expect.equals(u1.toString(), su1); @@ -94,7 +96,8 @@ Expect.equals(b2.toString(), sb2); Expect.equals(b3.toString(), sb3); Expect.equals(b4.toString(), sb4); - var expect = "null null null null null null 42 3.1415 37 4.6692 2.71828 87 " + var expect = + "null null null null null null 42 3.1415 37 4.6692 2.71828 87 " "s1 s2 s1s2 s4 true false false true"; Expect.equals(expect, interpolation1); Expect.equals(expect, interpolation2);
diff --git a/tests/language/string/interpolate2_test.dart b/tests/language/string/interpolate2_test.dart index bb49ba5..fc70e2a 100644 --- a/tests/language/string/interpolate2_test.dart +++ b/tests/language/string/interpolate2_test.dart
@@ -9,7 +9,7 @@ static var F1; static void testMain() { - F1 = "1 + 5 = ${1+5}"; + F1 = "1 + 5 = ${1 + 5}"; Expect.equals("1 + 5 = 6", F1); @@ -23,17 +23,14 @@ Expect.equals("fib(5) = 8", s); i = 5; - s = "$i squared is ${((x) => x*x)(i)}"; + s = "$i squared is ${((x) => x * x)(i)}"; Expect.equals("5 squared is 25", s); Expect.equals("8", "${fib.length}"); // test single quote Expect.equals("8", '${fib.length}'); // test multi-line - Expect.equals( - "8", - '${fib. - length}'); + Expect.equals("8", '${fib.length}'); var map = {"red": 1, "green": 2, "blue": 3}; s = "green has value ${map["green"]}"; @@ -46,8 +43,13 @@ // test multiple levels of nesting, including changing quotes and // multiline string types - s = "a ${(){ return 'b ${(){ return """ -c""";}()}'; }()} d"; + s = + "a ${() { + return 'b ${() { + return """ +c"""; + }()}'; + }()} d"; Expect.equals("a b c d", s); } }
diff --git a/tests/language/string/interpolate_test.dart b/tests/language/string/interpolate_test.dart index 5c25f42..95eacdf 100644 --- a/tests/language/string/interpolate_test.dart +++ b/tests/language/string/interpolate_test.dart
@@ -17,9 +17,7 @@ } class ThingamaBob extends WhatchamaCallIt { - ThingamaBob(String s) - : name = s, - super(); + ThingamaBob(String s) : name = s, super(); String name; toString() => "Hansel"; } @@ -78,159 +76,173 @@ // ASCII. Expect.equals(latin * 3, "$latin$latin$latin"); Expect.equals( - latin * 64, - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin"); + latin * 64, + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin", + ); Expect.equals( - latin * 64, - "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${latin * 4}"); + latin * 64, + "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${latin * 4}", + ); // Non-ASCII. Expect.equals(nonLatin * 3, "$nonLatin$nonLatin$nonLatin"); Expect.equals( - nonLatin * 64, - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin"); + nonLatin * 64, + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin", + ); Expect.equals( - nonLatin * 64, - "${nonLatin * 4}${nonLatin * 4}" - "${nonLatin * 4}${nonLatin * 4}" - "${nonLatin * 4}${nonLatin * 4}" - "${nonLatin * 4}${nonLatin * 4}" - "${nonLatin * 4}${nonLatin * 4}" - "${nonLatin * 4}${nonLatin * 4}" - "${nonLatin * 4}${nonLatin * 4}" - "${nonLatin * 4}${nonLatin * 4}"); + nonLatin * 64, + "${nonLatin * 4}${nonLatin * 4}" + "${nonLatin * 4}${nonLatin * 4}" + "${nonLatin * 4}${nonLatin * 4}" + "${nonLatin * 4}${nonLatin * 4}" + "${nonLatin * 4}${nonLatin * 4}" + "${nonLatin * 4}${nonLatin * 4}" + "${nonLatin * 4}${nonLatin * 4}" + "${nonLatin * 4}${nonLatin * 4}", + ); // Mixed. Expect.equals(latin * 3 + nonLatin, "$latin$latin$latin$nonLatin"); Expect.equals(nonLatin + latin * 3, "$nonLatin$latin$latin$latin"); Expect.equals( - latin * 60 + nonLatin * 4, - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin" - "$nonLatin$nonLatin$nonLatin$nonLatin"); + latin * 60 + nonLatin * 4, + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin" + "$nonLatin$nonLatin$nonLatin$nonLatin", + ); Expect.equals( - nonLatin * 4 + latin * 60, - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin"); + nonLatin * 4 + latin * 60, + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin", + ); Expect.equals( - latin * 60 + nonLatin * 4, - "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${nonLatin * 4}"); + latin * 60 + nonLatin * 4, + "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${nonLatin * 4}", + ); Expect.equals( - nonLatin * 4 + latin * 60, - "${nonLatin * 4}${latin * 4}${latin * 4}${latin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${latin * 4}"); + nonLatin * 4 + latin * 60, + "${nonLatin * 4}${latin * 4}${latin * 4}${latin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${latin * 4}", + ); // With objects. Expect.equals(latin * 3, "$latin$oLatin$latin"); Expect.equals( - latin * 64, - "$latin$latin$latin$latin$latin$latin$latin$oLatin" - "$latin$latin$latin$latin$latin$latin$latin$oLatin" - "$latin$latin$latin$latin$latin$latin$latin$oLatin" - "$latin$latin$latin$latin$latin$latin$latin$oLatin" - "$latin$latin$latin$latin$latin$latin$latin$oLatin" - "$latin$latin$latin$latin$latin$latin$latin$oLatin" - "$latin$latin$latin$latin$latin$latin$latin$oLatin" - "$latin$latin$latin$latin$latin$latin$latin$oLatin"); + latin * 64, + "$latin$latin$latin$latin$latin$latin$latin$oLatin" + "$latin$latin$latin$latin$latin$latin$latin$oLatin" + "$latin$latin$latin$latin$latin$latin$latin$oLatin" + "$latin$latin$latin$latin$latin$latin$latin$oLatin" + "$latin$latin$latin$latin$latin$latin$latin$oLatin" + "$latin$latin$latin$latin$latin$latin$latin$oLatin" + "$latin$latin$latin$latin$latin$latin$latin$oLatin" + "$latin$latin$latin$latin$latin$latin$latin$oLatin", + ); Expect.equals( - latin * 64, - "${latin * 4}${latin * 4}${latin * 4}${oLatin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${oLatin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${oLatin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${oLatin * 4}"); + latin * 64, + "${latin * 4}${latin * 4}${latin * 4}${oLatin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${oLatin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${oLatin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${oLatin * 4}", + ); // Non-ASCII. Expect.equals(nonLatin * 3, "$nonLatin$oNonLatin$nonLatin"); Expect.equals( - nonLatin * 64, - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin"); + nonLatin * 64, + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin", + ); Expect.equals( - nonLatin * 64, - "${nonLatin * 4}${oNonLatin * 4}" - "${nonLatin * 4}${oNonLatin * 4}" - "${nonLatin * 4}${oNonLatin * 4}" - "${nonLatin * 4}${oNonLatin * 4}" - "${nonLatin * 4}${oNonLatin * 4}" - "${nonLatin * 4}${oNonLatin * 4}" - "${nonLatin * 4}${oNonLatin * 4}" - "${nonLatin * 4}${oNonLatin * 4}"); + nonLatin * 64, + "${nonLatin * 4}${oNonLatin * 4}" + "${nonLatin * 4}${oNonLatin * 4}" + "${nonLatin * 4}${oNonLatin * 4}" + "${nonLatin * 4}${oNonLatin * 4}" + "${nonLatin * 4}${oNonLatin * 4}" + "${nonLatin * 4}${oNonLatin * 4}" + "${nonLatin * 4}${oNonLatin * 4}" + "${nonLatin * 4}${oNonLatin * 4}", + ); // Mixed. Expect.equals(latin * 2 + nonLatin * 2, "$latin$oLatin$nonLatin$oNonLatin"); Expect.equals(nonLatin * 2 + latin * 2, "$nonLatin$oNonLatin$latin$oLatin"); Expect.equals( - (latin * 2 + nonLatin * 2) * 8, - "$latin$oLatin$nonLatin$oNonLatin" - "$latin$oLatin$nonLatin$oNonLatin" - "$latin$oLatin$nonLatin$oNonLatin" - "$latin$oLatin$nonLatin$oNonLatin" - "$latin$oLatin$nonLatin$oNonLatin" - "$latin$oLatin$nonLatin$oNonLatin" - "$latin$oLatin$nonLatin$oNonLatin" - "$latin$oLatin$nonLatin$oNonLatin"); + (latin * 2 + nonLatin * 2) * 8, + "$latin$oLatin$nonLatin$oNonLatin" + "$latin$oLatin$nonLatin$oNonLatin" + "$latin$oLatin$nonLatin$oNonLatin" + "$latin$oLatin$nonLatin$oNonLatin" + "$latin$oLatin$nonLatin$oNonLatin" + "$latin$oLatin$nonLatin$oNonLatin" + "$latin$oLatin$nonLatin$oNonLatin" + "$latin$oLatin$nonLatin$oNonLatin", + ); Expect.equals( - (nonLatin * 2 + latin * 2) * 8, - "$nonLatin$oNonLatin$latin$oLatin" - "$nonLatin$oNonLatin$latin$oLatin" - "$nonLatin$oNonLatin$latin$oLatin" - "$nonLatin$oNonLatin$latin$oLatin" - "$nonLatin$oNonLatin$latin$oLatin" - "$nonLatin$oNonLatin$latin$oLatin" - "$nonLatin$oNonLatin$latin$oLatin" - "$nonLatin$oNonLatin$latin$oLatin"); + (nonLatin * 2 + latin * 2) * 8, + "$nonLatin$oNonLatin$latin$oLatin" + "$nonLatin$oNonLatin$latin$oLatin" + "$nonLatin$oNonLatin$latin$oLatin" + "$nonLatin$oNonLatin$latin$oLatin" + "$nonLatin$oNonLatin$latin$oLatin" + "$nonLatin$oNonLatin$latin$oLatin" + "$nonLatin$oNonLatin$latin$oLatin" + "$nonLatin$oNonLatin$latin$oLatin", + ); // All combinations var o1 = new Stringable("x");
diff --git a/tests/language/string/interpolation1_runtime_test.dart b/tests/language/string/interpolation1_runtime_test.dart index 3ede1d8..ad3ce231e 100644 --- a/tests/language/string/interpolation1_runtime_test.dart +++ b/tests/language/string/interpolation1_runtime_test.dart
@@ -15,9 +15,7 @@ class StringInterpolation1NegativeTest { // Dollar not followed by "{" or identifier. - static testMain() { - - } + static testMain() {} } main() {
diff --git a/tests/language/string/interpolation2_runtime_test.dart b/tests/language/string/interpolation2_runtime_test.dart index 0b0a89f3..01d0c64 100644 --- a/tests/language/string/interpolation2_runtime_test.dart +++ b/tests/language/string/interpolation2_runtime_test.dart
@@ -10,7 +10,6 @@ class StringInterpolation2NegativeTest { static testMain() { // Dollar followed by "/". - } }
diff --git a/tests/language/string/interpolation3_runtime_test.dart b/tests/language/string/interpolation3_runtime_test.dart index 96b92fb..871f771 100644 --- a/tests/language/string/interpolation3_runtime_test.dart +++ b/tests/language/string/interpolation3_runtime_test.dart
@@ -10,7 +10,6 @@ class StringInterpolation3NegativeTest { static testMain() { // Dollar followed by a number. - } }
diff --git a/tests/language/string/interpolation4_runtime_test.dart b/tests/language/string/interpolation4_runtime_test.dart index e89625c..98cd425 100644 --- a/tests/language/string/interpolation4_runtime_test.dart +++ b/tests/language/string/interpolation4_runtime_test.dart
@@ -10,7 +10,6 @@ class StringInterpolation4NegativeTest { static testMain() { // Dollar not followed by "{" or identifier. - } }
diff --git a/tests/language/string/interpolation5_runtime_test.dart b/tests/language/string/interpolation5_runtime_test.dart index acbec21..faee250 100644 --- a/tests/language/string/interpolation5_runtime_test.dart +++ b/tests/language/string/interpolation5_runtime_test.dart
@@ -10,7 +10,6 @@ class StringInterpolation5NegativeTest { static testMain() { // Dollar followed by a number. - } }
diff --git a/tests/language/string/interpolation9_runtime_test.dart b/tests/language/string/interpolation9_runtime_test.dart index 3cf2bd1..1391790 100644 --- a/tests/language/string/interpolation9_runtime_test.dart +++ b/tests/language/string/interpolation9_runtime_test.dart
@@ -10,29 +10,5 @@ main() { var x; - - - - - - - - - - - - - - - - - - - - - - - - return x; }
diff --git a/tests/language/string/interpolation_and_buffer_test.dart b/tests/language/string/interpolation_and_buffer_test.dart index 7086276..c9afd2e 100644 --- a/tests/language/string/interpolation_and_buffer_test.dart +++ b/tests/language/string/interpolation_and_buffer_test.dart
@@ -47,13 +47,23 @@ // Throws immediately when adding object that doesn't return a String. Expect.equals( - (StringBuffer()..write(s)..write(s)).toString(), "StringString"); + (StringBuffer() + ..write(s) + ..write(s)) + .toString(), + "StringString", + ); Expect.throws<String>( - () => StringBuffer()..write(t)..write(throw "unreachable"), - (e) => e == "Throw"); + () => StringBuffer() + ..write(t) + ..write(throw "unreachable"), + (e) => e == "Throw", + ); // Same behavior for constructor argument as if adding it to buffer later. Expect.equals((StringBuffer(s)..write(s)).toString(), "StringString"); Expect.throws<String>( - () => StringBuffer(t)..write(throw "unreachable"), (e) => e == "Throw"); + () => StringBuffer(t)..write(throw "unreachable"), + (e) => e == "Throw", + ); }
diff --git a/tests/language/string/interpolation_newline_test.dart b/tests/language/string/interpolation_newline_test.dart index 91ad04f..e13e276 100644 --- a/tests/language/string/interpolation_newline_test.dart +++ b/tests/language/string/interpolation_newline_test.dart
@@ -6,13 +6,24 @@ main() { String expected = '[[{{}: {}}]]'; - String a = "${ [ "${ [ '${ { '${ { } }' : { } } }' ] }" ] }"; - String b = "${ [ "${ [ '${ { '${ - { } }' : { } } }' ] }" ] }"; - String c = "${ [ "${ [ '${ { '${ - { - } }' : { - } } }' ] }" ] }"; + String a = + "${[ + "${[ + '${{'${{}}': {}}}', + ]}", + ]}"; + String b = + "${[ + "${[ + '${{'${{}}': {}}}', + ]}", + ]}"; + String c = + "${[ + "${[ + '${{'${{}}': {}}}', + ]}", + ]}"; if (expected != a) throw 'expecteda: $expected != $a'; if (a != b) throw 'ab: $a != $b'; if (b != c) throw 'bc: $b != $c';
diff --git a/tests/language/string/interpolation_runtime_test.dart b/tests/language/string/interpolation_runtime_test.dart index 90623b8e..e8753ef 100644 --- a/tests/language/string/interpolation_runtime_test.dart +++ b/tests/language/string/interpolation_runtime_test.dart
@@ -60,9 +60,7 @@ Expect.equals("2", "escaped \${3+2}"[16]); Expect.equals("}", "escaped \${3+2}"[17]); - if (alwaysFalse) { - - } + if (alwaysFalse) {} Expect.equals("${m}", "$m"); }
diff --git a/tests/language/string/literals_test.dart b/tests/language/string/literals_test.dart index 6b4f4f5..b3c13ae 100644 --- a/tests/language/string/literals_test.dart +++ b/tests/language/string/literals_test.dart
@@ -5,8 +5,18 @@ import "package:expect/expect.dart"; main() { - var expect = new String.fromCharCodes( - [0, 0x0a, 0x0d, 0x7f, 0xff, 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff]); + var expect = new String.fromCharCodes([ + 0, + 0x0a, + 0x0d, + 0x7f, + 0xff, + 0xffff, + 0xd800, + 0xdc00, + 0xdbff, + 0xdfff, + ]); test(string) { Expect.equals(expect, string); } @@ -27,12 +37,12 @@ test('''\x00 \x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff'''); // Extract code points from multi-character escape string. - test("\x00\x0a\x0d\x7f\xff\uffff" - "${"\u{10000}"[0]}${"\u{10000}"[1]}" - "${"\u{10FFFF}"[0]}${"\u{10FFFF}"[1]}"); + test( + "\x00\x0a\x0d\x7f\xff\uffff" + "${"\u{10000}"[0]}${"\u{10000}"[1]}" + "${"\u{10FFFF}"[0]}${"\u{10FFFF}"[1]}", + ); test("\x00\x0a\x0d\x7f\xff\uffff" + "\ud800" + "\udc00\udbff" + "\udfff"); // Single line string over multiple lines with newlines inside interpolation. - test("\x00\x0a\x0d\x7f\xff${ - "" - }\uffff\ud800\udc00\udbff\udfff"); + test("\x00\x0a\x0d\x7f\xff${""}\uffff\ud800\udc00\udbff\udfff"); }
diff --git a/tests/language/string/multiline_newline_crlf.dart b/tests/language/string/multiline_newline_crlf.dart index 958a82c..bde9ea2 100644 --- a/tests/language/string/multiline_newline_crlf.dart +++ b/tests/language/string/multiline_newline_crlf.dart
@@ -25,4 +25,4 @@ var nonConstantRawMultilineString = r""" \a \b -"""; \ No newline at end of file +""";
diff --git a/tests/language/string/multiline_newline_runtime_1_test.dart b/tests/language/string/multiline_newline_runtime_1_test.dart index 0b4647a..f6999cc 100644 --- a/tests/language/string/multiline_newline_runtime_1_test.dart +++ b/tests/language/string/multiline_newline_runtime_1_test.dart
@@ -40,18 +40,27 @@ Expect.equals(lf.nonConstantMultilineString, cr.nonConstantMultilineString); Expect.equals( - cr.nonConstantRawMultilineString, crlf.nonConstantRawMultilineString); + cr.nonConstantRawMultilineString, + crlf.nonConstantRawMultilineString, + ); Expect.equals( - crlf.nonConstantRawMultilineString, lf.nonConstantRawMultilineString); + crlf.nonConstantRawMultilineString, + lf.nonConstantRawMultilineString, + ); Expect.equals( - lf.nonConstantRawMultilineString, cr.nonConstantRawMultilineString); + lf.nonConstantRawMultilineString, + cr.nonConstantRawMultilineString, + ); - const c1 = - cr.constantMultilineString == crlf.constantMultilineString ? true : null; - const c2 = - crlf.constantMultilineString == lf.constantMultilineString ? true : null; - const c3 = - lf.constantMultilineString == cr.constantMultilineString ? true : null; + const c1 = cr.constantMultilineString == crlf.constantMultilineString + ? true + : null; + const c2 = crlf.constantMultilineString == lf.constantMultilineString + ? true + : null; + const c3 = lf.constantMultilineString == cr.constantMultilineString + ? true + : null; Expect.isTrue(c1); Expect.isTrue(c2); Expect.isTrue(c3); @@ -72,27 +81,15 @@ const c4 = c1 == true ? 1 : 2; Expect.equals(1, c4); - - - - - - - - - - - - - - - - const c7 = - cr.constantMultilineString != crlf.constantMultilineString ? true : null; - const c8 = - crlf.constantMultilineString != lf.constantMultilineString ? true : null; - const c9 = - lf.constantMultilineString != cr.constantMultilineString ? true : null; + const c7 = cr.constantMultilineString != crlf.constantMultilineString + ? true + : null; + const c8 = crlf.constantMultilineString != lf.constantMultilineString + ? true + : null; + const c9 = lf.constantMultilineString != cr.constantMultilineString + ? true + : null; Expect.isNull(c7); Expect.isNull(c8); Expect.isNull(c9); @@ -118,11 +115,4 @@ // constants is similar to the runtime evaluation tested above. For tools // like the analyzer, this ensures that evaluation is tested (there's no // runtime evaluation). - - - - - - - }
diff --git a/tests/language/string/multiline_newline_runtime_2_test.dart b/tests/language/string/multiline_newline_runtime_2_test.dart index 984ee09..5f83bed 100644 --- a/tests/language/string/multiline_newline_runtime_2_test.dart +++ b/tests/language/string/multiline_newline_runtime_2_test.dart
@@ -40,18 +40,27 @@ Expect.equals(lf.nonConstantMultilineString, cr.nonConstantMultilineString); Expect.equals( - cr.nonConstantRawMultilineString, crlf.nonConstantRawMultilineString); + cr.nonConstantRawMultilineString, + crlf.nonConstantRawMultilineString, + ); Expect.equals( - crlf.nonConstantRawMultilineString, lf.nonConstantRawMultilineString); + crlf.nonConstantRawMultilineString, + lf.nonConstantRawMultilineString, + ); Expect.equals( - lf.nonConstantRawMultilineString, cr.nonConstantRawMultilineString); + lf.nonConstantRawMultilineString, + cr.nonConstantRawMultilineString, + ); - const c1 = - cr.constantMultilineString == crlf.constantMultilineString ? true : null; - const c2 = - crlf.constantMultilineString == lf.constantMultilineString ? true : null; - const c3 = - lf.constantMultilineString == cr.constantMultilineString ? true : null; + const c1 = cr.constantMultilineString == crlf.constantMultilineString + ? true + : null; + const c2 = crlf.constantMultilineString == lf.constantMultilineString + ? true + : null; + const c3 = lf.constantMultilineString == cr.constantMultilineString + ? true + : null; Expect.isTrue(c1); Expect.isTrue(c2); Expect.isTrue(c3); @@ -69,30 +78,18 @@ Expect.isTrue(c2r); Expect.isTrue(c3r); - - - const c5 = c2 == true ? 2 : 3; Expect.equals(2, c5); - - - - - - - - - - - - - const c7 = - cr.constantMultilineString != crlf.constantMultilineString ? true : null; - const c8 = - crlf.constantMultilineString != lf.constantMultilineString ? true : null; - const c9 = - lf.constantMultilineString != cr.constantMultilineString ? true : null; + const c7 = cr.constantMultilineString != crlf.constantMultilineString + ? true + : null; + const c8 = crlf.constantMultilineString != lf.constantMultilineString + ? true + : null; + const c9 = lf.constantMultilineString != cr.constantMultilineString + ? true + : null; Expect.isNull(c7); Expect.isNull(c8); Expect.isNull(c9); @@ -118,11 +115,4 @@ // constants is similar to the runtime evaluation tested above. For tools // like the analyzer, this ensures that evaluation is tested (there's no // runtime evaluation). - - - - - - - }
diff --git a/tests/language/string/multiline_newline_runtime_3_test.dart b/tests/language/string/multiline_newline_runtime_3_test.dart index 8208eeae7..6608232 100644 --- a/tests/language/string/multiline_newline_runtime_3_test.dart +++ b/tests/language/string/multiline_newline_runtime_3_test.dart
@@ -40,18 +40,27 @@ Expect.equals(lf.nonConstantMultilineString, cr.nonConstantMultilineString); Expect.equals( - cr.nonConstantRawMultilineString, crlf.nonConstantRawMultilineString); + cr.nonConstantRawMultilineString, + crlf.nonConstantRawMultilineString, + ); Expect.equals( - crlf.nonConstantRawMultilineString, lf.nonConstantRawMultilineString); + crlf.nonConstantRawMultilineString, + lf.nonConstantRawMultilineString, + ); Expect.equals( - lf.nonConstantRawMultilineString, cr.nonConstantRawMultilineString); + lf.nonConstantRawMultilineString, + cr.nonConstantRawMultilineString, + ); - const c1 = - cr.constantMultilineString == crlf.constantMultilineString ? true : null; - const c2 = - crlf.constantMultilineString == lf.constantMultilineString ? true : null; - const c3 = - lf.constantMultilineString == cr.constantMultilineString ? true : null; + const c1 = cr.constantMultilineString == crlf.constantMultilineString + ? true + : null; + const c2 = crlf.constantMultilineString == lf.constantMultilineString + ? true + : null; + const c3 = lf.constantMultilineString == cr.constantMultilineString + ? true + : null; Expect.isTrue(c1); Expect.isTrue(c2); Expect.isTrue(c3); @@ -69,30 +78,18 @@ Expect.isTrue(c2r); Expect.isTrue(c3r); - - - - - - const c6 = c3 == true ? 3 : 4; Expect.equals(3, c6); - - - - - - - - - - const c7 = - cr.constantMultilineString != crlf.constantMultilineString ? true : null; - const c8 = - crlf.constantMultilineString != lf.constantMultilineString ? true : null; - const c9 = - lf.constantMultilineString != cr.constantMultilineString ? true : null; + const c7 = cr.constantMultilineString != crlf.constantMultilineString + ? true + : null; + const c8 = crlf.constantMultilineString != lf.constantMultilineString + ? true + : null; + const c9 = lf.constantMultilineString != cr.constantMultilineString + ? true + : null; Expect.isNull(c7); Expect.isNull(c8); Expect.isNull(c9); @@ -118,11 +115,4 @@ // constants is similar to the runtime evaluation tested above. For tools // like the analyzer, this ensures that evaluation is tested (there's no // runtime evaluation). - - - - - - - }
diff --git a/tests/language/string/multiline_newline_runtime_4_test.dart b/tests/language/string/multiline_newline_runtime_4_test.dart index caef817..2d5efb0 100644 --- a/tests/language/string/multiline_newline_runtime_4_test.dart +++ b/tests/language/string/multiline_newline_runtime_4_test.dart
@@ -40,18 +40,27 @@ Expect.equals(lf.nonConstantMultilineString, cr.nonConstantMultilineString); Expect.equals( - cr.nonConstantRawMultilineString, crlf.nonConstantRawMultilineString); + cr.nonConstantRawMultilineString, + crlf.nonConstantRawMultilineString, + ); Expect.equals( - crlf.nonConstantRawMultilineString, lf.nonConstantRawMultilineString); + crlf.nonConstantRawMultilineString, + lf.nonConstantRawMultilineString, + ); Expect.equals( - lf.nonConstantRawMultilineString, cr.nonConstantRawMultilineString); + lf.nonConstantRawMultilineString, + cr.nonConstantRawMultilineString, + ); - const c1 = - cr.constantMultilineString == crlf.constantMultilineString ? true : null; - const c2 = - crlf.constantMultilineString == lf.constantMultilineString ? true : null; - const c3 = - lf.constantMultilineString == cr.constantMultilineString ? true : null; + const c1 = cr.constantMultilineString == crlf.constantMultilineString + ? true + : null; + const c2 = crlf.constantMultilineString == lf.constantMultilineString + ? true + : null; + const c3 = lf.constantMultilineString == cr.constantMultilineString + ? true + : null; Expect.isTrue(c1); Expect.isTrue(c2); Expect.isTrue(c3); @@ -69,30 +78,18 @@ Expect.isTrue(c2r); Expect.isTrue(c3r); - - - - - - - - - const c4r = c1r == true ? 1 : 2; Expect.equals(1, c4r); - - - - - - - const c7 = - cr.constantMultilineString != crlf.constantMultilineString ? true : null; - const c8 = - crlf.constantMultilineString != lf.constantMultilineString ? true : null; - const c9 = - lf.constantMultilineString != cr.constantMultilineString ? true : null; + const c7 = cr.constantMultilineString != crlf.constantMultilineString + ? true + : null; + const c8 = crlf.constantMultilineString != lf.constantMultilineString + ? true + : null; + const c9 = lf.constantMultilineString != cr.constantMultilineString + ? true + : null; Expect.isNull(c7); Expect.isNull(c8); Expect.isNull(c9); @@ -118,11 +115,4 @@ // constants is similar to the runtime evaluation tested above. For tools // like the analyzer, this ensures that evaluation is tested (there's no // runtime evaluation). - - - - - - - }
diff --git a/tests/language/string/multiline_newline_runtime_5_test.dart b/tests/language/string/multiline_newline_runtime_5_test.dart index 6510e9c..830f7a8 100644 --- a/tests/language/string/multiline_newline_runtime_5_test.dart +++ b/tests/language/string/multiline_newline_runtime_5_test.dart
@@ -40,18 +40,27 @@ Expect.equals(lf.nonConstantMultilineString, cr.nonConstantMultilineString); Expect.equals( - cr.nonConstantRawMultilineString, crlf.nonConstantRawMultilineString); + cr.nonConstantRawMultilineString, + crlf.nonConstantRawMultilineString, + ); Expect.equals( - crlf.nonConstantRawMultilineString, lf.nonConstantRawMultilineString); + crlf.nonConstantRawMultilineString, + lf.nonConstantRawMultilineString, + ); Expect.equals( - lf.nonConstantRawMultilineString, cr.nonConstantRawMultilineString); + lf.nonConstantRawMultilineString, + cr.nonConstantRawMultilineString, + ); - const c1 = - cr.constantMultilineString == crlf.constantMultilineString ? true : null; - const c2 = - crlf.constantMultilineString == lf.constantMultilineString ? true : null; - const c3 = - lf.constantMultilineString == cr.constantMultilineString ? true : null; + const c1 = cr.constantMultilineString == crlf.constantMultilineString + ? true + : null; + const c2 = crlf.constantMultilineString == lf.constantMultilineString + ? true + : null; + const c3 = lf.constantMultilineString == cr.constantMultilineString + ? true + : null; Expect.isTrue(c1); Expect.isTrue(c2); Expect.isTrue(c3); @@ -69,30 +78,18 @@ Expect.isTrue(c2r); Expect.isTrue(c3r); - - - - - - - - - - - - const c5r = c2r == true ? 2 : 3; Expect.equals(2, c5r); - - - - const c7 = - cr.constantMultilineString != crlf.constantMultilineString ? true : null; - const c8 = - crlf.constantMultilineString != lf.constantMultilineString ? true : null; - const c9 = - lf.constantMultilineString != cr.constantMultilineString ? true : null; + const c7 = cr.constantMultilineString != crlf.constantMultilineString + ? true + : null; + const c8 = crlf.constantMultilineString != lf.constantMultilineString + ? true + : null; + const c9 = lf.constantMultilineString != cr.constantMultilineString + ? true + : null; Expect.isNull(c7); Expect.isNull(c8); Expect.isNull(c9); @@ -118,11 +115,4 @@ // constants is similar to the runtime evaluation tested above. For tools // like the analyzer, this ensures that evaluation is tested (there's no // runtime evaluation). - - - - - - - }
diff --git a/tests/language/string/multiline_newline_runtime_6_test.dart b/tests/language/string/multiline_newline_runtime_6_test.dart index 353fb28..5d4fa1e 100644 --- a/tests/language/string/multiline_newline_runtime_6_test.dart +++ b/tests/language/string/multiline_newline_runtime_6_test.dart
@@ -40,18 +40,27 @@ Expect.equals(lf.nonConstantMultilineString, cr.nonConstantMultilineString); Expect.equals( - cr.nonConstantRawMultilineString, crlf.nonConstantRawMultilineString); + cr.nonConstantRawMultilineString, + crlf.nonConstantRawMultilineString, + ); Expect.equals( - crlf.nonConstantRawMultilineString, lf.nonConstantRawMultilineString); + crlf.nonConstantRawMultilineString, + lf.nonConstantRawMultilineString, + ); Expect.equals( - lf.nonConstantRawMultilineString, cr.nonConstantRawMultilineString); + lf.nonConstantRawMultilineString, + cr.nonConstantRawMultilineString, + ); - const c1 = - cr.constantMultilineString == crlf.constantMultilineString ? true : null; - const c2 = - crlf.constantMultilineString == lf.constantMultilineString ? true : null; - const c3 = - lf.constantMultilineString == cr.constantMultilineString ? true : null; + const c1 = cr.constantMultilineString == crlf.constantMultilineString + ? true + : null; + const c2 = crlf.constantMultilineString == lf.constantMultilineString + ? true + : null; + const c3 = lf.constantMultilineString == cr.constantMultilineString + ? true + : null; Expect.isTrue(c1); Expect.isTrue(c2); Expect.isTrue(c3); @@ -69,30 +78,18 @@ Expect.isTrue(c2r); Expect.isTrue(c3r); - - - - - - - - - - - - - - - const c6r = c3r == true ? 3 : 4; Expect.equals(3, c6r); - const c7 = - cr.constantMultilineString != crlf.constantMultilineString ? true : null; - const c8 = - crlf.constantMultilineString != lf.constantMultilineString ? true : null; - const c9 = - lf.constantMultilineString != cr.constantMultilineString ? true : null; + const c7 = cr.constantMultilineString != crlf.constantMultilineString + ? true + : null; + const c8 = crlf.constantMultilineString != lf.constantMultilineString + ? true + : null; + const c9 = lf.constantMultilineString != cr.constantMultilineString + ? true + : null; Expect.isNull(c7); Expect.isNull(c8); Expect.isNull(c9); @@ -118,11 +115,4 @@ // constants is similar to the runtime evaluation tested above. For tools // like the analyzer, this ensures that evaluation is tested (there's no // runtime evaluation). - - - - - - - }
diff --git a/tests/language/string/multiline_newline_runtime_test.dart b/tests/language/string/multiline_newline_runtime_test.dart index 7fa95ca..1c9c80f 100644 --- a/tests/language/string/multiline_newline_runtime_test.dart +++ b/tests/language/string/multiline_newline_runtime_test.dart
@@ -40,18 +40,27 @@ Expect.equals(lf.nonConstantMultilineString, cr.nonConstantMultilineString); Expect.equals( - cr.nonConstantRawMultilineString, crlf.nonConstantRawMultilineString); + cr.nonConstantRawMultilineString, + crlf.nonConstantRawMultilineString, + ); Expect.equals( - crlf.nonConstantRawMultilineString, lf.nonConstantRawMultilineString); + crlf.nonConstantRawMultilineString, + lf.nonConstantRawMultilineString, + ); Expect.equals( - lf.nonConstantRawMultilineString, cr.nonConstantRawMultilineString); + lf.nonConstantRawMultilineString, + cr.nonConstantRawMultilineString, + ); - const c1 = - cr.constantMultilineString == crlf.constantMultilineString ? true : null; - const c2 = - crlf.constantMultilineString == lf.constantMultilineString ? true : null; - const c3 = - lf.constantMultilineString == cr.constantMultilineString ? true : null; + const c1 = cr.constantMultilineString == crlf.constantMultilineString + ? true + : null; + const c2 = crlf.constantMultilineString == lf.constantMultilineString + ? true + : null; + const c3 = lf.constantMultilineString == cr.constantMultilineString + ? true + : null; Expect.isTrue(c1); Expect.isTrue(c2); Expect.isTrue(c3); @@ -69,30 +78,15 @@ Expect.isTrue(c2r); Expect.isTrue(c3r); - - - - - - - - - - - - - - - - - - - const c7 = - cr.constantMultilineString != crlf.constantMultilineString ? true : null; - const c8 = - crlf.constantMultilineString != lf.constantMultilineString ? true : null; - const c9 = - lf.constantMultilineString != cr.constantMultilineString ? true : null; + const c7 = cr.constantMultilineString != crlf.constantMultilineString + ? true + : null; + const c8 = crlf.constantMultilineString != lf.constantMultilineString + ? true + : null; + const c9 = lf.constantMultilineString != cr.constantMultilineString + ? true + : null; Expect.isNull(c7); Expect.isNull(c8); Expect.isNull(c9); @@ -118,11 +112,4 @@ // constants is similar to the runtime evaluation tested above. For tools // like the analyzer, this ensures that evaluation is tested (there's no // runtime evaluation). - - - - - - - }
diff --git a/tests/language/string/multiline_newline_test.dart b/tests/language/string/multiline_newline_test.dart index cafa05e..91df275 100644 --- a/tests/language/string/multiline_newline_test.dart +++ b/tests/language/string/multiline_newline_test.dart
@@ -37,18 +37,27 @@ Expect.equals(lf.nonConstantMultilineString, cr.nonConstantMultilineString); Expect.equals( - cr.nonConstantRawMultilineString, crlf.nonConstantRawMultilineString); + cr.nonConstantRawMultilineString, + crlf.nonConstantRawMultilineString, + ); Expect.equals( - crlf.nonConstantRawMultilineString, lf.nonConstantRawMultilineString); + crlf.nonConstantRawMultilineString, + lf.nonConstantRawMultilineString, + ); Expect.equals( - lf.nonConstantRawMultilineString, cr.nonConstantRawMultilineString); + lf.nonConstantRawMultilineString, + cr.nonConstantRawMultilineString, + ); - const c1 = - cr.constantMultilineString == crlf.constantMultilineString ? true : null; - const c2 = - crlf.constantMultilineString == lf.constantMultilineString ? true : null; - const c3 = - lf.constantMultilineString == cr.constantMultilineString ? true : null; + const c1 = cr.constantMultilineString == crlf.constantMultilineString + ? true + : null; + const c2 = crlf.constantMultilineString == lf.constantMultilineString + ? true + : null; + const c3 = lf.constantMultilineString == cr.constantMultilineString + ? true + : null; Expect.isTrue(c1); Expect.isTrue(c2); Expect.isTrue(c3); @@ -102,12 +111,15 @@ // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. Expect.equals(3, c6r); - const c7 = - cr.constantMultilineString != crlf.constantMultilineString ? true : null; - const c8 = - crlf.constantMultilineString != lf.constantMultilineString ? true : null; - const c9 = - lf.constantMultilineString != cr.constantMultilineString ? true : null; + const c7 = cr.constantMultilineString != crlf.constantMultilineString + ? true + : null; + const c8 = crlf.constantMultilineString != lf.constantMultilineString + ? true + : null; + const c9 = lf.constantMultilineString != cr.constantMultilineString + ? true + : null; Expect.isNull(c7); Expect.isNull(c8); Expect.isNull(c9); @@ -136,38 +148,32 @@ const c10 = c7 ? 1 : 2; // ^^ // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_TYPE_BOOL - // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. - // ^^ // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. const c11 = c8 ? 2 : 3; // ^^ // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_TYPE_BOOL - // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. - // ^^ // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. const c12 = c9 ? 3 : 4; // ^^ // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_TYPE_BOOL - // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. - // ^^ // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. const c10r = c7r ? 1 : 2; // ^^^ // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_TYPE_BOOL - // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. - // ^^^ // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. const c11r = c8r ? 2 : 3; // ^^^ // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_TYPE_BOOL - // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. - // ^^^ // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. const c12r = c9r ? 3 : 4; // ^^^ // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_TYPE_BOOL - // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. - // ^^^ // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. }
diff --git a/tests/language/string/multiline_strings_test.dart b/tests/language/string/multiline_strings_test.dart index fa96fb1..8795014 100644 --- a/tests/language/string/multiline_strings_test.dart +++ b/tests/language/string/multiline_strings_test.dart
@@ -7,64 +7,40 @@ import "package:expect/expect.dart"; main() { - Expect.equals( - 'foo', - ''' + Expect.equals('foo', ''' foo'''); - Expect.equals( - '\\\nfoo', - '''\\ + Expect.equals('\\\nfoo', '''\\ foo'''); - Expect.equals( - '\t\nfoo', - '''\t + Expect.equals('\t\nfoo', '''\t foo'''); - Expect.equals( - 'foo', - '''\ + Expect.equals('foo', '''\ foo'''); - Expect.equals( - 'foo', - '''\ \ + Expect.equals('foo', '''\ \ foo'''); - Expect.equals( - ' \nfoo', - '''\x20 + Expect.equals(' \nfoo', '''\x20 foo'''); String x = ' '; - Expect.equals( - ' \nfoo', - '''$x + Expect.equals(' \nfoo', '''$x foo'''); - Expect.equals( - 'foo', - r''' + Expect.equals('foo', r''' foo'''); - Expect.equals( - '\\\\\nfoo', - r'''\\ + Expect.equals('\\\\\nfoo', r'''\\ foo'''); - Expect.equals( - '\\t\nfoo', - r'''\t + Expect.equals('\\t\nfoo', r'''\t foo'''); - Expect.equals( - 'foo', - r'''\ + Expect.equals('foo', r'''\ foo'''); - Expect.equals( - 'foo', - r'''\ \ + Expect.equals('foo', r'''\ \ foo'''); }
diff --git a/tests/language/string/no_operator_runtime_test.dart b/tests/language/string/no_operator_runtime_test.dart index ebf1dc7..39c214b 100644 --- a/tests/language/string/no_operator_runtime_test.dart +++ b/tests/language/string/no_operator_runtime_test.dart
@@ -10,20 +10,4 @@ main() { var x = "x"; var y = "y"; - - - - - - - - - - - - - - - - }
diff --git a/tests/language/string/raw_string_test.dart b/tests/language/string/raw_string_test.dart index 358f882..f509678 100644 --- a/tests/language/string/raw_string_test.dart +++ b/tests/language/string/raw_string_test.dart
@@ -15,23 +15,15 @@ Expect.equals("", r''''''); Expect.equals("''''", r"''''"); Expect.equals('""""', r'""""'); - Expect.equals( - "1\n2\n3", - r"""1 + Expect.equals("1\n2\n3", r"""1 2 3"""); - Expect.equals( - "1\n2\n3", - r'''1 + Expect.equals("1\n2\n3", r'''1 2 3'''); - Expect.equals( - "1", - r""" + Expect.equals("1", r""" 1"""); - Expect.equals( - "1", - r''' + Expect.equals("1", r''' 1'''); Expect.equals("'", r"'"); Expect.equals('"', r'"'); @@ -41,10 +33,14 @@ Expect.equals("\\", r"\"); Expect.equals("\\", r'\'); Expect.equals("\${12}", r"${12}"); - Expect.equals("\\a\\b\\c\\d\\e\\f\\g\\h\\i\\j\\k\\l\\m", - r"\a\b\c\d\e\f\g\h\i\j\k\l\m"); - Expect.equals("\\n\\o\\p\\q\\r\\s\\t\\u\\v\\w\\x\\y\\z", - r"\n\o\p\q\r\s\t\u\v\w\x\y\z"); + Expect.equals( + "\\a\\b\\c\\d\\e\\f\\g\\h\\i\\j\\k\\l\\m", + r"\a\b\c\d\e\f\g\h\i\j\k\l\m", + ); + Expect.equals( + "\\n\\o\\p\\q\\r\\s\\t\\u\\v\\w\\x\\y\\z", + r"\n\o\p\q\r\s\t\u\v\w\x\y\z", + ); } }
diff --git a/tests/language/string/runtime_test.dart b/tests/language/string/runtime_test.dart index 41a0d8e..5492354 100644 --- a/tests/language/string/runtime_test.dart +++ b/tests/language/string/runtime_test.dart
@@ -32,7 +32,6 @@ static testNoSuchMethod() { String a = "Hello"; - } static testCharCodes() {
diff --git a/tests/language/string/string_test.dart b/tests/language/string/string_test.dart index dfe4447..3a99504 100644 --- a/tests/language/string/string_test.dart +++ b/tests/language/string/string_test.dart
@@ -30,9 +30,9 @@ static testNoSuchMethod() { String a = "Hello"; a[1] = 12; -// ^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_OPERATOR -// [cfe] The operator '[]=' isn't defined for the class 'String'. + // [error column 6, length 3] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_OPERATOR + // [cfe] The operator '[]=' isn't defined for the class 'String'. } static testCharCodes() {
diff --git a/tests/language/string/substring_runtime_test.dart b/tests/language/string/substring_runtime_test.dart index 38007ad..27de3e8 100644 --- a/tests/language/string/substring_runtime_test.dart +++ b/tests/language/string/substring_runtime_test.dart
@@ -9,10 +9,7 @@ import "package:expect/expect.dart"; main() { - try { - - - } on TypeError catch (e) { + try {} on TypeError catch (e) { // OK. } on ArgumentError catch (e) { // OK.
diff --git a/tests/language/super/assign_runtime_test.dart b/tests/language/super/assign_runtime_test.dart index 77f3ddb..eea3026 100644 --- a/tests/language/super/assign_runtime_test.dart +++ b/tests/language/super/assign_runtime_test.dart
@@ -18,5 +18,4 @@ main() { A a = new C(); a.x = 37; - }
diff --git a/tests/language/super/call3_runtime_test.dart b/tests/language/super/call3_runtime_test.dart index 1df0b3c..3605772 100644 --- a/tests/language/super/call3_runtime_test.dart +++ b/tests/language/super/call3_runtime_test.dart
@@ -10,9 +10,7 @@ import "package:expect/expect.dart"; class A { - A( - - ); + A(); final foo = 499; } @@ -25,9 +23,7 @@ } class C { - C - - (); + C(); final foo = 499; }
diff --git a/tests/language/super/call3_test.dart b/tests/language/super/call3_test.dart index 31bcc30..4000652 100644 --- a/tests/language/super/call3_test.dart +++ b/tests/language/super/call3_test.dart
@@ -7,12 +7,11 @@ import "package:expect/expect.dart"; class A { - A(this.x -// ^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD -// ^ -// [cfe] 'x' isn't an instance field of this class. - ); + A(this.x); + //^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD + // ^ + // [cfe] 'x' isn't an instance field of this class. final foo = 499; } @@ -23,13 +22,13 @@ class B2 extends A { B2(); -//^^ -// [analyzer] COMPILE_TIME_ERROR.IMPLICIT_SUPER_INITIALIZER_MISSING_ARGUMENTS -// [cfe] The implicitly called unnamed constructor from 'A' has required parameters. + // [error column 3, length 2] + // [analyzer] COMPILE_TIME_ERROR.IMPLICIT_SUPER_INITIALIZER_MISSING_ARGUMENTS + // [cfe] The implicitly called unnamed constructor from 'A' has required parameters. B2.named() : this.x = 499; -//^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.IMPLICIT_SUPER_INITIALIZER_MISSING_ARGUMENTS -// [cfe] The implicitly called unnamed constructor from 'A' has required parameters. + // [error column 3, length 8] + // [analyzer] COMPILE_TIME_ERROR.IMPLICIT_SUPER_INITIALIZER_MISSING_ARGUMENTS + // [cfe] The implicitly called unnamed constructor from 'A' has required parameters. var x; } @@ -45,13 +44,13 @@ class D2 extends C { D2(); -//^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER -// [cfe] The superclass, 'C', has no unnamed constructor that takes no arguments. + // [error column 3, length 2] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER + // [cfe] The superclass, 'C', has no unnamed constructor that takes no arguments. D2.named() : this.x = 499; -//^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER -// [cfe] The superclass, 'C', has no unnamed constructor that takes no arguments. + // [error column 3, length 2] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER + // [cfe] The superclass, 'C', has no unnamed constructor that takes no arguments. var x; }
diff --git a/tests/language/super/conditional_operator_runtime_test.dart b/tests/language/super/conditional_operator_runtime_test.dart index 2529639..c65933d 100644 --- a/tests/language/super/conditional_operator_runtime_test.dart +++ b/tests/language/super/conditional_operator_runtime_test.dart
@@ -15,29 +15,9 @@ } class C extends B { - C() + C(); - ; - - test() { - - - - - - - - - - - - - - - - - - } + test() {} } main() {
diff --git a/tests/language/super/field_access_test.dart b/tests/language/super/field_access_test.dart index ffd1897..0c7bbf2 100644 --- a/tests/language/super/field_access_test.dart +++ b/tests/language/super/field_access_test.dart
@@ -15,12 +15,8 @@ class B extends A { int foo; B.b1(x, this.foo) : super(x); - B.b2(x, y) - : this.foo = y, - super(x); - B.b3(x, y) - : this.foo = y, - super(x); + B.b2(x, y) : this.foo = y, super(x); + B.b3(x, y) : this.foo = y, super(x); super$foo() => super.foo; sum() => foo + super.foo;
diff --git a/tests/language/super/no_such_method4_runtime_legacy_test.dart b/tests/language/super/no_such_method4_runtime_legacy_test.dart index 7d93c338..f7214e3 100644 --- a/tests/language/super/no_such_method4_runtime_legacy_test.dart +++ b/tests/language/super/no_such_method4_runtime_legacy_test.dart
@@ -17,8 +17,6 @@ class B extends Object with A { noSuchMethod(im) => 87; - - } main() {
diff --git a/tests/language/super/no_such_method5_runtime_legacy_test.dart b/tests/language/super/no_such_method5_runtime_legacy_test.dart index 8f7545e..69819c7 100644 --- a/tests/language/super/no_such_method5_runtime_legacy_test.dart +++ b/tests/language/super/no_such_method5_runtime_legacy_test.dart
@@ -15,9 +15,7 @@ noSuchMethod(im) => 42; } -class B extends Object with A { - -} +class B extends Object with A {} main() { Expect.equals(42, new B().foo());
diff --git a/tests/language/super/operator_test.dart b/tests/language/super/operator_test.dart index 5953e7a..07d0c90 100644 --- a/tests/language/super/operator_test.dart +++ b/tests/language/super/operator_test.dart
@@ -46,7 +46,6 @@ } } - main() { var a = new A(); a = a + "William"; // operator + of class A.
diff --git a/tests/language/super/setter_test.dart b/tests/language/super/setter_test.dart index 3d02906..30535ba 100644 --- a/tests/language/super/setter_test.dart +++ b/tests/language/super/setter_test.dart
@@ -9,22 +9,26 @@ Base() {} String value_ = ""; - String get value { return value_; } + String get value { + return value_; + } + set value(String newValue) { value_ = 'Base:$newValue'; } } - class Derived extends Base { Derived() : super() {} set value(String newValue) { super.value = 'Derived:$newValue'; } - String get value { return super.value; } -} + String get value { + return super.value; + } +} class SuperSetterTest { static void testMain() {
diff --git a/tests/language/super/super_test.dart b/tests/language/super/super_test.dart index f96f4fe..ef1b281 100644 --- a/tests/language/super/super_test.dart +++ b/tests/language/super/super_test.dart
@@ -28,15 +28,11 @@ class Sup { var x, y, z; - Sup(a, b) - : this.x = a, - this.y = b { + Sup(a, b) : this.x = a, this.y = b { z = a + b; } - Sup.stat() - : this.x = i++, - this.y = i++ { + Sup.stat() : this.x = i++, this.y = i++ { z = i++; } } @@ -44,17 +40,11 @@ class Sub extends Sup { var u, v, w; - Sub(a, b) - : this.v = a, - this.w = b, - super(a, b) { + Sub(a, b) : this.v = a, this.w = b, super(a, b) { u = a + b; } - Sub.stat() - : this.v = i++, - this.w = i++, - super.stat() { + Sub.stat() : this.v = i++, this.w = i++, super.stat() { u = i++; } }
diff --git a/tests/language/switch/bad_case_legacy_test.dart b/tests/language/switch/bad_case_legacy_test.dart index 82e8b28..a4ac4b2 100644 --- a/tests/language/switch/bad_case_legacy_test.dart +++ b/tests/language/switch/bad_case_legacy_test.dart
@@ -33,14 +33,14 @@ archimedesSays(n) { switch (n) { case 3.14: - // ^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS - // [cfe] Case expression '3.14' does not have a primitive operator '=='. + // ^^^^ + // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS + // [cfe] Case expression '3.14' does not have a primitive operator '=='. return "Pi"; case 2.71828: - // ^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS - // [cfe] Case expression '2.71828' does not have a primitive operator '=='. + // ^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS + // [cfe] Case expression '2.71828' does not have a primitive operator '=='. return "Huh?"; } return null;
diff --git a/tests/language/switch/bad_case_runtime_test.dart b/tests/language/switch/bad_case_runtime_test.dart index 0119fa5..8cbd2f2 100644 --- a/tests/language/switch/bad_case_runtime_test.dart +++ b/tests/language/switch/bad_case_runtime_test.dart
@@ -22,18 +22,10 @@ return "I"; case 4: return "IV"; - - } return null; } archimedesSays(n) { - - - - - - return null; }
diff --git a/tests/language/switch/bad_case_test.dart b/tests/language/switch/bad_case_test.dart index 87a9f61..653170a 100644 --- a/tests/language/switch/bad_case_test.dart +++ b/tests/language/switch/bad_case_test.dart
@@ -32,14 +32,14 @@ archimedesSays(n) { switch (n) { case 3.14: - // ^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS - // [cfe] Case expression '3.14' does not have a primitive operator '=='. + // ^^^^ + // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS + // [cfe] Case expression '3.14' does not have a primitive operator '=='. return "Pi"; case 2.71828: - // ^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS - // [cfe] Case expression '2.71828' does not have a primitive operator '=='. + // ^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS + // [cfe] Case expression '2.71828' does not have a primitive operator '=='. return "Huh?"; } return null;
diff --git a/tests/language/switch/case_expression_with_assignment_test.dart b/tests/language/switch/case_expression_with_assignment_test.dart index 0ce963d..fdc3ad7 100644 --- a/tests/language/switch/case_expression_with_assignment_test.dart +++ b/tests/language/switch/case_expression_with_assignment_test.dart
@@ -6,7 +6,6 @@ // Error was in pre-pattern case parsing. // @dart=2.19 - import "package:expect/expect.dart"; const ERROR_A = 0;
diff --git a/tests/language/switch/case_fallthrough_legacy_error_test.dart b/tests/language/switch/case_fallthrough_legacy_error_test.dart index 23f4a67..16b8e2a 100644 --- a/tests/language/switch/case_fallthrough_legacy_error_test.dart +++ b/tests/language/switch/case_fallthrough_legacy_error_test.dart
@@ -208,24 +208,24 @@ } } case 10: - // [error column 9, length 4] - // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY - // [cfe] Switch case may fall through to the next case. + // [error column 9, length 4] + // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY + // [cfe] Switch case may fall through to the next case. while (true) break; // Breaks loop, reaches end. case 11: - // [error column 9, length 4] - // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY - // [cfe] Switch case may fall through to the next case. + // [error column 9, length 4] + // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY + // [cfe] Switch case may fall through to the next case. do break; while (true); // Breaks loop, reaches end. case 12: - // [error column 9, length 4] - // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY - // [cfe] Switch case may fall through to the next case. + // [error column 9, length 4] + // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY + // [cfe] Switch case may fall through to the next case. for (;;) break; // Breaks loop, reaches end. case 13: - // [error column 9, length 4] - // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY - // [cfe] Switch case may fall through to the next case. + // [error column 9, length 4] + // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY + // [cfe] Switch case may fall through to the next case. for (var _ in []) break LOOP; // Can be empty, reaches end. case 14: if (x.isEven) { @@ -236,23 +236,23 @@ case 15: (throw 0); // Exits switch. case 16: - // [error column 9, length 4] - // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY - // [cfe] Switch case may fall through to the next case. + // [error column 9, length 4] + // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY + // [cfe] Switch case may fall through to the next case. nop(x); // Reaches end. case 17: L: break; // Breaks and exits switch. case 18: - // [error column 9, length 4] - // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY - // [cfe] Switch case may fall through to the next case. + // [error column 9, length 4] + // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY + // [cfe] Switch case may fall through to the next case. L: break L; // Breaks break statement only, reaches end. case 19: - // [error column 9, length 4] - // [cfe] Switch case may fall through to the next case. - // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY + // [error column 9, length 4] + // [cfe] Switch case may fall through to the next case. + // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY L: if (x.isOdd) { break L; // Breaks if, reaches end. @@ -264,26 +264,30 @@ // with any pre-2.12 type. case 20: notEver(x); // Type Never implies not completing. - case 21: { - notEver(x); - } - case 22: { + case 21: { notEver(x); } - } - case 23: { - do { - notEver(x); - } while (true); - } - case 24: { - if (x.isEven) { - notEver(x); - } else { - notEver(-x); + case 22: + { + { + notEver(x); + } } - } + case 23: + { + do { + notEver(x); + } while (true); + } + case 24: + { + if (x.isEven) { + notEver(x); + } else { + notEver(-x); + } + } case 25: nop(x.isEven ? notEver(x) : notEver(-x)); LAST:
diff --git a/tests/language/switch/case_fallthrough_test.dart b/tests/language/switch/case_fallthrough_test.dart index f360211..9ba0eaf 100644 --- a/tests/language/switch/case_fallthrough_test.dart +++ b/tests/language/switch/case_fallthrough_test.dart
@@ -191,26 +191,30 @@ } case 39: notEver(x); // Type Never implies not completing. - case 40: { - notEver(x); - } - case 41: { + case 40: { notEver(x); } - } - case 42: { - do { - notEver(x); - } while (true); - } - case 43: { - if (x.isEven) { - notEver(x); - } else { - notEver(-x); + case 41: + { + { + notEver(x); + } } - } + case 42: + { + do { + notEver(x); + } while (true); + } + case 43: + { + if (x.isEven) { + notEver(x); + } else { + notEver(-x); + } + } case 44: nop(x.isEven ? notEver(x) : notEver(-x)); LAST:
diff --git a/tests/language/switch/case_legacy_test.dart b/tests/language/switch/case_legacy_test.dart index 5219aab..c3bcde1 100644 --- a/tests/language/switch/case_legacy_test.dart +++ b/tests/language/switch/case_legacy_test.dart
@@ -32,11 +32,13 @@ main() { switch (new B()) { - case const A.B() as B: Expect.fail("bad switch"); break; - // ^^^^^^^^^^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS - // ^ - // [cfe] Case expression 'B {}' does not have a primitive operator '=='. + case const A.B() as B: + // ^^^^^^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS + // ^ + // [cfe] Case expression 'B {}' does not have a primitive operator '=='. + Expect.fail("bad switch"); + break; } switch (new C()) { @@ -49,21 +51,25 @@ case const A.C2() as C: Expect.fail("bad switch"); break; - case const A(): Expect.fail("bad switch"); break; - // ^^^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IS_NOT_SWITCH_EXPRESSION_SUBTYPE - // ^ - // [cfe] Type 'A' of the case expression is not a subtype of type 'C' of this switch expression. + case const A(): + // ^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IS_NOT_SWITCH_EXPRESSION_SUBTYPE + // ^ + // [cfe] Type 'A' of the case expression is not a subtype of type 'C' of this switch expression. + Expect.fail("bad switch"); + break; } switch (new A()) { case const A(): Expect.fail("bad switch"); break; - case const A.B(): Expect.fail("bad switch"); break; - // ^^^^^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS - // ^ - // [cfe] Case expression 'B {}' does not have a primitive operator '=='. + case const A.B(): + // ^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS + // ^ + // [cfe] Case expression 'B {}' does not have a primitive operator '=='. + Expect.fail("bad switch"); + break; } }
diff --git a/tests/language/switch/case_test.dart b/tests/language/switch/case_test.dart index 84d6ce3..21fcb52 100644 --- a/tests/language/switch/case_test.dart +++ b/tests/language/switch/case_test.dart
@@ -33,11 +33,13 @@ main() { switch (new B()) { - case const A.B() as B: Expect.fail("bad switch"); break; - // ^^^^^^^^^^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS - // ^ - // [cfe] Case expression 'B {}' does not have a primitive operator '=='. + case const A.B() as B: + // ^^^^^^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS + // ^ + // [cfe] Case expression 'B {}' does not have a primitive operator '=='. + Expect.fail("bad switch"); + break; } switch (new C()) { @@ -50,21 +52,25 @@ case const A.C2() as C: Expect.fail("bad switch"); break; - case const A(): Expect.fail("bad switch"); break; - // ^^^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IS_NOT_SWITCH_EXPRESSION_SUBTYPE - // ^ - // [cfe] Type 'A' of the case expression is not a subtype of type 'C' of this switch expression. + case const A(): + // ^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IS_NOT_SWITCH_EXPRESSION_SUBTYPE + // ^ + // [cfe] Type 'A' of the case expression is not a subtype of type 'C' of this switch expression. + Expect.fail("bad switch"); + break; } switch (new A()) { case const A(): Expect.fail("bad switch"); break; - case const A.B(): Expect.fail("bad switch"); break; - // ^^^^^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS - // ^ - // [cfe] Case expression 'B {}' does not have a primitive operator '=='. + case const A.B(): + // ^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS + // ^ + // [cfe] Case expression 'B {}' does not have a primitive operator '=='. + Expect.fail("bad switch"); + break; } }
diff --git a/tests/language/switch/switch4_test.dart b/tests/language/switch/switch4_test.dart index ccd6312..ceaec6b 100644 --- a/tests/language/switch/switch4_test.dart +++ b/tests/language/switch/switch4_test.dart
@@ -11,10 +11,10 @@ case 1: x = 1; continue L; -// ^ -// [cfe] Can't find label 'L'. -// ^ -// [analyzer] COMPILE_TIME_ERROR.LABEL_UNDEFINED + //^ + // [cfe] Can't find label 'L'. + // ^ + // [analyzer] COMPILE_TIME_ERROR.LABEL_UNDEFINED case 6: x = 2; break;
diff --git a/tests/language/switch/switch5_test.dart b/tests/language/switch/switch5_test.dart index d026d06..8db7e94 100644 --- a/tests/language/switch/switch5_test.dart +++ b/tests/language/switch/switch5_test.dart
@@ -15,9 +15,9 @@ case 6: x = 2; break L; - // ^ - // [analyzer] COMPILE_TIME_ERROR.BREAK_LABEL_ON_SWITCH_MEMBER - // [cfe] Can't break to 'L'. + // ^ + // [analyzer] COMPILE_TIME_ERROR.BREAK_LABEL_ON_SWITCH_MEMBER + // [cfe] Can't break to 'L'. default: break; }
diff --git a/tests/language/switch/switch7_test.dart b/tests/language/switch/switch7_test.dart index e47d7e5..0449550 100644 --- a/tests/language/switch/switch7_test.dart +++ b/tests/language/switch/switch7_test.dart
@@ -12,9 +12,9 @@ L: case 1: // Shadowing another label is OK. break L; // Illegal, can't reference labeled case from break. - // ^ - // [analyzer] COMPILE_TIME_ERROR.BREAK_LABEL_ON_SWITCH_MEMBER - // [cfe] Can't break to 'L'. + // ^ + // [analyzer] COMPILE_TIME_ERROR.BREAK_LABEL_ON_SWITCH_MEMBER + // [cfe] Can't break to 'L'. } } }
diff --git a/tests/language/symbol/literal_runtime_1_test.dart b/tests/language/symbol/literal_runtime_1_test.dart index e574d8c..2315af2 100644 --- a/tests/language/symbol/literal_runtime_1_test.dart +++ b/tests/language/symbol/literal_runtime_1_test.dart
@@ -47,5 +47,4 @@ Expect.equals(1, m[#B]); // Tries to call the symbol literal #a.toString - }
diff --git a/tests/language/symbol/literal_runtime_test.dart b/tests/language/symbol/literal_runtime_test.dart index 5bc7eed..15d87f2 100644 --- a/tests/language/symbol/literal_runtime_test.dart +++ b/tests/language/symbol/literal_runtime_test.dart
@@ -47,5 +47,4 @@ Expect.equals(1, m[#B]); // Tries to call the symbol literal #a.toString - }
diff --git a/tests/language/sync_star/generator1_runtime_test.dart b/tests/language/sync_star/generator1_runtime_test.dart index 728a800..0eed891 100644 --- a/tests/language/sync_star/generator1_runtime_test.dart +++ b/tests/language/sync_star/generator1_runtime_test.dart
@@ -49,7 +49,6 @@ dreiVier() sync* { // Throws type error: yielded object is not an iterable. - } main() { @@ -84,7 +83,5 @@ print(einsZwei()); Expect.equals("(1, 2, 3, 5, [6])", einsZwei().toString()); - - } }
diff --git a/tests/language/sync_star/sync_star_exception_iterator_test.dart b/tests/language/sync_star/sync_star_exception_iterator_test.dart index 22d36d1..d21f2e9 100644 --- a/tests/language/sync_star/sync_star_exception_iterator_test.dart +++ b/tests/language/sync_star/sync_star_exception_iterator_test.dart
@@ -89,8 +89,9 @@ Expect.isTrue(iterator.moveNext()); Expect.equals(100, iterator.current); Expect.equals( - '[main.f2.p.y*1][main.f2.p.f1.a][main.f2.catch:iterator@main.f2.p.f1.a]', - log); + '[main.f2.p.y*1][main.f2.p.f1.a][main.f2.catch:iterator@main.f2.p.f1.a]', + log, + ); log = ''; Expect.isFalse(iterator.moveNext()); Expect.equals('[main.f2.done]', log); @@ -101,7 +102,9 @@ final iterator = f3('main').iterator; Expect.isFalse(iterator.moveNext()); Expect.equals( - '[main.f3.f][main.f3.catch:iterator@main.f3.f][main.f3.done]', log); + '[main.f3.f][main.f3.catch:iterator@main.f3.f][main.f3.done]', + log, + ); } { @@ -110,11 +113,12 @@ Expect.isTrue(iterator.moveNext()); Expect.equals(200, iterator.current); Expect.equals( - '[M.f4.s.y*1]' - '[M.f4.s.f3.f][M.f4.s.f3.catch:iterator@M.f4.s.f3.f][M.f4.s.f3.done]' - '[M.f4.s.y*2]' - '[M.f4.t.f3.f][M.f4.t.f3.catch:iterator@M.f4.t.f3.f][M.f4.t.f3.done]', - log); + '[M.f4.s.y*1]' + '[M.f4.s.f3.f][M.f4.s.f3.catch:iterator@M.f4.s.f3.f][M.f4.s.f3.done]' + '[M.f4.s.y*2]' + '[M.f4.t.f3.f][M.f4.t.f3.catch:iterator@M.f4.t.f3.f][M.f4.t.f3.done]', + log, + ); log = ''; Expect.isFalse(iterator.moveNext()); Expect.equals('[M.f4.done]', log);
diff --git a/tests/language/sync_star/void_sync_star_test.dart b/tests/language/sync_star/void_sync_star_test.dart index 4c387f3..5c1172b 100644 --- a/tests/language/sync_star/void_sync_star_test.dart +++ b/tests/language/sync_star/void_sync_star_test.dart
@@ -4,31 +4,35 @@ // It is an error for a `sync*` function to have return type `void`. -/*space*/ void f1() sync* { - // ^^^^ - // [analyzer] unspecified - // [cfe] unspecified +void f1() sync* { + // [error column 1, length 4] + // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE + // ^ + // [cfe] Functions marked 'sync*' can't have return type 'void'. } class C { static void f2() sync* { // ^^^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE + // ^ + // [cfe] Functions marked 'sync*' can't have return type 'void'. } - /*space*/ void f3() sync* { - // ^^^^ - // [analyzer] unspecified - // [cfe] unspecified + void f3() sync* { + // [error column 3, length 4] + // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE + // ^ + // [cfe] Functions marked 'sync*' can't have return type 'void'. } } void main() { - /*space*/ void f4() sync* { - // ^^^^ - // [analyzer] unspecified - // [cfe] unspecified + void f4() sync* { + // [error column 3, length 4] + // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE + // ^ + // [cfe] Functions marked 'sync*' can't have return type 'void'. } // No function literal: It is probably not possible to infer the
diff --git a/tests/language/sync_star/yield_star_pause_test.dart b/tests/language/sync_star/yield_star_pause_test.dart index bc2fcb3..205a1df 100644 --- a/tests/language/sync_star/yield_star_pause_test.dart +++ b/tests/language/sync_star/yield_star_pause_test.dart
@@ -14,14 +14,17 @@ var c = new Completer(); var s = yieldStream(mkStream()); var sub; - sub = s.listen((v) { - sub.pause(); - print(v); - Timer.run(sub.resume); - }, onDone: () { - print("DONE"); - c.complete(null); - }); + sub = s.listen( + (v) { + sub.pause(); + print(v); + Timer.run(sub.resume); + }, + onDone: () { + print("DONE"); + c.complete(null); + }, + ); return c.future; }); }
diff --git a/tests/language/syntax/statement_test.dart b/tests/language/syntax/statement_test.dart index f1b8a46..9b05080 100644 --- a/tests/language/syntax/statement_test.dart +++ b/tests/language/syntax/statement_test.dart
@@ -68,7 +68,7 @@ Expect.equals(5, count); // For loop with no test. - for (count = 0;; ++count) { + for (count = 0; ; ++count) { if (count == 10) { break; } @@ -164,7 +164,7 @@ var ints = [ [32, 87, 3, 589], [12, 1076, 2000, 8], - [622, 127, 77, 955] + [622, 127, 77, 955], ]; int i, j = 0; bool foundIt = false;
diff --git a/tests/language/syntax/syntax_native_test.dart b/tests/language/syntax/syntax_native_test.dart index 72db71d..3b333e1 100644 --- a/tests/language/syntax/syntax_native_test.dart +++ b/tests/language/syntax/syntax_native_test.dart
@@ -32,9 +32,9 @@ // [cfe] expect cfe to report an error here class ListFactory<E> implements List<E> native "Array" { -// ^^^^^^^^^^^^^^ -// [analyzer] SYNTACTIC_ERROR.NATIVE_CLAUSE_IN_NON_SDK_CODE -// [cfe] expect cfe to report an error here + // ^^^^^^^^^^^^^^ + // [analyzer] SYNTACTIC_ERROR.NATIVE_CLAUSE_IN_NON_SDK_CODE + // [cfe] expect cfe to report an error here noSuchMethod(_) => null; // Allow unimplemented methods }
diff --git a/tests/language/this/conditional_operator_runtime_test.dart b/tests/language/this/conditional_operator_runtime_test.dart index 4b99c70..f3788c3 100644 --- a/tests/language/this/conditional_operator_runtime_test.dart +++ b/tests/language/this/conditional_operator_runtime_test.dart
@@ -18,17 +18,17 @@ test() { this?.field = 1; -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR + // ^^ + // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR this?.field += 1; -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR + // ^^ + // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR this?.field; -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR + // ^^ + // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR this?.method(); -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR + // ^^ + // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR } }
diff --git a/tests/language/this/implicit_runtime_test.dart b/tests/language/this/implicit_runtime_test.dart index 34022fd..b0526af 100644 --- a/tests/language/this/implicit_runtime_test.dart +++ b/tests/language/this/implicit_runtime_test.dart
@@ -19,7 +19,6 @@ // This class does not implement "x" either, but it is not marked // abstract. - // This class does not implement "x", but is itself abstract, so that's OK. abstract class SubAbstract2 extends Abstract { get x; // Abstract. @@ -28,7 +27,6 @@ // This class does not implement "x" either, but it is not marked // abstract. - class Concrete extends Abstract { get x => 7; } @@ -39,7 +37,6 @@ } void main() { - Expect.equals('7', new Concrete().toString()); Expect.equals('42', new SubConcrete(42).toString()); Expect.equals('7', new SubConcrete(new Concrete()).toString());
diff --git a/tests/language/this/runtime_test.dart b/tests/language/this/runtime_test.dart index c81a1b2..40b93683 100644 --- a/tests/language/this/runtime_test.dart +++ b/tests/language/this/runtime_test.dart
@@ -9,16 +9,7 @@ var x; f() {} - testMe() { - - - - - - - - - } + testMe() {} } main() {
diff --git a/tests/language/top_level/func_test.dart b/tests/language/top_level/func_test.dart index db9d859..6432055 100644 --- a/tests/language/top_level/func_test.dart +++ b/tests/language/top_level/func_test.dart
@@ -42,7 +42,8 @@ } get Window { - return "win" "dow"; + return "win" + "dow"; } String? rgb;
diff --git a/tests/language/top_level/getter_no_setter1_test.dart b/tests/language/top_level/getter_no_setter1_test.dart index 8b48ce3..b33a4fc 100644 --- a/tests/language/top_level/getter_no_setter1_test.dart +++ b/tests/language/top_level/getter_no_setter1_test.dart
@@ -14,9 +14,9 @@ class Class { method() { getter++; -// ^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL -// [cfe] Setter not found: 'getter'. + // [error column 5, length 6] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL + // [cfe] Setter not found: 'getter'. } }
diff --git a/tests/language/top_level/getter_no_setter2_test.dart b/tests/language/top_level/getter_no_setter2_test.dart index 120f252..806418b 100644 --- a/tests/language/top_level/getter_no_setter2_test.dart +++ b/tests/language/top_level/getter_no_setter2_test.dart
@@ -14,9 +14,9 @@ class Class { method() { getter++; -// ^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL -// [cfe] Setter not found: 'getter'. + // [error column 5, length 6] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL + // [cfe] Setter not found: 'getter'. } }
diff --git a/tests/language/type/checks_in_factory_method_runtime_test.dart b/tests/language/type/checks_in_factory_method_runtime_test.dart index 58f0c89..4726279 100644 --- a/tests/language/type/checks_in_factory_method_runtime_test.dart +++ b/tests/language/type/checks_in_factory_method_runtime_test.dart
@@ -23,7 +23,6 @@ print(" String=$isString"); }; - return new Bar<T>(); } }
diff --git a/tests/language/type/conversion_ssa_test.dart b/tests/language/type/conversion_ssa_test.dart index 975b03b..89b40b8 100644 --- a/tests/language/type/conversion_ssa_test.dart +++ b/tests/language/type/conversion_ssa_test.dart
@@ -23,9 +23,9 @@ new SelectorGroup([ new Selector([new SimpleSelectorSequence(new ClassSelector())]), new Selector([new SimpleSelectorSequence(new ClassSelector())]), - new Selector([new SimpleSelectorSequence(new ClassSelector())]) + new Selector([new SimpleSelectorSequence(new ClassSelector())]), ]), - new Object() + new Object(), ]; class RuleSet {
diff --git a/tests/language/type/error_test.dart b/tests/language/type/error_test.dart index 4797b37..328c39d 100644 --- a/tests/language/type/error_test.dart +++ b/tests/language/type/error_test.dart
@@ -27,19 +27,25 @@ dynamic noToString = NoToString(); - Expect.throws<TypeError>(() { - wrap(noToString) as int; // Explicit cast should throw - }, (e) { - e.toString(); // Should not throw. - return true; - }); - - if (assertionsEnabled) { - Expect.throws<AssertionError>(() { - assert(wrap(false), noToString); // Assertion should throw - }, (e) { + Expect.throws<TypeError>( + () { + wrap(noToString) as int; // Explicit cast should throw + }, + (e) { e.toString(); // Should not throw. return true; - }); + }, + ); + + if (assertionsEnabled) { + Expect.throws<AssertionError>( + () { + assert(wrap(false), noToString); // Assertion should throw + }, + (e) { + e.toString(); // Should not throw. + return true; + }, + ); } }
diff --git a/tests/language/type/implicit_error_test.dart b/tests/language/type/implicit_error_test.dart index 5adad76..ceb666c 100644 --- a/tests/language/type/implicit_error_test.dart +++ b/tests/language/type/implicit_error_test.dart
@@ -27,19 +27,25 @@ dynamic noToString = NoToString(); - Expect.throws<TypeError>(() { - int x = wrap(noToString); // Implicit cast should throw - }, (e) { - e.toString(); // Should not throw. - return true; - }); - - if (assertionsEnabled) { - Expect.throws<TypeError>(() { - assert(wrap(noToString)); // Implicit cast should throw - }, (e) { + Expect.throws<TypeError>( + () { + int x = wrap(noToString); // Implicit cast should throw + }, + (e) { e.toString(); // Should not throw. return true; - }); + }, + ); + + if (assertionsEnabled) { + Expect.throws<TypeError>( + () { + assert(wrap(noToString)); // Implicit cast should throw + }, + (e) { + e.toString(); // Should not throw. + return true; + }, + ); } }
diff --git a/tests/language/type_object/constant_type_literal_runtime_test.dart b/tests/language/type_object/constant_type_literal_runtime_test.dart index 30fdd50..1113986 100644 --- a/tests/language/type_object/constant_type_literal_runtime_test.dart +++ b/tests/language/type_object/constant_type_literal_runtime_test.dart
@@ -9,9 +9,7 @@ class C<T> { void m() { - const List lst = const [ - - ]; + const List lst = const []; } }
diff --git a/tests/language/type_object/constant_type_literal_test.dart b/tests/language/type_object/constant_type_literal_test.dart index 83222bf..32101d8 100644 --- a/tests/language/type_object/constant_type_literal_test.dart +++ b/tests/language/type_object/constant_type_literal_test.dart
@@ -6,12 +6,10 @@ class C<T> { void m() { - const List lst = const [ - T -// ^ -// [analyzer] COMPILE_TIME_ERROR.CONST_TYPE_PARAMETER -// [cfe] Type variables can't be used as constants. - ]; + const List lst = const [T]; + // ^ + // [analyzer] COMPILE_TIME_ERROR.CONST_TYPE_PARAMETER + // [cfe] Type variables can't be used as constants. } }
diff --git a/tests/language/type_object/explicit_instantiated_type_literal_error_test.dart b/tests/language/type_object/explicit_instantiated_type_literal_error_test.dart index 804a291..4fe98c3 100644 --- a/tests/language/type_object/explicit_instantiated_type_literal_error_test.dart +++ b/tests/language/type_object/explicit_instantiated_type_literal_error_test.dart
@@ -16,16 +16,17 @@ // ^ // [cfe] Type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'C'. // ^^^^^^ - // [analyzer] unspecified + // [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS use(C<int, int>); // ^ // [cfe] Expected 1 type arguments. - // ^ - // [analyzer] unspecified + // ^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS use(C<>); - // ^^ - // [cfe] unspecified - // [analyzer] unspecified + // ^ + // [analyzer] SYNTACTIC_ERROR.EXPECTED_TYPE_NAME + // [cfe] Expected a type, but got '>'. + // [cfe] This couldn't be parsed. }
diff --git a/tests/language/type_object/first_class_types_literals_runtime_1_test.dart b/tests/language/type_object/first_class_types_literals_runtime_1_test.dart index b415e99..38d044d 100644 --- a/tests/language/type_object/first_class_types_literals_runtime_1_test.dart +++ b/tests/language/type_object/first_class_types_literals_runtime_1_test.dart
@@ -47,21 +47,10 @@ Expect.equals(Object, Object().runtimeType); Expect.equals(C, new C().runtimeType); - // runtimeType on type is idempotent. Expect.equals((D).runtimeType, (D).runtimeType.runtimeType); // Test that operator calls on class literals go to Type. - - - - - - - - - - Expect.equals((dynamic).toString(), 'dynamic'); }
diff --git a/tests/language/type_object/first_class_types_literals_runtime_2_test.dart b/tests/language/type_object/first_class_types_literals_runtime_2_test.dart index e5c8442..b0efeda 100644 --- a/tests/language/type_object/first_class_types_literals_runtime_2_test.dart +++ b/tests/language/type_object/first_class_types_literals_runtime_2_test.dart
@@ -53,15 +53,5 @@ // Test that operator calls on class literals go to Type. - - - - - - - - - - Expect.equals((dynamic).toString(), 'dynamic'); }
diff --git a/tests/language/type_object/first_class_types_literals_runtime_test.dart b/tests/language/type_object/first_class_types_literals_runtime_test.dart index 3df083a..0d0f528 100644 --- a/tests/language/type_object/first_class_types_literals_runtime_test.dart +++ b/tests/language/type_object/first_class_types_literals_runtime_test.dart
@@ -46,22 +46,10 @@ Expect.equals(bool, true.runtimeType); Expect.equals(Object, Object().runtimeType); - - // runtimeType on type is idempotent. Expect.equals((D).runtimeType, (D).runtimeType.runtimeType); // Test that operator calls on class literals go to Type. - - - - - - - - - - Expect.equals((dynamic).toString(), 'dynamic'); }
diff --git a/tests/language/type_object/first_class_types_literals_test.dart b/tests/language/type_object/first_class_types_literals_test.dart index 6392b6d..29ac65b 100644 --- a/tests/language/type_object/first_class_types_literals_test.dart +++ b/tests/language/type_object/first_class_types_literals_test.dart
@@ -70,15 +70,13 @@ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_OPERATOR // [cfe] The operator '[]=' isn't defined for the class 'Type'. Expect.throwsNoSuchMethodError(() => dynamic = 1); - // ^ - // [cfe] Can't assign to a type literal. // ^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_TYPE + // [cfe] Can't assign to a type literal. Expect.throwsNoSuchMethodError(() => dynamic++); - // ^ - // [cfe] Can't assign to a type literal. // ^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_TYPE + // [cfe] Can't assign to a type literal. Expect.throwsNoSuchMethodError(() => dynamic + 1); // ^ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_OPERATOR
diff --git a/tests/language/type_object/futureor_tostring_test.dart b/tests/language/type_object/futureor_tostring_test.dart index 5a1441d..07f7704 100644 --- a/tests/language/type_object/futureor_tostring_test.dart +++ b/tests/language/type_object/futureor_tostring_test.dart
@@ -32,8 +32,9 @@ // That is the case for all current implementations, in all modes, // even if `Type.toString()` doesn't document it. - Match match = RegExp(r"^(.+)<(.+)<(.+)>>$") - .matchAsPrefix((A<FutureOr<String>>).toString())!; + Match match = RegExp( + r"^(.+)<(.+)<(.+)>>$", + ).matchAsPrefix((A<FutureOr<String>>).toString())!; String a = match[1]!; String fo = match[2]!;
diff --git a/tests/language/type_object/literal_type_literal_test.dart b/tests/language/type_object/literal_type_literal_test.dart index 27f5085..fc69249 100644 --- a/tests/language/type_object/literal_type_literal_test.dart +++ b/tests/language/type_object/literal_type_literal_test.dart
@@ -63,17 +63,25 @@ // Typedef. testType(Func, ["Func", "(bool) => int"]); testType(Func2, ["Func2", "(bool) => int"]); - testType(GenericTypedef, - ["GenericTypedef", "GenericTypedef<dynamic>", "(dynamic) => int"]); - testType(GenericTypedef2, - ["GenericTypedef2", "GenericTypedef2<dynamic>", "(dynamic) => int"]); - testType(new Box<GenericTypedef<int>>().typeArg, - ["GenericTypedef<int>", "(int) => int"]); + testType(GenericTypedef, [ + "GenericTypedef", + "GenericTypedef<dynamic>", + "(dynamic) => int", + ]); + testType(GenericTypedef2, [ + "GenericTypedef2", + "GenericTypedef2<dynamic>", + "(dynamic) => int", + ]); + testType(new Box<GenericTypedef<int>>().typeArg, [ + "GenericTypedef<int>", + "(int) => int", + ]); testType(GenericFunc, ["GenericFunc", RegExp(r'<(\w+)>\((\1)\) => int')]); testType(GenericTypedefAndFunc, [ "GenericTypedefAndFunc", "GenericTypedefAndFunc<dynamic>", - RegExp(r'<(\w+)>\((\1)\) => dynamic') + RegExp(r'<(\w+)>\((\1)\) => dynamic'), ]); // Literals are canonicalized. @@ -110,8 +118,10 @@ matched = matched || value.hasMatch(text); } } - Expect.isTrue(matched, - 'type `$type`.toString() should be one of: $expectedToStringValues.'); + Expect.isTrue( + matched, + 'type `$type`.toString() should be one of: $expectedToStringValues.', + ); } else { var string = expectedToStringValues as String; Expect.equals(string, text);
diff --git a/tests/language/type_object/runtime_type_function_helper.dart b/tests/language/type_object/runtime_type_function_helper.dart index 4ab2ec0..c42a953 100644 --- a/tests/language/type_object/runtime_type_function_helper.dart +++ b/tests/language/type_object/runtime_type_function_helper.dart
@@ -7,8 +7,11 @@ typedef String F(String returns, String arguments, [Map<String, String> named]); /// Formats a type like `(String, [int], {bool name}) => double`. -String fn(String returns, String positional, - [Map<String, String> named = const {}]) { +String fn( + String returns, + String positional, [ + Map<String, String> named = const {}, +]) { var result = new StringBuffer(); result.write("($positional"); if (positional != "" && named.isNotEmpty) result.write(", ");
diff --git a/tests/language/type_object/runtime_type_function_test.dart b/tests/language/type_object/runtime_type_function_test.dart index 512e33f..ca3eb6f 100644 --- a/tests/language/type_object/runtime_type_function_test.dart +++ b/tests/language/type_object/runtime_type_function_test.dart
@@ -18,7 +18,10 @@ var s = new Xyzzy().runtimeType.toString(); if (!s.startsWith('minified')) { Expect.equals( - 'Xyzzy', s, 'runtime type of plain class prints as class name'); + 'Xyzzy', + s, + 'runtime type of plain class prints as class name', + ); } check(fn('void', 'String, dynamic'), check);
diff --git a/tests/language/type_promotion/assign_runtime_test.dart b/tests/language/type_promotion/assign_runtime_test.dart index 244ab17..4545105 100644 --- a/tests/language/type_promotion/assign_runtime_test.dart +++ b/tests/language/type_promotion/assign_runtime_test.dart
@@ -40,7 +40,6 @@ if (a is B) { a = A(); print(a.a); - } if (a is B) { print(a.a); @@ -49,6 +48,5 @@ a = A(); } print(a.a); - } }
diff --git a/tests/language/type_promotion/closure_runtime_1_test.dart b/tests/language/type_promotion/closure_runtime_1_test.dart index 9700e47..31db9ad 100644 --- a/tests/language/type_promotion/closure_runtime_1_test.dart +++ b/tests/language/type_promotion/closure_runtime_1_test.dart
@@ -56,7 +56,6 @@ A a = new E(); if (a is B) { print(a.a); - } void foo() { a = new D(); @@ -71,7 +70,6 @@ if (a is B) { print(a.a); - } } @@ -89,7 +87,6 @@ } print(a.a); - } } @@ -107,7 +104,6 @@ } print(a.a); - } } @@ -123,7 +119,6 @@ void test5() { A a = new E(); if (a is B) { - print(a.a); } a = A(); @@ -134,7 +129,6 @@ if (a is B) { func(() => a); print(a.a); - } a = A(); } @@ -144,7 +138,6 @@ if (((a) is B)) { func(() => a); print(a.a); - } a = A(); } @@ -153,16 +146,13 @@ A a = new E(); if (a is B && func(() => a)) { print(a.a); - } a = A(); } void test8() { A a = new E(); - if (a is B - - ) { + if (a is B) { print(a.a); } a = A(); @@ -178,7 +168,6 @@ List<A> a = <E>[new E()]; if (a is List<B>) { func(() => a[0]); - } a = []; } @@ -187,7 +176,6 @@ List<A> a = <E>[new E()]; if (a is List<B>) { func(() => a[0] = E()); - } a = []; } @@ -197,7 +185,6 @@ if (a is B) { func(() => a++); print(a.a); - } a = A(); }
diff --git a/tests/language/type_promotion/closure_runtime_2_test.dart b/tests/language/type_promotion/closure_runtime_2_test.dart index 52dc86f..3db0e81 100644 --- a/tests/language/type_promotion/closure_runtime_2_test.dart +++ b/tests/language/type_promotion/closure_runtime_2_test.dart
@@ -56,7 +56,6 @@ A a = new E(); if (a is B) { print(a.a); - } void foo() { a = new D(); @@ -71,7 +70,6 @@ if (a is B) { print(a.a); - } } @@ -89,7 +87,6 @@ } print(a.a); - } } @@ -107,14 +104,12 @@ } print(a.a); - } } void test4() { A a = new E(); if (a is B) { - print(a.a); print(a.b); } @@ -123,7 +118,6 @@ void test5() { A a = new E(); if (a is B) { - print(a.a); } a = A(); @@ -134,7 +128,6 @@ if (a is B) { func(() => a); print(a.a); - } a = A(); } @@ -144,7 +137,6 @@ if (((a) is B)) { func(() => a); print(a.a); - } a = A(); } @@ -160,9 +152,7 @@ void test8() { A a = new E(); - if (a is B - - ) { + if (a is B) { print(a.a); } a = A(); @@ -178,7 +168,6 @@ List<A> a = <E>[new E()]; if (a is List<B>) { func(() => a[0]); - } a = []; } @@ -187,7 +176,6 @@ List<A> a = <E>[new E()]; if (a is List<B>) { func(() => a[0] = E()); - } a = []; } @@ -197,7 +185,6 @@ if (a is B) { func(() => a++); print(a.a); - } a = A(); }
diff --git a/tests/language/type_promotion/closure_runtime_test.dart b/tests/language/type_promotion/closure_runtime_test.dart index 07b6caa..bc6f51f 100644 --- a/tests/language/type_promotion/closure_runtime_test.dart +++ b/tests/language/type_promotion/closure_runtime_test.dart
@@ -56,7 +56,6 @@ A a = new E(); if (a is B) { print(a.a); - } void foo() { a = new D(); @@ -71,7 +70,6 @@ if (a is B) { print(a.a); - } } @@ -89,7 +87,6 @@ } print(a.a); - } } @@ -107,14 +104,12 @@ } print(a.a); - } } void test4() { A a = new E(); if (a is B) { - print(a.a); print(a.b); } @@ -123,7 +118,6 @@ void test5() { A a = new E(); if (a is B) { - print(a.a); } a = A(); @@ -134,7 +128,6 @@ if (a is B) { func(() => a); print(a.a); - } a = A(); } @@ -144,7 +137,6 @@ if (((a) is B)) { func(() => a); print(a.a); - } a = A(); } @@ -153,16 +145,13 @@ A a = new E(); if (a is B && func(() => a)) { print(a.a); - } a = A(); } void test8() { A a = new E(); - if (a is B - - ) { + if (a is B) { print(a.a); } a = A(); @@ -178,7 +167,6 @@ List<A> a = <E>[new E()]; if (a is List<B>) { func(() => a[0]); - } a = []; } @@ -187,7 +175,6 @@ List<A> a = <E>[new E()]; if (a is List<B>) { func(() => a[0] = E()); - } a = []; } @@ -197,7 +184,6 @@ if (a is B) { func(() => a++); print(a.a); - } a = A(); }
diff --git a/tests/language/type_promotion/closure_test.dart b/tests/language/type_promotion/closure_test.dart index 7606728..fc4d161 100644 --- a/tests/language/type_promotion/closure_test.dart +++ b/tests/language/type_promotion/closure_test.dart
@@ -175,12 +175,10 @@ void test8() { A a = new E(); - if (a is B - && func(() => a.b) - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'b' isn't defined for the class 'A'. - ) { + if (a is B && func(() => a.b)) { + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'b' isn't defined for the class 'A'. print(a.a); } a = A();
diff --git a/tests/language/type_promotion/functions_runtime_test.dart b/tests/language/type_promotion/functions_runtime_test.dart index 5e462be..a318e2b 100644 --- a/tests/language/type_promotion/functions_runtime_test.dart +++ b/tests/language/type_promotion/functions_runtime_test.dart
@@ -45,7 +45,6 @@ a = funcAtoDyn(new A()); b = funcAtoDyn(new B()); - if (funcAtoDyn is FuncDynToDyn) { // Promotion: FuncDynToDyn <: FuncAtoDyn. a = funcAtoDyn(new A()); @@ -73,23 +72,18 @@ funcDynToDyn(new B()); funcDynToDyn(new C()); // Returned value has type `void`, usage is restricted. - } if (funcDynToDyn is FuncDynToA) { // Promotion: FuncDynToA <: FuncDynToDyn. a = funcDynToDyn(new A()); b = funcDynToDyn(new B()) as B; - } } testFuncDynToVoid() { FuncDynToVoid funcDynToVoid = func; - - - if (funcDynToVoid is FuncDynToDyn) { // Promotion: FuncDynToDyn <:> FuncDynToVoid. a = funcDynToVoid(new A()); @@ -101,7 +95,6 @@ // Promotion: FuncDynToA <: FuncDynToVoid. a = funcDynToVoid(new A()); b = funcDynToVoid(new B()) as B; - } } @@ -110,18 +103,15 @@ a = funcDynToA(new A()); b = funcDynToA(new B()) as B; - if (funcDynToA is FuncDynToDyn) { // No promotion: FuncDynToDyn <\: FuncDynToA. a = funcDynToA(new A()); b = funcDynToA(new B()) as B; - } if (funcDynToA is FuncDynToVoid) { // No promotion: FuncDynToVoid <\: FuncDynToA. a = funcDynToA(new A()); b = funcDynToA(new B()) as B; - } }
diff --git a/tests/language/type_promotion/local_runtime_test.dart b/tests/language/type_promotion/local_runtime_test.dart index b010208..4767e39 100644 --- a/tests/language/type_promotion/local_runtime_test.dart +++ b/tests/language/type_promotion/local_runtime_test.dart
@@ -34,130 +34,88 @@ A a = new E(); print(a.a); - - - if (a is B) { print(a.a); print(a.b); - - if (a is C) { print(a.a); print(a.b); print(a.c); - } print(a.a); print(a.b); - - } if (a is C) { print(a.a); print(a.b); print(a.c); - if (a is B) { print(a.a); print(a.b); print(a.c); - } if (a is D) { print(a.a); print(a.b); print(a.c); - } print(a.a); print(a.b); print(a.c); - } print(a.a); - - - if (a is D) { print(a.a); - print(a.d); } print(a.a); - - - var o1 = a is B - ? '${a.a}' - '${a.b}' - - - : '${a.a}' - - - - ; + ? '${a.a}' + '${a.b}' + : '${a.a}'; var o2 = a is C - ? '${a.a}' - '${a.b}' - '${a.c}' - - : '${a.a}' - - - - ; + ? '${a.a}' + '${a.b}' + '${a.c}' + : '${a.a}'; var o3 = a is D - ? '${a.a}' - - - '${a.d}' - : '${a.a}' - - - - ; + ? '${a.a}' + '${a.d}' + : '${a.a}'; if (a is B && a is B) { print(a.a); print(a.b); - - } if (a is B && a is C) { print(a.a); print(a.b); print(a.c); - } if (a is C && a is B) { print(a.a); print(a.b); print(a.c); - } if (a is C && a is D) { print(a.a); print(a.b); print(a.c); - } if (a is D && a is C) { print(a.a); - print(a.d); } }
diff --git a/tests/language/type_promotion/local_test.dart b/tests/language/type_promotion/local_test.dart index 85b0386..73666e0 100644 --- a/tests/language/type_promotion/local_test.dart +++ b/tests/language/type_promotion/local_test.dart
@@ -155,79 +155,76 @@ // [cfe] The getter 'd' isn't defined for the class 'A'. var o1 = a is B - ? '${a.a}' - '${a.b}' - '${a.c}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'c' isn't defined for the class 'B'. - '${a.d}' - // ^ + ? '${a.a}' + '${a.b}' + '${a.c}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'c' isn't defined for the class 'B'. + '${a.d}' + // ^ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER // [cfe] The getter 'd' isn't defined for the class 'B'. - : '${a.a}' - '${a.b}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'b' isn't defined for the class 'A'. - '${a.c}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'c' isn't defined for the class 'A'. - '${a.d}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'd' isn't defined for the class 'A'. - ; + : '${a.a}' + '${a.b}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'b' isn't defined for the class 'A'. + '${a.c}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'c' isn't defined for the class 'A'. + '${a.d}'; + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'd' isn't defined for the class 'A'. var o2 = a is C - ? '${a.a}' - '${a.b}' - '${a.c}' - '${a.d}' - // ^ + ? '${a.a}' + '${a.b}' + '${a.c}' + '${a.d}' + // ^ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER // [cfe] The getter 'd' isn't defined for the class 'C'. - : '${a.a}' - '${a.b}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'b' isn't defined for the class 'A'. - '${a.c}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'c' isn't defined for the class 'A'. - '${a.d}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'd' isn't defined for the class 'A'. - ; + : '${a.a}' + '${a.b}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'b' isn't defined for the class 'A'. + '${a.c}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'c' isn't defined for the class 'A'. + '${a.d}'; + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'd' isn't defined for the class 'A'. var o3 = a is D - ? '${a.a}' - '${a.b}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'b' isn't defined for the class 'D'. - '${a.c}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'c' isn't defined for the class 'D'. - '${a.d}' - : '${a.a}' - '${a.b}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'b' isn't defined for the class 'A'. - '${a.c}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'c' isn't defined for the class 'A'. - '${a.d}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'd' isn't defined for the class 'A'. - ; + ? '${a.a}' + '${a.b}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'b' isn't defined for the class 'D'. + '${a.c}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'c' isn't defined for the class 'D'. + '${a.d}' + : '${a.a}' + '${a.b}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'b' isn't defined for the class 'A'. + '${a.c}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'c' isn't defined for the class 'A'. + '${a.d}'; + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'd' isn't defined for the class 'A'. if (a is B && a is B) { print(a.a);
diff --git a/tests/language/type_promotion/logical_and_runtime_test.dart b/tests/language/type_promotion/logical_and_runtime_test.dart index ce27686..f481746 100644 --- a/tests/language/type_promotion/logical_and_runtime_test.dart +++ b/tests/language/type_promotion/logical_and_runtime_test.dart
@@ -33,15 +33,11 @@ void main() { A a = new E(); var b; - if (a is D && ((a = new D()) != null)) { - - } + if (a is D && ((a = new D()) != null)) {} if (a is D && (b = a.d)) { - a = A(); } if ((((a) is D) && (b = (a).d))) { - a = A(); } if (f(a = A()) && a is D) {
diff --git a/tests/language/type_promotion/more_specific_runtime_1_test.dart b/tests/language/type_promotion/more_specific_runtime_1_test.dart index b6b1f54..15cbc5b 100644 --- a/tests/language/type_promotion/more_specific_runtime_1_test.dart +++ b/tests/language/type_promotion/more_specific_runtime_1_test.dart
@@ -28,9 +28,7 @@ class E<T> extends D<T> { T? e; - E(e) - : this.e = e, - super(e); + E(e) : this.e = e, super(e); } void main() { @@ -49,16 +47,13 @@ } if (a is C) { // No promotion C !<< A. - } B b = new B(); if (b is A) { // No promotion B !<< A. - } if (x is A) { // Promotion A << dynamic. - } } @@ -69,25 +64,18 @@ D d1 = new E<B>(null); if (d1 is E) { // Promotion: E << D. - } if (d1 is E<A>) { // Promotion: E<A> << D. - - - } D<A> d2 = new E<B>(null); if (d2 is E) { // No promotion: E !<< D<A> - } D<A> d3 = new E<B>(new B()); if (d3 is E<B>) { // Promotion: E<B> << D<A> - - } }
diff --git a/tests/language/type_promotion/more_specific_runtime_2_test.dart b/tests/language/type_promotion/more_specific_runtime_2_test.dart index 1ffb593..9871a7c 100644 --- a/tests/language/type_promotion/more_specific_runtime_2_test.dart +++ b/tests/language/type_promotion/more_specific_runtime_2_test.dart
@@ -28,9 +28,7 @@ class E<T> extends D<T> { T? e; - E(e) - : this.e = e, - super(e); + E(e) : this.e = e, super(e); } void main() { @@ -45,11 +43,9 @@ A a = new B(); if (a is B) { // Promotion B << A. - } if (a is C) { // No promotion C !<< A. - } B b = new B(); if (b is A) { @@ -58,7 +54,6 @@ } if (x is A) { // Promotion A << dynamic. - } } @@ -69,25 +64,18 @@ D d1 = new E<B>(null); if (d1 is E) { // Promotion: E << D. - } if (d1 is E<A>) { // Promotion: E<A> << D. - - - } D<A> d2 = new E<B>(null); if (d2 is E) { // No promotion: E !<< D<A> - } D<A> d3 = new E<B>(new B()); if (d3 is E<B>) { // Promotion: E<B> << D<A> - - } }
diff --git a/tests/language/type_promotion/more_specific_runtime_3_test.dart b/tests/language/type_promotion/more_specific_runtime_3_test.dart index de25d35..9c5226c 100644 --- a/tests/language/type_promotion/more_specific_runtime_3_test.dart +++ b/tests/language/type_promotion/more_specific_runtime_3_test.dart
@@ -28,9 +28,7 @@ class E<T> extends D<T> { T? e; - E(e) - : this.e = e, - super(e); + E(e) : this.e = e, super(e); } void main() { @@ -45,20 +43,16 @@ A a = new B(); if (a is B) { // Promotion B << A. - } if (a is C) { // No promotion C !<< A. - } B b = new B(); if (b is A) { // No promotion B !<< A. - } if (x is A) { // Promotion A << dynamic. - } } @@ -73,21 +67,15 @@ } if (d1 is E<A>) { // Promotion: E<A> << D. - - - } D<A> d2 = new E<B>(null); if (d2 is E) { // No promotion: E !<< D<A> - } D<A> d3 = new E<B>(new B()); if (d3 is E<B>) { // Promotion: E<B> << D<A> - - } }
diff --git a/tests/language/type_promotion/more_specific_runtime_4_test.dart b/tests/language/type_promotion/more_specific_runtime_4_test.dart index 355e24c..9af57f8 100644 --- a/tests/language/type_promotion/more_specific_runtime_4_test.dart +++ b/tests/language/type_promotion/more_specific_runtime_4_test.dart
@@ -28,9 +28,7 @@ class E<T> extends D<T> { T? e; - E(e) - : this.e = e, - super(e); + E(e) : this.e = e, super(e); } void main() { @@ -45,20 +43,16 @@ A a = new B(); if (a is B) { // Promotion B << A. - } if (a is C) { // No promotion C !<< A. - } B b = new B(); if (b is A) { // No promotion B !<< A. - } if (x is A) { // Promotion A << dynamic. - } } @@ -69,25 +63,20 @@ D d1 = new E<B>(null); if (d1 is E) { // Promotion: E << D. - } if (d1 is E<A>) { // Promotion: E<A> << D. - x = d1.e; } D<A> d2 = new E<B>(null); if (d2 is E) { // No promotion: E !<< D<A> - } D<A> d3 = new E<B>(new B()); if (d3 is E<B>) { // Promotion: E<B> << D<A> - - } }
diff --git a/tests/language/type_promotion/more_specific_runtime_5_test.dart b/tests/language/type_promotion/more_specific_runtime_5_test.dart index 74539dd..8e16c8e 100644 --- a/tests/language/type_promotion/more_specific_runtime_5_test.dart +++ b/tests/language/type_promotion/more_specific_runtime_5_test.dart
@@ -28,9 +28,7 @@ class E<T> extends D<T> { T? e; - E(e) - : this.e = e, - super(e); + E(e) : this.e = e, super(e); } void main() { @@ -45,20 +43,16 @@ A a = new B(); if (a is B) { // Promotion B << A. - } if (a is C) { // No promotion C !<< A. - } B b = new B(); if (b is A) { // No promotion B !<< A. - } if (x is A) { // Promotion A << dynamic. - } } @@ -69,25 +63,19 @@ D d1 = new E<B>(null); if (d1 is E) { // Promotion: E << D. - } if (d1 is E<A>) { // Promotion: E<A> << D. - - - } D<A> d2 = new E<B>(null); if (d2 is E) { // No promotion: E !<< D<A> - } D<A> d3 = new E<B>(new B()); if (d3 is E<B>) { // Promotion: E<B> << D<A> x = d3.d!.b; - } }
diff --git a/tests/language/type_promotion/more_specific_runtime_6_test.dart b/tests/language/type_promotion/more_specific_runtime_6_test.dart index e9ad755..fe275c1 100644 --- a/tests/language/type_promotion/more_specific_runtime_6_test.dart +++ b/tests/language/type_promotion/more_specific_runtime_6_test.dart
@@ -28,9 +28,7 @@ class E<T> extends D<T> { T? e; - E(e) - : this.e = e, - super(e); + E(e) : this.e = e, super(e); } void main() { @@ -45,20 +43,16 @@ A a = new B(); if (a is B) { // Promotion B << A. - } if (a is C) { // No promotion C !<< A. - } B b = new B(); if (b is A) { // No promotion B !<< A. - } if (x is A) { // Promotion A << dynamic. - } } @@ -69,19 +63,14 @@ D d1 = new E<B>(null); if (d1 is E) { // Promotion: E << D. - } if (d1 is E<A>) { // Promotion: E<A> << D. - - - } D<A> d2 = new E<B>(null); if (d2 is E) { // No promotion: E !<< D<A> - } D<A> d3 = new E<B>(new B());
diff --git a/tests/language/type_promotion/more_specific_runtime_test.dart b/tests/language/type_promotion/more_specific_runtime_test.dart index 3a3e7bf..ce4fcc1 100644 --- a/tests/language/type_promotion/more_specific_runtime_test.dart +++ b/tests/language/type_promotion/more_specific_runtime_test.dart
@@ -28,9 +28,7 @@ class E<T> extends D<T> { T? e; - E(e) - : this.e = e, - super(e); + E(e) : this.e = e, super(e); } void main() { @@ -45,20 +43,16 @@ A a = new B(); if (a is B) { // Promotion B << A. - } if (a is C) { // No promotion C !<< A. - } B b = new B(); if (b is A) { // No promotion B !<< A. - } if (x is A) { // Promotion A << dynamic. - } } @@ -69,25 +63,18 @@ D d1 = new E<B>(null); if (d1 is E) { // Promotion: E << D. - } if (d1 is E<A>) { // Promotion: E<A> << D. - - - } D<A> d2 = new E<B>(null); if (d2 is E) { // No promotion: E !<< D<A> - } D<A> d3 = new E<B>(new B()); if (d3 is E<B>) { // Promotion: E<B> << D<A> - - } }
diff --git a/tests/language/type_promotion/more_specific_test.dart b/tests/language/type_promotion/more_specific_test.dart index cf95b4a..8d7ce51 100644 --- a/tests/language/type_promotion/more_specific_test.dart +++ b/tests/language/type_promotion/more_specific_test.dart
@@ -25,9 +25,7 @@ class E<T> extends D<T> { T? e; - E(e) - : this.e = e, - super(e); + E(e) : this.e = e, super(e); } void main() {
diff --git a/tests/language/type_promotion/multiple_runtime_test.dart b/tests/language/type_promotion/multiple_runtime_test.dart index b465d9b..9520c31 100644 --- a/tests/language/type_promotion/multiple_runtime_test.dart +++ b/tests/language/type_promotion/multiple_runtime_test.dart
@@ -38,66 +38,43 @@ A a2 = new E(); print(a1.a); - - - print(a2.a); - - - if (a1 is B && a2 is C) { print(a1.a); print(a1.b); - - print(a2.a); print(a2.b); print(a2.c); - if (a1 is C && a2 is D) { print(a1.a); print(a1.b); print(a1.c); - print(a2.a); print(a2.b); print(a2.c); - } } var o1 = a1 is B && a2 is C - ? '${a1.a}' - '${a1.b}' - - - '${a2.a}' - '${a2.b}' - '${a2.c}' - - : '${a1.a}' - - - - '${a2.a}' - - - - ; + ? '${a1.a}' + '${a1.b}' + '${a2.a}' + '${a2.b}' + '${a2.c}' + : '${a1.a}' + '${a2.a}'; if (a2 is C && a1 is B && a1 is C && a2 is B && a2 is D) { print(a1.a); print(a1.b); print(a1.c); - print(a2.a); print(a2.b); print(a2.c); - } }
diff --git a/tests/language/type_promotion/multiple_test.dart b/tests/language/type_promotion/multiple_test.dart index 21a2f7d..ea4ece44 100644 --- a/tests/language/type_promotion/multiple_test.dart +++ b/tests/language/type_promotion/multiple_test.dart
@@ -101,50 +101,49 @@ } var o1 = a1 is B && a2 is C - ? '${a1.a}' - '${a1.b}' - '${a1.c}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'c' isn't defined for the class 'B'. - '${a1.d}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'd' isn't defined for the class 'B'. - '${a2.a}' - '${a2.b}' - '${a2.c}' - '${a2.d}' - // ^ + ? '${a1.a}' + '${a1.b}' + '${a1.c}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'c' isn't defined for the class 'B'. + '${a1.d}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'd' isn't defined for the class 'B'. + '${a2.a}' + '${a2.b}' + '${a2.c}' + '${a2.d}' + // ^ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER // [cfe] The getter 'd' isn't defined for the class 'C'. - : '${a1.a}' - '${a1.b}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'b' isn't defined for the class 'A'. - '${a1.c}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'c' isn't defined for the class 'A'. - '${a1.d}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'd' isn't defined for the class 'A'. - '${a2.a}' - '${a2.b}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'b' isn't defined for the class 'A'. - '${a2.c}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'c' isn't defined for the class 'A'. - '${a2.d}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'd' isn't defined for the class 'A'. - ; + : '${a1.a}' + '${a1.b}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'b' isn't defined for the class 'A'. + '${a1.c}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'c' isn't defined for the class 'A'. + '${a1.d}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'd' isn't defined for the class 'A'. + '${a2.a}' + '${a2.b}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'b' isn't defined for the class 'A'. + '${a2.c}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'c' isn't defined for the class 'A'. + '${a2.d}'; + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'd' isn't defined for the class 'A'. if (a2 is C && a1 is B && a1 is C && a2 is B && a2 is D) { print(a1.a);
diff --git a/tests/language/type_promotion/parameter_runtime_test.dart b/tests/language/type_promotion/parameter_runtime_test.dart index 935dd06..f291a86 100644 --- a/tests/language/type_promotion/parameter_runtime_test.dart +++ b/tests/language/type_promotion/parameter_runtime_test.dart
@@ -37,175 +37,114 @@ void test(A a) { print(a.a); - - - if (a is B) { print(a.a); print(a.b); - - if (a is C) { print(a.a); print(a.b); print(a.c); - } print(a.a); print(a.b); - - } if (a is C) { print(a.a); print(a.b); print(a.c); - if (a is B) { print(a.a); print(a.b); print(a.c); - } if (a is D) { print(a.a); print(a.b); print(a.c); - } print(a.a); print(a.b); print(a.c); - } print(a.a); - - - if (a is D) { print(a.a); - print(a.d); } print(a.a); - - - var o1 = a is B - ? '${a.a}' - '${a.b}' - - - : '${a.a}' - - - - ; + ? '${a.a}' + '${a.b}' + : '${a.a}'; var o2 = a is C - ? '${a.a}' - '${a.b}' - '${a.c}' - - : '${a.a}' - - - - ; + ? '${a.a}' + '${a.b}' + '${a.c}' + : '${a.a}'; var o3 = a is D - ? '${a.a}' - - - '${a.d}' - : '${a.a}' - - - - ; + ? '${a.a}' + '${a.d}' + : '${a.a}'; if (a is B && a is B) { print(a.a); print(a.b); - - } if (a is B && a is C) { print(a.a); print(a.b); print(a.c); - } if (a is C && a is B) { print(a.a); print(a.b); print(a.c); - } if (a is C && a is D) { print(a.a); print(a.b); print(a.c); - } if (a is D && a is C) { print(a.a); - print(a.d); } - if (a is D && - a.a == "" - - - && - a.d == "") { + if (a is D && a.a == "" && a.d == "") { print(a.a); - print(a.d); } - if (a.a == "" - - - - && - a is B && - a.a == "" && - a.b == "" - - - && - a is C && - a.a == "" && - a.b == "" && - a.c == "" - - ) { + if (a.a == "" && + a is B && + a.a == "" && + a.b == "" && + a is C && + a.a == "" && + a.b == "" && + a.c == "") { print(a.a); print(a.b); print(a.c); - } if ((a is B)) { print(a.a); print(a.b); - - } if ((a is B && (a) is C) && a is B) { print(a.a); print(a.b); print(a.c); - } }
diff --git a/tests/language/type_promotion/parameter_test.dart b/tests/language/type_promotion/parameter_test.dart index 7ce7119..d2ab058 100644 --- a/tests/language/type_promotion/parameter_test.dart +++ b/tests/language/type_promotion/parameter_test.dart
@@ -158,79 +158,76 @@ // [cfe] The getter 'd' isn't defined for the class 'A'. var o1 = a is B - ? '${a.a}' - '${a.b}' - '${a.c}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'c' isn't defined for the class 'B'. - '${a.d}' - // ^ + ? '${a.a}' + '${a.b}' + '${a.c}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'c' isn't defined for the class 'B'. + '${a.d}' + // ^ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER // [cfe] The getter 'd' isn't defined for the class 'B'. - : '${a.a}' - '${a.b}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'b' isn't defined for the class 'A'. - '${a.c}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'c' isn't defined for the class 'A'. - '${a.d}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'd' isn't defined for the class 'A'. - ; + : '${a.a}' + '${a.b}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'b' isn't defined for the class 'A'. + '${a.c}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'c' isn't defined for the class 'A'. + '${a.d}'; + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'd' isn't defined for the class 'A'. var o2 = a is C - ? '${a.a}' - '${a.b}' - '${a.c}' - '${a.d}' - // ^ + ? '${a.a}' + '${a.b}' + '${a.c}' + '${a.d}' + // ^ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER // [cfe] The getter 'd' isn't defined for the class 'C'. - : '${a.a}' - '${a.b}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'b' isn't defined for the class 'A'. - '${a.c}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'c' isn't defined for the class 'A'. - '${a.d}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'd' isn't defined for the class 'A'. - ; + : '${a.a}' + '${a.b}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'b' isn't defined for the class 'A'. + '${a.c}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'c' isn't defined for the class 'A'. + '${a.d}'; + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'd' isn't defined for the class 'A'. var o3 = a is D - ? '${a.a}' - '${a.b}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'b' isn't defined for the class 'D'. - '${a.c}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'c' isn't defined for the class 'D'. - '${a.d}' - : '${a.a}' - '${a.b}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'b' isn't defined for the class 'A'. - '${a.c}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'c' isn't defined for the class 'A'. - '${a.d}' - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'd' isn't defined for the class 'A'. - ; + ? '${a.a}' + '${a.b}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'b' isn't defined for the class 'D'. + '${a.c}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'c' isn't defined for the class 'D'. + '${a.d}' + : '${a.a}' + '${a.b}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'b' isn't defined for the class 'A'. + '${a.c}' + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'c' isn't defined for the class 'A'. + '${a.d}'; + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'd' isn't defined for the class 'A'. if (a is B && a is B) { print(a.a); @@ -284,13 +281,14 @@ print(a.d); } if (a is D && - a.a == "" - && a.b == "" - // ^ + a.a == "" && + a.b == "" + //^ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER // [cfe] The getter 'b' isn't defined for the class 'D'. - && a.c == "" - // ^ + && + a.c == "" + //^ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER // [cfe] The getter 'c' isn't defined for the class 'D'. && @@ -306,41 +304,44 @@ // [cfe] The getter 'c' isn't defined for the class 'D'. print(a.d); } - if (a.a == "" - && a.b == "" - // ^ + if (a.a == "" && + a.b == "" + //^ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER // [cfe] The getter 'b' isn't defined for the class 'A'. - && a.c == "" - // ^ + && + a.c == "" + //^ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER // [cfe] The getter 'c' isn't defined for the class 'A'. - && a.d == "" - // ^ + && + a.d == "" + //^ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER // [cfe] The getter 'd' isn't defined for the class 'A'. - && - a is B && - a.a == "" && - a.b == "" - && a.c == "" - // ^ + && + a is B && + a.a == "" && + a.b == "" && + a.c == "" + //^ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER // [cfe] The getter 'c' isn't defined for the class 'B'. - && a.d == "" - // ^ + && + a.d == "" + //^ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER // [cfe] The getter 'd' isn't defined for the class 'B'. - && - a is C && - a.a == "" && - a.b == "" && - a.c == "" - && a.d == "" - // ^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER - // [cfe] The getter 'd' isn't defined for the class 'C'. - ) { + && + a is C && + a.a == "" && + a.b == "" && + a.c == "" && + a.d == "" + // ^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'd' isn't defined for the class 'C'. + ) { print(a.a); print(a.b); print(a.c);
diff --git a/tests/language/type_variable/bound_access_runtime_test.dart b/tests/language/type_variable/bound_access_runtime_test.dart index 0c7a123..37bc4e7 100644 --- a/tests/language/type_variable/bound_access_runtime_test.dart +++ b/tests/language/type_variable/bound_access_runtime_test.dart
@@ -21,12 +21,9 @@ NumClass(this.field1, this.field2); num method1() => field1 * field2; - - } main() { new DynamicClass<num, int>(0.5, 2).method(); new NumClass<num, double>(2, 0.5).method1(); - }
diff --git a/tests/language/type_variable/bounds3_runtime_test.dart b/tests/language/type_variable/bounds3_runtime_test.dart index 4dd5843..6d4b851 100644 --- a/tests/language/type_variable/bounds3_runtime_test.dart +++ b/tests/language/type_variable/bounds3_runtime_test.dart
@@ -10,9 +10,7 @@ class A<K extends int> {} class B<X, Y> { - foo(x) { - - } + foo(x) {} } main() {
diff --git a/tests/language/type_variable/bounds4_runtime_test.dart b/tests/language/type_variable/bounds4_runtime_test.dart index eef3b1d..df3befa 100644 --- a/tests/language/type_variable/bounds4_runtime_test.dart +++ b/tests/language/type_variable/bounds4_runtime_test.dart
@@ -7,25 +7,21 @@ // Test instantiation of object with malbounded types. -class A< - T - - > {} +class A<T> {} class B<T> implements A<T> {} -class C< - T - - > implements B<T> {} +class C<T> implements B<T> {} class Class<T> { newA() { new A<T>(); } + newB() { new B<T>(); } + newC() { new C<T>(); }
diff --git a/tests/language/type_variable/bounds4_test.dart b/tests/language/type_variable/bounds4_test.dart index e4d5223..d5c5595 100644 --- a/tests/language/type_variable/bounds4_test.dart +++ b/tests/language/type_variable/bounds4_test.dart
@@ -4,10 +4,7 @@ // Test instantiation of object with malbounded types. -class A< - T - extends num - > {} +class A<T extends num> {} class B<T> implements A<T> {} // ^ @@ -15,10 +12,7 @@ // ^ // [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS -class C< - T - extends num - > implements B<T> {} +class C<T extends num> implements B<T> {} class Class<T> { newA() { @@ -28,9 +22,11 @@ // ^ // [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS } + newB() { new B<T>(); } + newC() { new C<T>(); // ^
diff --git a/tests/language/type_variable/conflict2_runtime_test.dart b/tests/language/type_variable/conflict2_runtime_test.dart index 275f8dc..692477c 100644 --- a/tests/language/type_variable/conflict2_runtime_test.dart +++ b/tests/language/type_variable/conflict2_runtime_test.dart
@@ -16,44 +16,23 @@ // This is equivalent to (T).call(). See issue 19725 - // T is in scope, even in static context. Compile-time error to call this.T(). - // X is not in scope. NoSuchMethodError. - // Class 'C' has no static method 'T': NoSuchMethodError. - // Class '_Type' has no instance method 'call': NoSuchMethodError. - // Runtime type T not accessible from static context. Compile-time error. - // Class '_Type' has no [] operator: NoSuchMethodError. - // Runtime type T not accessible from static context. Compile-time error. - // Class '_Type' has no member m: NoSuchMethodError. - // Runtime type T not accessible from static context. Compile-time error. - } -main() { - - - - - - - - - - -} +main() {}
diff --git a/tests/language/type_variable/conflict_runtime_test.dart b/tests/language/type_variable/conflict_runtime_test.dart index 04623cb..260db5f 100644 --- a/tests/language/type_variable/conflict_runtime_test.dart +++ b/tests/language/type_variable/conflict_runtime_test.dart
@@ -10,37 +10,21 @@ import "package:expect/expect.dart"; -class G1<T> { +class G1<T> {} -} +class G2<T> {} -class G2<T> { +class G3<T> {} -} +class G4<T> {} -class G3<T> { +class G5<T> {} -} +class G6<T> {} -class G4<T> { +class G7<T> {} -} - -class G5<T> { - -} - -class G6<T> { - -} - -class G7<T> { - -} - -class G8<T> { - -} +class G8<T> {} main() { new G1<int>();
diff --git a/tests/language/type_variable/conflict_test.dart b/tests/language/type_variable/conflict_test.dart index cc8e4da..eb21ca4 100644 --- a/tests/language/type_variable/conflict_test.dart +++ b/tests/language/type_variable/conflict_test.dart
@@ -8,64 +8,64 @@ import "package:expect/expect.dart"; class G1<T> { -// ^ -// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER + // ^ + // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER var T; // ^ // [cfe] Conflicts with type variable 'T'. } class G2<T> { -// ^ -// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER + // ^ + // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER get T {} // ^ // [cfe] Conflicts with type variable 'T'. } class G3<T> { -// ^ -// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER + // ^ + // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER T() {} -//^ -// [cfe] Conflicts with type variable 'T'. + // [error column 3] + // [cfe] Conflicts with type variable 'T'. } class G4<T> { -// ^ -// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER + // ^ + // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER static var T; // ^ // [cfe] Conflicts with type variable 'T'. } class G5<T> { -// ^ -// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER + // ^ + // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER static get T {} // ^ // [cfe] Conflicts with type variable 'T'. } class G6<T> { -// ^ -// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER + // ^ + // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER static T() {} // ^ // [cfe] Conflicts with type variable 'T'. } class G7<T> { -// ^ -// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER + // ^ + // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER set T(_) {} // ^ // [cfe] Conflicts with type variable 'T'. } class G8<T> { -// ^ -// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER + // ^ + // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER static set T(x) {} // ^ // [cfe] Conflicts with type variable 'T'.
diff --git a/tests/language/type_variable/function_type_test.dart b/tests/language/type_variable/function_type_test.dart index f2b3602..e3ca252 100644 --- a/tests/language/type_variable/function_type_test.dart +++ b/tests/language/type_variable/function_type_test.dart
@@ -15,6 +15,7 @@ T local() { throw "uncalled"; } + return local; } }
diff --git a/tests/language/type_variable/scope2_test.dart b/tests/language/type_variable/scope2_test.dart index 997ad98..649ef5c 100644 --- a/tests/language/type_variable/scope2_test.dart +++ b/tests/language/type_variable/scope2_test.dart
@@ -9,9 +9,9 @@ class Foo<T> { // T is not in scope for a static method. static Foo<T> m() { - // ^ - // [analyzer] COMPILE_TIME_ERROR.TYPE_PARAMETER_REFERENCED_BY_STATIC - // [cfe] Type variables can't be used in static members. + // ^ + // [analyzer] COMPILE_TIME_ERROR.TYPE_PARAMETER_REFERENCED_BY_STATIC + // [cfe] Type variables can't be used in static members. return new Foo(); } }
diff --git a/tests/language/type_variable/scope3_runtime_test.dart b/tests/language/type_variable/scope3_runtime_test.dart index e75b4a0..eddc9d6 100644 --- a/tests/language/type_variable/scope3_runtime_test.dart +++ b/tests/language/type_variable/scope3_runtime_test.dart
@@ -7,14 +7,8 @@ // Test that a type parameter cannot be repeated. -class Foo< - T - - > {} +class Foo<T> {} main() { - new Foo< - String - - >(); + new Foo<String>(); }
diff --git a/tests/language/type_variable/scope3_test.dart b/tests/language/type_variable/scope3_test.dart index 9a38200..a5ef98c 100644 --- a/tests/language/type_variable/scope3_test.dart +++ b/tests/language/type_variable/scope3_test.dart
@@ -4,17 +4,11 @@ // Test that a type parameter cannot be repeated. -class Foo< - T - , T - //^ - // [analyzer] COMPILE_TIME_ERROR.DUPLICATE_DEFINITION - // [cfe] A type variable can't have the same name as another. - > {} +class Foo<T, T> {} +// ^ +// [analyzer] COMPILE_TIME_ERROR.DUPLICATE_DEFINITION +// [cfe] A type variable can't have the same name as another. main() { - new Foo< - String - , String - >(); + new Foo<String, String>(); }
diff --git a/tests/language/type_variable/scope_runtime_test.dart b/tests/language/type_variable/scope_runtime_test.dart index 7212278..ee5d64d 100644 --- a/tests/language/type_variable/scope_runtime_test.dart +++ b/tests/language/type_variable/scope_runtime_test.dart
@@ -10,12 +10,7 @@ class Foo<T> implements I<T> { Foo() {} - static - - m( - - f) { - + static m(f) { return new Foo<String>(); } @@ -27,16 +22,11 @@ // T is not in scope for a static field. - - static - - get f { + static get f { return new Foo<String>(); } - static void set f( - - value) {} + static void set f(value) {} } abstract class I<T> {
diff --git a/tests/language/type_variable/scope_test.dart b/tests/language/type_variable/scope_test.dart index 8253f03..d3f3475 100644 --- a/tests/language/type_variable/scope_test.dart +++ b/tests/language/type_variable/scope_test.dart
@@ -7,17 +7,13 @@ class Foo<T> implements I<T> { Foo() {} - static - Foo<T> - // ^ + static Foo<T> m(Foo<T> f) { + // ^ // [analyzer] COMPILE_TIME_ERROR.TYPE_PARAMETER_REFERENCED_BY_STATIC // [cfe] Type variables can't be used in static members. - m( - Foo<T> - // ^ - // [analyzer] COMPILE_TIME_ERROR.TYPE_PARAMETER_REFERENCED_BY_STATIC - // [cfe] Type variables can't be used in static members. - f) { + // ^ + // [analyzer] COMPILE_TIME_ERROR.TYPE_PARAMETER_REFERENCED_BY_STATIC + // [cfe] Type variables can't be used in static members. Foo<T> x = new Foo<String>(); // ^ // [analyzer] COMPILE_TIME_ERROR.TYPE_PARAMETER_REFERENCED_BY_STATIC @@ -41,23 +37,19 @@ // [analyzer] COMPILE_TIME_ERROR.TYPE_PARAMETER_REFERENCED_BY_STATIC // [cfe] Type variables can't be used in static members. - static - Foo<T> - // ^ + static Foo<T> get f { + // ^ // [analyzer] COMPILE_TIME_ERROR.TYPE_PARAMETER_REFERENCED_BY_STATIC // [cfe] Type variables can't be used in static members. - get f { return new Foo<String>(); // ^^^^^^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE } - static void set f( - Foo<T> - // ^ - // [analyzer] COMPILE_TIME_ERROR.TYPE_PARAMETER_REFERENCED_BY_STATIC - // [cfe] Type variables can't be used in static members. - value) {} + static void set f(Foo<T> value) {} + // ^ + // [analyzer] COMPILE_TIME_ERROR.TYPE_PARAMETER_REFERENCED_BY_STATIC + // [cfe] Type variables can't be used in static members. } abstract class I<T> {
diff --git a/tests/language/type_variable/static_context_test.dart b/tests/language/type_variable/static_context_test.dart index d3ec20d..fd1bdbb 100644 --- a/tests/language/type_variable/static_context_test.dart +++ b/tests/language/type_variable/static_context_test.dart
@@ -6,9 +6,9 @@ class A<T> { static int method() { - // ^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.BODY_MIGHT_COMPLETE_NORMALLY - // [cfe] A non-null value must be returned since the return type 'int' doesn't allow null. + // ^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.BODY_MIGHT_COMPLETE_NORMALLY + // [cfe] A non-null value must be returned since the return type 'int' doesn't allow null. // error, can't reference a type variable in a static context var foo = new T();
diff --git a/tests/language/typedef/aliased_constructor_tear_off_test.dart b/tests/language/typedef/aliased_constructor_tear_off_test.dart index 21419f2..d979a25 100644 --- a/tests/language/typedef/aliased_constructor_tear_off_test.dart +++ b/tests/language/typedef/aliased_constructor_tear_off_test.dart
@@ -58,14 +58,8 @@ Bounded.new, Bounded.named, ], - const <C<C<int>> Function(C<int>)>[ - Wrapping.new, - Wrapping.named, - ], - const <C<int> Function(int)>[ - Extra.new, - Extra.named, - ] + const <C<C<int>> Function(C<int>)>[Wrapping.new, Wrapping.named], + const <C<int> Function(int)>[Extra.new, Extra.named], ]; Expect.isNotNull(constructors); // Use variable. @@ -104,24 +98,32 @@ // Implicitly instantiated. context<C<int> Function(int)>( - Direct.new..expectStaticType<Exactly<C<int> Function(int)>>()); + Direct.new..expectStaticType<Exactly<C<int> Function(int)>>(), + ); context<C<int> Function(int)>( - Direct.named..expectStaticType<Exactly<C<int> Function(int)>>()); + Direct.named..expectStaticType<Exactly<C<int> Function(int)>>(), + ); context<C<int> Function(int)>( - Bounded.new..expectStaticType<Exactly<C<int> Function(int)>>()); + Bounded.new..expectStaticType<Exactly<C<int> Function(int)>>(), + ); context<C<int> Function(int)>( - Bounded.named..expectStaticType<Exactly<C<int> Function(int)>>()); + Bounded.named..expectStaticType<Exactly<C<int> Function(int)>>(), + ); context<C<C<int>> Function(C<int>)>( - Wrapping.new..expectStaticType<Exactly<C<C<int>> Function(C<int>)>>()); + Wrapping.new..expectStaticType<Exactly<C<C<int>> Function(C<int>)>>(), + ); context<C<C<int>> Function(C<int>)>( - Wrapping.named..expectStaticType<Exactly<C<C<int>> Function(C<int>)>>()); + Wrapping.named..expectStaticType<Exactly<C<C<int>> Function(C<int>)>>(), + ); context<C<int> Function(int)>( - Extra.new..expectStaticType<Exactly<C<int> Function(int)>>()); + Extra.new..expectStaticType<Exactly<C<int> Function(int)>>(), + ); context<C<int> Function(int)>( - Extra.named..expectStaticType<Exactly<C<int> Function(int)>>()); + Extra.named..expectStaticType<Exactly<C<int> Function(int)>>(), + ); // Uninstantiated tear-offs always canonicalize. Expect.identical(Direct.new, Direct.new); @@ -173,22 +175,10 @@ Expect.identical(Swapped<int, String>.named, D<String, int>.named); // Implicit instantiation. - Expect.identical( - context<C<int> Function(int)>(Direct.new), - C<int>.new, - ); - Expect.identical( - context<C<int> Function(int)>(Direct.named), - C<int>.named, - ); - Expect.identical( - context<C<int> Function(int)>(Bounded.new), - C<int>.new, - ); - Expect.identical( - context<C<int> Function(int)>(Bounded.named), - C<int>.named, - ); + Expect.identical(context<C<int> Function(int)>(Direct.new), C<int>.new); + Expect.identical(context<C<int> Function(int)>(Direct.named), C<int>.named); + Expect.identical(context<C<int> Function(int)>(Bounded.new), C<int>.new); + Expect.identical(context<C<int> Function(int)>(Bounded.named), C<int>.named); Expect.identical( context<C<C<int>> Function(C<int>)>(Wrapping.new), C<C<int>>.new,
diff --git a/tests/language/typedef/bad_typedef_runtime_test.dart b/tests/language/typedef/bad_typedef_runtime_test.dart index 274f7e7..6cad476 100644 --- a/tests/language/typedef/bad_typedef_runtime_test.dart +++ b/tests/language/typedef/bad_typedef_runtime_test.dart
@@ -8,10 +8,7 @@ import "package:expect/expect.dart"; -typedef int H( - Function - - x); +typedef int H(Function x); main() { bool b = true;
diff --git a/tests/language/unsorted/additional_interface_adds_optional_args_concrete_test.dart b/tests/language/unsorted/additional_interface_adds_optional_args_concrete_test.dart index 3a89831..4defab0 100644 --- a/tests/language/unsorted/additional_interface_adds_optional_args_concrete_test.dart +++ b/tests/language/unsorted/additional_interface_adds_optional_args_concrete_test.dart
@@ -11,9 +11,9 @@ } class B extends A implements I { -// ^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_IMPLEMENTATION_OVERRIDE -// [cfe] The implementation of 'foo' in the non-abstract class 'B' does not conform to its interface. + // ^ + // [analyzer] COMPILE_TIME_ERROR.INVALID_IMPLEMENTATION_OVERRIDE + // [cfe] The implementation of 'foo' in the non-abstract class 'B' does not conform to its interface. // This class declaration violates soundness, since it allows `new // B().foo(42)`, which would lead to invalid arguments being passed to A.foo.
diff --git a/tests/language/unsorted/assignable_expression_runtime_test.dart b/tests/language/unsorted/assignable_expression_runtime_test.dart index 942cb23..faef7e7 100644 --- a/tests/language/unsorted/assignable_expression_runtime_test.dart +++ b/tests/language/unsorted/assignable_expression_runtime_test.dart
@@ -17,31 +17,15 @@ main() { variable = 0; - - - C.field = 0; - - - variable = [1, 2, 3]; variable[0] = 0; (variable)[0] = 0; - - - C.field = [1, 2, 3]; - - - var a = 0; - - - // Neat palindrome expression. x is assignable, ((x)) is not. - }
diff --git a/tests/language/unsorted/bad_override_runtime_test.dart b/tests/language/unsorted/bad_override_runtime_test.dart index 1e2abe5..f50c0ca 100644 --- a/tests/language/unsorted/bad_override_runtime_test.dart +++ b/tests/language/unsorted/bad_override_runtime_test.dart
@@ -10,7 +10,6 @@ set fisk(x) {} - get hest => null; set hest(x) {} @@ -20,12 +19,7 @@ nullary() {} } -class Hest extends Fisk { - - - - -} +class Hest extends Fisk {} main() { new Fisk();
diff --git a/tests/language/unsorted/bad_override_test.dart b/tests/language/unsorted/bad_override_test.dart index fb4368a..9d29638 100644 --- a/tests/language/unsorted/bad_override_test.dart +++ b/tests/language/unsorted/bad_override_test.dart
@@ -4,16 +4,14 @@ class Fisk { get fisk => null; - static - set fisk(x) {} - // ^^^^ + static set fisk(x) {} + // ^^^^ // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_STATIC_AND_INSTANCE // [cfe] Static property 'fisk' conflicts with instance property of the same name. // [cfe] This static member conflicts with an instance member. - static - get hest => null; - // ^^^^ + static get hest => null; + // ^^^^ // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_STATIC_AND_INSTANCE // [cfe] This static member conflicts with an instance member. set hest(x) {} @@ -32,17 +30,17 @@ // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_STATIC_AND_INSTANCE // [cfe] Can't declare a member that conflicts with an inherited one. field() {} -//^^^^^ -// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_METHOD_AND_FIELD -// [cfe] Can't declare a member that conflicts with an inherited one. + // [error column 3, length 5] + // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_METHOD_AND_FIELD + // [cfe] Can't declare a member that conflicts with an inherited one. var method; // ^^^^^^ // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_FIELD_AND_METHOD // [cfe] Can't declare a member that conflicts with an inherited one. nullary(x) {} -//^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE -// [cfe] The method 'Hest.nullary' has more required arguments than those of overridden method 'Fisk.nullary'. + // [error column 3, length 7] + // [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE + // [cfe] The method 'Hest.nullary' has more required arguments than those of overridden method 'Fisk.nullary'. } main() {
diff --git a/tests/language/unsorted/callable_runtime_test.dart b/tests/language/unsorted/callable_runtime_test.dart index 05fad49..a243026 100644 --- a/tests/language/unsorted/callable_runtime_test.dart +++ b/tests/language/unsorted/callable_runtime_test.dart
@@ -41,9 +41,6 @@ Function g = y; // Should pass checked mode test F f0 = y; // Should pass checked mode test - - - Expect.equals(f(), 42); Expect.equals(g(100), 187);
diff --git a/tests/language/unsorted/check_member_static_runtime_1_test.dart b/tests/language/unsorted/check_member_static_runtime_1_test.dart index b9b4391..a8fa9d5 100644 --- a/tests/language/unsorted/check_member_static_runtime_1_test.dart +++ b/tests/language/unsorted/check_member_static_runtime_1_test.dart
@@ -14,7 +14,6 @@ class C extends B { var a; - } void main() {
diff --git a/tests/language/unsorted/check_member_static_runtime_test.dart b/tests/language/unsorted/check_member_static_runtime_test.dart index db884e0..16952d4 100644 --- a/tests/language/unsorted/check_member_static_runtime_test.dart +++ b/tests/language/unsorted/check_member_static_runtime_test.dart
@@ -12,10 +12,7 @@ class B extends A {} -class C extends B { - - -} +class C extends B {} void main() { new C();
diff --git a/tests/language/unsorted/check_method_override_runtime_test.dart b/tests/language/unsorted/check_method_override_runtime_test.dart index e538a33..63f6316 100644 --- a/tests/language/unsorted/check_method_override_runtime_test.dart +++ b/tests/language/unsorted/check_method_override_runtime_test.dart
@@ -10,10 +10,7 @@ foo(var a, [x, y]) {} } -class C extends A { - - -} +class C extends A {} main() { new A().foo(2);
diff --git a/tests/language/unsorted/check_method_override_test.dart b/tests/language/unsorted/check_method_override_test.dart index a23af64..b4f1e51 100644 --- a/tests/language/unsorted/check_method_override_test.dart +++ b/tests/language/unsorted/check_method_override_test.dart
@@ -9,13 +9,13 @@ class C extends A { f() {} -//^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE -// [cfe] The method 'C.f' has fewer positional arguments than those of overridden method 'A.f'. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE + // [cfe] The method 'C.f' has fewer positional arguments than those of overridden method 'A.f'. foo(var a, [x]) {} -//^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE -// [cfe] The method 'C.foo' has fewer positional arguments than those of overridden method 'A.foo'. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE + // [cfe] The method 'C.foo' has fewer positional arguments than those of overridden method 'A.foo'. } main() {
diff --git a/tests/language/unsorted/checked_method_error_order_test.dart b/tests/language/unsorted/checked_method_error_order_test.dart index 8689027..b9b6ebd 100644 --- a/tests/language/unsorted/checked_method_error_order_test.dart +++ b/tests/language/unsorted/checked_method_error_order_test.dart
@@ -28,7 +28,8 @@ var m = e.toString(); return m.contains("is not a subtype of type 'int'") || m.contains( - "Expected a value of type 'int', but got one of type 'String'"); + "Expected a value of type 'int', but got one of type 'String'", + ); } return false; }); @@ -37,7 +38,8 @@ var m = e.toString(); return m.contains("is not a subtype of type 'int?'") || m.contains( - "Expected a value of type 'int?', but got one of type 'String'"); + "Expected a value of type 'int?', but got one of type 'String'", + ); } return false; });
diff --git a/tests/language/unsorted/core_type_check_test.dart b/tests/language/unsorted/core_type_check_test.dart index 79ea2c5..e5ce54d 100644 --- a/tests/language/unsorted/core_type_check_test.dart +++ b/tests/language/unsorted/core_type_check_test.dart
@@ -38,7 +38,7 @@ new A(), new B(), new C(), - new D() + new D(), ]; check(things[inscrutable(0)], false, false); // List
diff --git a/tests/language/unsorted/cyclic_type2_test.dart b/tests/language/unsorted/cyclic_type2_test.dart index 5a4d120..071ab49 100644 --- a/tests/language/unsorted/cyclic_type2_test.dart +++ b/tests/language/unsorted/cyclic_type2_test.dart
@@ -23,16 +23,28 @@ main() { var d = new Derived1<Derived1, Derived2>(); Expect.equals( - "Derived1<Derived1<dynamic, dynamic>, Derived2<dynamic, dynamic>>", - d.u.toString()); + "Derived1<Derived1<dynamic, dynamic>, Derived2<dynamic, dynamic>>", + d.u.toString(), + ); Expect.equals( - "Derived1<Derived2<Derived2<dynamic, dynamic>, " - "Derived1<dynamic, dynamic>>, Derived2<dynamic, dynamic>>", - d.v.toString()); + "Derived1<Derived2<Derived2<dynamic, dynamic>, " + "Derived1<dynamic, dynamic>>, Derived2<dynamic, dynamic>>", + d.v.toString(), + ); Expect.isTrue(d is Derived1<Derived1, Derived2>); Expect.isFalse(d is Derived1<Derived1, Derived1>); - Expect.isTrue(d is Base<Derived1<Derived1, Derived2>, - Derived1<Derived2<Derived2, Derived1>, Derived2>>); - Expect.isFalse(d is Base<Derived1<Derived1, Derived2>, - Derived1<Derived2<Derived2, Derived2>, Derived2>>); + Expect.isTrue( + d + is Base< + Derived1<Derived1, Derived2>, + Derived1<Derived2<Derived2, Derived1>, Derived2> + >, + ); + Expect.isFalse( + d + is Base< + Derived1<Derived1, Derived2>, + Derived1<Derived2<Derived2, Derived2>, Derived2> + >, + ); }
diff --git a/tests/language/unsorted/default_implementation_test.dart b/tests/language/unsorted/default_implementation_test.dart index c40a1ac2..ef17ef5 100644 --- a/tests/language/unsorted/default_implementation_test.dart +++ b/tests/language/unsorted/default_implementation_test.dart
@@ -13,9 +13,7 @@ } class PointImplementation implements Point { - const PointImplementation(int x, int y) - : this.x = x, - this.y = y; + const PointImplementation(int x, int y) : this.x = x, this.y = y; final int x; final int y; }
diff --git a/tests/language/unsorted/disassemble_test.dart b/tests/language/unsorted/disassemble_test.dart index 2618d1e..e58e6a2 100644 --- a/tests/language/unsorted/disassemble_test.dart +++ b/tests/language/unsorted/disassemble_test.dart
@@ -26,7 +26,10 @@ return; // No disassembler in product mode. } - final result = await runBinary(Platform.executable, - ['--disassemble', Platform.script.toFilePath(), '--child']); + final result = await runBinary(Platform.executable, [ + '--disassemble', + Platform.script.toFilePath(), + '--child', + ]); Expect.equals(0, result.exitCode); }
diff --git a/tests/language/unsorted/efficient_length_warning_test.dart b/tests/language/unsorted/efficient_length_warning_test.dart index 5ba2c6f..a3d25df 100644 --- a/tests/language/unsorted/efficient_length_warning_test.dart +++ b/tests/language/unsorted/efficient_length_warning_test.dart
@@ -9,9 +9,11 @@ // This should no longer cause a warning because the least-upper-bound // of List<int> and Set<int> is Object. // The LUB is now EfficientLengthIterable and it extends Iterable. - var x = (new Random().nextBool() // Unpredictable condition. - ? <int>[1] - : new Set<int>.from([1])) - .first; + var x = + (new Random() + .nextBool() // Unpredictable condition. + ? <int>[1] + : new Set<int>.from([1])) + .first; if (x != 1) throw "Wat?"; }
diff --git a/tests/language/unsorted/emit_const_fields_test.dart b/tests/language/unsorted/emit_const_fields_test.dart index 8264c50..946ff69 100644 --- a/tests/language/unsorted/emit_const_fields_test.dart +++ b/tests/language/unsorted/emit_const_fields_test.dart
@@ -11,7 +11,7 @@ static const EARTH = const { "Sector": "ZZ9 Plural Z Alpha", "Status": const ["Scheduled for demolition", "1978-03-08"], - "Description": "Mostly harmless" + "Description": "Mostly harmless", }; }
diff --git a/tests/language/unsorted/external_runtime_test.dart b/tests/language/unsorted/external_runtime_test.dart index e51282c..d6cecb2 100644 --- a/tests/language/unsorted/external_runtime_test.dart +++ b/tests/language/unsorted/external_runtime_test.dart
@@ -16,39 +16,9 @@ Foo() : x = 0; // fields can't be declared external - - - - - - - - - - - - - } - - - main() { // Ensure Foo class is compiled. var foo = new Foo(); - - - - - - - - - - - - - - }
diff --git a/tests/language/unsorted/fauxverride_runtime_test.dart b/tests/language/unsorted/fauxverride_runtime_test.dart index d5ae11a..e1b6f42 100644 --- a/tests/language/unsorted/fauxverride_runtime_test.dart +++ b/tests/language/unsorted/fauxverride_runtime_test.dart
@@ -82,7 +82,6 @@ // name. Furthermore, according to 7.7 a static variable induces an // implicit getter function (a static method). - foo() => 'foo'; }
diff --git a/tests/language/unsorted/fauxverride_test.dart b/tests/language/unsorted/fauxverride_test.dart index d5fc6b1..f186e67 100644 --- a/tests/language/unsorted/fauxverride_test.dart +++ b/tests/language/unsorted/fauxverride_test.dart
@@ -67,11 +67,10 @@ // According to 7.1, instance methods include those of the // superclass, and according to 7, it is a compile-time to have an // instance method and static method with the same name. - static - instanceMethod() => m(); -//^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_STATIC_AND_INSTANCE -// [cfe] Can't declare a member that conflicts with an inherited one. + static instanceMethod() => m(); + // ^^^^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_STATIC_AND_INSTANCE + // [cfe] Can't declare a member that conflicts with an inherited one. // According to 7.7, static variables are not inherited. static i2() => m();
diff --git a/tests/language/unsorted/guess_cid_test.dart b/tests/language/unsorted/guess_cid_test.dart index 9d62a8a..e3d2816 100644 --- a/tests/language/unsorted/guess_cid_test.dart +++ b/tests/language/unsorted/guess_cid_test.dart
@@ -71,10 +71,14 @@ // Foul up IC data in integer's unary minus. var y = -0x80000000; Expect.equals( - (0x7fffffffffffffff + 2) * 10, testLoop(10, 0x7fffffffffffffff)); + (0x7fffffffffffffff + 2) * 10, + testLoop(10, 0x7fffffffffffffff), + ); // Second time no deoptimization can occur, since runtime feedback has been collected. Expect.equals( - (0x7fffffffffffffff + 2) * 10, testLoop(10, 0x7fffffffffffffff)); + (0x7fffffffffffffff + 2) * 10, + testLoop(10, 0x7fffffffffffffff), + ); } testLoop(N, int x) {
diff --git a/tests/language/unsorted/illegal_invocation_runtime_test.dart b/tests/language/unsorted/illegal_invocation_runtime_test.dart index 41f46b0..937f879 100644 --- a/tests/language/unsorted/illegal_invocation_runtime_test.dart +++ b/tests/language/unsorted/illegal_invocation_runtime_test.dart
@@ -9,10 +9,7 @@ // Test for issue 1393. Invoking a library prefix name caused an internal error // in dartc. - - main() { // probably what the user meant was foo.foo(), but the qualifier refers // to the library prefix, not the method defined within the library. - }
diff --git a/tests/language/unsorted/illegal_invocation_test.dart b/tests/language/unsorted/illegal_invocation_test.dart index 7af9479..6b9ab09 100644 --- a/tests/language/unsorted/illegal_invocation_test.dart +++ b/tests/language/unsorted/illegal_invocation_test.dart
@@ -12,7 +12,7 @@ // probably what the user meant was foo.foo(), but the qualifier refers // to the library prefix, not the method defined within the library. foo(); -//^^^ -// [analyzer] COMPILE_TIME_ERROR.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT -// [cfe] A prefix can't be used as an expression. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT + // [cfe] A prefix can't be used as an expression. }
diff --git a/tests/language/unsorted/inference_enum_list_test.dart b/tests/language/unsorted/inference_enum_list_test.dart index 0502272..9c5bf5f 100644 --- a/tests/language/unsorted/inference_enum_list_test.dart +++ b/tests/language/unsorted/inference_enum_list_test.dart
@@ -3,7 +3,9 @@ // BSD-style license that can be found in the LICENSE file. enum E1 { a, b } + enum E2 { a, b } + enum E3 { a, b } var v = [E1.a, E2.b];
diff --git a/tests/language/unsorted/inv_cse_licm_test.dart b/tests/language/unsorted/inv_cse_licm_test.dart index 78b73ed..751d4a8 100644 --- a/tests/language/unsorted/inv_cse_licm_test.dart +++ b/tests/language/unsorted/inv_cse_licm_test.dart
@@ -225,16 +225,22 @@ Expect.throwsTypeError(() { cse1(null, 1); }); - Expect.throws(() { - cse1(x, 0); - }, (e) { - return e is RangeError; - }); - Expect.throws(() { - cse1(x, 1); - }, (e) { - return e is RangeError; - }); + Expect.throws( + () { + cse1(x, 0); + }, + (e) { + return e is RangeError; + }, + ); + Expect.throws( + () { + cse1(x, 1); + }, + (e) { + return e is RangeError; + }, + ); Expect.equals(1, cse1(a, 0)); Expect.equals(137, cse1(a, 16)); @@ -244,16 +250,22 @@ Expect.throwsTypeError(() { cse2(null, 1); }); - Expect.throws(() { - cse2(x, 0); - }, (e) { - return e is RangeError; - }); - Expect.throws(() { - cse2(x, 1); - }, (e) { - return e is RangeError; - }); + Expect.throws( + () { + cse2(x, 0); + }, + (e) { + return e is RangeError; + }, + ); + Expect.throws( + () { + cse2(x, 1); + }, + (e) { + return e is RangeError; + }, + ); Expect.equals(1, cse2(a, 0)); Expect.equals(1, cse2(a, 16)); Expect.equals(2, a[0]); @@ -266,22 +278,28 @@ licm1(null, 1); }); Expect.equals(0, licm1(x, 0)); - Expect.throws(() { - licm1(x, 1); - }, (e) { - return e is RangeError; - }); + Expect.throws( + () { + licm1(x, 1); + }, + (e) { + return e is RangeError; + }, + ); Expect.equals(0, licm1(a, 0)); Expect.equals(94, licm1(a, 16)); Expect.throwsTypeError(() { licm2(null); }); - Expect.throws(() { - licm2(x); - }, (e) { - return e is RangeError; - }); + Expect.throws( + () { + licm2(x); + }, + (e) { + return e is RangeError; + }, + ); Expect.equals(94, licm2(a)); Expect.equals(0, licm3(null, false)); @@ -289,11 +307,14 @@ licm3(null, true); }); Expect.equals(0, licm3(x, false)); - Expect.throws(() { - licm3(x, true); - }, (e) { - return e is RangeError; - }); + Expect.throws( + () { + licm3(x, true); + }, + (e) { + return e is RangeError; + }, + ); Expect.equals(0, licm3(a, false)); Expect.equals(94, licm3(a, true)); @@ -302,11 +323,14 @@ licm3_brk(null, false); }); Expect.equals(0, licm3_brk(x, true)); - Expect.throws(() { - licm3_brk(x, false); - }, (e) { - return e is RangeError; - }); + Expect.throws( + () { + licm3_brk(x, false); + }, + (e) { + return e is RangeError; + }, + ); Expect.equals(0, licm3_brk(a, true)); Expect.equals(94, licm3_brk(a, false)); @@ -315,11 +339,14 @@ licm4(null); }); Expect.equals(1, global); - Expect.throws(() { - licm4(x); - }, (e) { - return e is RangeError; - }); + Expect.throws( + () { + licm4(x); + }, + (e) { + return e is RangeError; + }, + ); Expect.equals(2, global); Expect.equals(94, licm4(a)); Expect.equals(18, global); @@ -327,11 +354,14 @@ Expect.throwsTypeError(() { licm5(null); }); - Expect.throws(() { - licm5(x); - }, (e) { - return e is RangeError; - }); + Expect.throws( + () { + licm5(x); + }, + (e) { + return e is RangeError; + }, + ); Expect.equals(3, licm5(a)); Expect.throwsTypeError(() { @@ -340,16 +370,22 @@ Expect.throwsTypeError(() { licm6(null, 1); }); - Expect.throws(() { - licm6(x, 0); - }, (e) { - return e is RangeError; - }); - Expect.throws(() { - licm6(x, 1); - }, (e) { - return e is RangeError; - }); + Expect.throws( + () { + licm6(x, 0); + }, + (e) { + return e is RangeError; + }, + ); + Expect.throws( + () { + licm6(x, 1); + }, + (e) { + return e is RangeError; + }, + ); Expect.equals(4, licm6(a, 0)); Expect.equals(94, licm6(a, 16)); @@ -359,16 +395,22 @@ Expect.throwsTypeError(() { licm7(null, 1); }); - Expect.throws(() { - licm7(x, 0); - }, (e) { - return e is RangeError; - }); - Expect.throws(() { - licm7(x, 1); - }, (e) { - return e is RangeError; - }); + Expect.throws( + () { + licm7(x, 0); + }, + (e) { + return e is RangeError; + }, + ); + Expect.throws( + () { + licm7(x, 1); + }, + (e) { + return e is RangeError; + }, + ); Expect.equals(4, licm7(a, 0)); Expect.equals(94, licm7(a, 16)); @@ -377,22 +419,28 @@ licm8(null, 1); }); Expect.equals(0, licm8(x, 0)); - Expect.throws(() { - licm8(x, 1); - }, (e) { - return e is RangeError; - }); + Expect.throws( + () { + licm8(x, 1); + }, + (e) { + return e is RangeError; + }, + ); Expect.equals(0, licm8(a, 0)); Expect.equals(94, licm8(a, 16)); Expect.throwsTypeError(() { licm9(null); }); - Expect.throws(() { - licm9(x); - }, (e) { - return e is RangeError; - }); + Expect.throws( + () { + licm9(x); + }, + (e) { + return e is RangeError; + }, + ); Expect.equals(94, licm9(a)); Expect.equals(0, licm10(null, false)); @@ -400,11 +448,14 @@ licm10(null, true); }); Expect.equals(0, licm10(x, false)); - Expect.throws(() { - licm10(x, true); - }, (e) { - return e is RangeError; - }); + Expect.throws( + () { + licm10(x, true); + }, + (e) { + return e is RangeError; + }, + ); Expect.equals(0, licm10(a, false)); Expect.equals(94, licm10(a, true)); @@ -413,22 +464,28 @@ licm10_brk(null, false); }); Expect.equals(0, licm10_brk(x, true)); - Expect.throws(() { - licm10_brk(x, false); - }, (e) { - return e is RangeError; - }); + Expect.throws( + () { + licm10_brk(x, false); + }, + (e) { + return e is RangeError; + }, + ); Expect.equals(0, licm10_brk(a, true)); Expect.equals(94, licm10_brk(a, false)); Expect.throwsTypeError(() { licm11(null); }); - Expect.throws(() { - licm11(x); - }, (e) { - return e is RangeError; - }); + Expect.throws( + () { + licm11(x); + }, + (e) { + return e is RangeError; + }, + ); Expect.equals(4, licm11(a)); global = 0; @@ -441,11 +498,14 @@ licm12(null); }); Expect.equals(15, global); - Expect.throws(() { - licm12(x); - }, (e) { - return e is RangeError; - }); + Expect.throws( + () { + licm12(x); + }, + (e) { + return e is RangeError; + }, + ); Expect.equals(14, global); Expect.equals(28, licm12(a)); Expect.equals(8, global);
diff --git a/tests/language/unsorted/invalid_cast_runtime_1_test.dart b/tests/language/unsorted/invalid_cast_runtime_1_test.dart index 179a739..cde2691 100644 --- a/tests/language/unsorted/invalid_cast_runtime_1_test.dart +++ b/tests/language/unsorted/invalid_cast_runtime_1_test.dart
@@ -21,16 +21,7 @@ test() { void localFunction(int i) {} - - - D e = new C.fact() as D; - - - - - - } main() {}
diff --git a/tests/language/unsorted/invalid_cast_runtime_2_test.dart b/tests/language/unsorted/invalid_cast_runtime_2_test.dart index 7f6120c..c010346 100644 --- a/tests/language/unsorted/invalid_cast_runtime_2_test.dart +++ b/tests/language/unsorted/invalid_cast_runtime_2_test.dart
@@ -21,16 +21,7 @@ test() { void localFunction(int i) {} - - - - D f = new C.fact2() as D; - - - - - } main() {}
diff --git a/tests/language/unsorted/invalid_cast_runtime_test.dart b/tests/language/unsorted/invalid_cast_runtime_test.dart index 44f5851..28b0326 100644 --- a/tests/language/unsorted/invalid_cast_runtime_test.dart +++ b/tests/language/unsorted/invalid_cast_runtime_test.dart
@@ -20,17 +20,6 @@ test() { void localFunction(int i) {} - - - - - - - - - - - } main() {}
diff --git a/tests/language/unsorted/invalid_type_argument_count_runtime_test.dart b/tests/language/unsorted/invalid_type_argument_count_runtime_test.dart index a0959a8..a39b1c0 100644 --- a/tests/language/unsorted/invalid_type_argument_count_runtime_test.dart +++ b/tests/language/unsorted/invalid_type_argument_count_runtime_test.dart
@@ -7,14 +7,12 @@ // Test top level field. dynamic // Formatter shouldn't join this line. - - x1 = 42; +x1 = 42; class Foo { // Test class member. dynamic // Formatter shouldn't join this line. - - x2 = 42; + x2 = 42; Foo() { print(x2); @@ -28,8 +26,7 @@ // Test local variable. dynamic // Formatter shouldn't join this line. - - x3 = 42; + x3 = 42; print(x3); foo(42); @@ -37,8 +34,8 @@ // Test parameter. void foo( - dynamic // Formatter shouldn't join this line. - - x4) { + dynamic // Formatter shouldn't join this line. + x4, +) { print(x4); }
diff --git a/tests/language/unsorted/invalid_type_argument_count_test.dart b/tests/language/unsorted/invalid_type_argument_count_test.dart index cf9619d..5607dd9 100644 --- a/tests/language/unsorted/invalid_type_argument_count_test.dart +++ b/tests/language/unsorted/invalid_type_argument_count_test.dart
@@ -4,16 +4,16 @@ // Test top level field. dynamic<int> x1 = 42; -// [error line 6, column 1, length 12] +// [error column 1, length 12] // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS // [cfe] Expected 0 type arguments. class Foo { // Test class member. dynamic<int> x2 = 42; -// [error line 13, column 3, length 12] -// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS -// [cfe] Expected 0 type arguments. + // [error column 3, length 12] + // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS + // [cfe] Expected 0 type arguments. Foo() { print(x2); @@ -27,9 +27,9 @@ // Test local variable. dynamic<int> x3 = 42; -// [error line 29, column 3, length 12] -// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS -// [cfe] Expected 0 type arguments. + // [error column 3, length 12] + // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS + // [cfe] Expected 0 type arguments. print(x3); foo(42); @@ -37,8 +37,8 @@ // Test parameter. void foo(dynamic<int> x4) { -// [error line 39, column 10, length 12] -// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS -// [cfe] Expected 0 type arguments. + // ^^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS + // [cfe] Expected 0 type arguments. print(x4); }
diff --git a/tests/language/unsorted/invocation_mirror_test.dart b/tests/language/unsorted/invocation_mirror_test.dart index c02d33d..b20267c 100644 --- a/tests/language/unsorted/invocation_mirror_test.dart +++ b/tests/language/unsorted/invocation_mirror_test.dart
@@ -57,8 +57,13 @@ * Call without optionals for getters, with only positional for setters, * and with both optionals for everything else. */ -testInvocationMirror(Invocation im, Symbol name, - [List? positional, List? named, List? typeArgs]) { +testInvocationMirror( + Invocation im, + Symbol name, [ + List? positional, + List? named, + List? typeArgs, +]) { Expect.isTrue(im is Invocation, "is Invocation"); Expect.equals(name, im.memberName, "name"); if (named == null) { @@ -75,7 +80,10 @@ Expect.isFalse(im.isGetter, "$name:isGetter"); Expect.equals(1, im.positionalArguments.length, "$name:#positional"); Expect.equals( - positional[0], im.positionalArguments[0], "$name:positional[0]"); + positional[0], + im.positionalArguments[0], + "$name:positional[0]", + ); Expect.equals(0, im.namedArguments.length, "$name:#named"); return; } @@ -88,10 +96,15 @@ Expect.listEquals(positional!, im.positionalArguments); Expect.equals( - namedArguments.length, im.namedArguments.length, "$name:#named"); + namedArguments.length, + im.namedArguments.length, + "$name:#named", + ); namedArguments.forEach((k, v) { Expect.isTrue( - im.namedArguments.containsKey(k), "$name:?namedArguments[$k]"); + im.namedArguments.containsKey(k), + "$name:?namedArguments[$k]", + ); Expect.equals(v, im.namedArguments[k], "$name:namedArguments[$k]"); }); var imTypeArgs = (im as dynamic).typeArguments as List<Type>; @@ -108,10 +121,16 @@ testInvocationMirror((n..bar = 42).last, const Symbol('bar='), [42]); testInvocationMirror(n.bar(), const Symbol('bar'), [], []); testInvocationMirror(n.bar(42), const Symbol('bar'), [42], []); + testInvocationMirror(n.bar(x: 42), const Symbol('bar'), [], [ + const Symbol("x"), + 42, + ]); testInvocationMirror( - n.bar(x: 42), const Symbol('bar'), [], [const Symbol("x"), 42]); - testInvocationMirror( - n.bar(37, x: 42), const Symbol('bar'), [37], [const Symbol("x"), 42]); + n.bar(37, x: 42), + const Symbol('bar'), + [37], + [const Symbol("x"), 42], + ); // Missing operator access. testInvocationMirror(n + 4, const Symbol('+'), [4], []); @@ -123,40 +142,70 @@ // Calling as function when it's not. testInvocationMirror(n(), const Symbol('call'), [], []); testInvocationMirror(n(42), const Symbol('call'), [42], []); + testInvocationMirror(n(x: 42), const Symbol('call'), [], [ + const Symbol("x"), + 42, + ]); testInvocationMirror( - n(x: 42), const Symbol('call'), [], [const Symbol("x"), 42]); - testInvocationMirror( - n(37, x: 42), const Symbol('call'), [37], [const Symbol("x"), 42]); + n(37, x: 42), + const Symbol('call'), + [37], + [const Symbol("x"), 42], + ); // Calling with arguments not matching existing call method. testInvocationMirror(c(), const Symbol('call'), [], []); testInvocationMirror(c(37, 42), const Symbol('call'), [37, 42], []); + testInvocationMirror(c(x: 42), const Symbol('call'), [], [ + const Symbol("x"), + 42, + ]); testInvocationMirror( - c(x: 42), const Symbol('call'), [], [const Symbol("x"), 42]); - testInvocationMirror( - c(37, x: 42), const Symbol('call'), [37], [const Symbol("x"), 42]); + c(37, x: 42), + const Symbol('call'), + [37], + [const Symbol("x"), 42], + ); // Wrong arguments to existing function. testInvocationMirror(n.flif(), const Symbol("flif"), [], []); testInvocationMirror(n.flif(37, 42), const Symbol("flif"), [37, 42], []); + testInvocationMirror(n.flif(x: 42), const Symbol("flif"), [], [ + const Symbol("x"), + 42, + ]); testInvocationMirror( - n.flif(x: 42), const Symbol("flif"), [], [const Symbol("x"), 42]); - testInvocationMirror( - n.flif(37, x: 42), const Symbol("flif"), [37], [const Symbol("x"), 42]); + n.flif(37, x: 42), + const Symbol("flif"), + [37], + [const Symbol("x"), 42], + ); testInvocationMirror((n..flif = 42).last, const Symbol("flif="), [42]); testInvocationMirror(n.flaf(37, 42), const Symbol("flaf"), [37, 42], []); + testInvocationMirror(n.flaf(x: 42), const Symbol("flaf"), [], [ + const Symbol("x"), + 42, + ]); testInvocationMirror( - n.flaf(x: 42), const Symbol("flaf"), [], [const Symbol("x"), 42]); - testInvocationMirror( - n.flaf(37, x: 42), const Symbol("flaf"), [37], [const Symbol("x"), 42]); + n.flaf(37, x: 42), + const Symbol("flaf"), + [37], + [const Symbol("x"), 42], + ); testInvocationMirror((n..flaf = 42).last, const Symbol("flaf="), [42]); testInvocationMirror(n.flof(37, 42), const Symbol("flof"), [37, 42], []); + testInvocationMirror(n.flof(x: 42), const Symbol("flof"), [], [ + const Symbol("x"), + 42, + ]); testInvocationMirror( - n.flof(x: 42), const Symbol("flof"), [], [const Symbol("x"), 42]); - testInvocationMirror( - n.flof(37, y: 42), const Symbol("flof"), [37], [const Symbol("y"), 42]); + n.flof(37, y: 42), + const Symbol("flof"), + [37], + [const Symbol("y"), 42], + ); testInvocationMirror((n..flof = 42).last, const Symbol("flof="), [42]); // Reading works. @@ -174,12 +223,22 @@ // Calling noSuchMethod itself, badly. testInvocationMirror(n.noSuchMethod(), const Symbol("noSuchMethod"), [], []); + testInvocationMirror(n.noSuchMethod(37, 42), const Symbol("noSuchMethod"), [ + 37, + 42, + ], []); testInvocationMirror( - n.noSuchMethod(37, 42), const Symbol("noSuchMethod"), [37, 42], []); - testInvocationMirror(n.noSuchMethod(37, x: 42), const Symbol("noSuchMethod"), - [37], [const Symbol("x"), 42]); - testInvocationMirror(n.noSuchMethod(x: 42), const Symbol("noSuchMethod"), [], - [const Symbol("x"), 42]); + n.noSuchMethod(37, x: 42), + const Symbol("noSuchMethod"), + [37], + [const Symbol("x"), 42], + ); + testInvocationMirror( + n.noSuchMethod(x: 42), + const Symbol("noSuchMethod"), + [], + [const Symbol("x"), 42], + ); // Closurizing a method means that calling it badly will not hit the // original receivers noSuchMethod, only the one inherited from Object @@ -199,58 +258,103 @@ // Missing property/method access. dynamic self = this; testInvocationMirror(self.bar, const Symbol('bar')); - testInvocationMirror(() { - self.bar = 42; - return last; - }(), const Symbol('bar='), [42]); + testInvocationMirror( + () { + self.bar = 42; + return last; + }(), + const Symbol('bar='), + [42], + ); testInvocationMirror(self.bar(), const Symbol('bar'), [], []); testInvocationMirror(self.bar(42), const Symbol('bar'), [42], []); + testInvocationMirror(self.bar(x: 42), const Symbol('bar'), [], [ + const Symbol("x"), + 42, + ]); testInvocationMirror( - self.bar(x: 42), const Symbol('bar'), [], [const Symbol("x"), 42]); - testInvocationMirror(self.bar(37, x: 42), const Symbol('bar'), [37], - [const Symbol("x"), 42]); + self.bar(37, x: 42), + const Symbol('bar'), + [37], + [const Symbol("x"), 42], + ); // Missing operator access. testInvocationMirror(self + 4, const Symbol('+'), [4], []); testInvocationMirror(self - 4, const Symbol('-'), [4], []); testInvocationMirror(-self, const Symbol('unary-'), [], []); testInvocationMirror(self[42], const Symbol('[]'), [42], []); - testInvocationMirror(() { - self[37] = 42; - return last; - }(), const Symbol('[]='), [37, 42], []); + testInvocationMirror( + () { + self[37] = 42; + return last; + }(), + const Symbol('[]='), + [37, 42], + [], + ); // Wrong arguments to existing function. testInvocationMirror(self.flif(), const Symbol("flif"), [], []); testInvocationMirror(self.flif(37, 42), const Symbol("flif"), [37, 42], []); + testInvocationMirror(self.flif(x: 42), const Symbol("flif"), [], [ + const Symbol("x"), + 42, + ]); testInvocationMirror( - self.flif(x: 42), const Symbol("flif"), [], [const Symbol("x"), 42]); - testInvocationMirror(self.flif(37, x: 42), const Symbol("flif"), [37], - [const Symbol("x"), 42]); - testInvocationMirror(() { - self.flif = 42; - return last; - }(), const Symbol("flif="), [42]); + self.flif(37, x: 42), + const Symbol("flif"), + [37], + [const Symbol("x"), 42], + ); + testInvocationMirror( + () { + self.flif = 42; + return last; + }(), + const Symbol("flif="), + [42], + ); testInvocationMirror(self.flaf(37, 42), const Symbol("flaf"), [37, 42], []); + testInvocationMirror(self.flaf(x: 42), const Symbol("flaf"), [], [ + const Symbol("x"), + 42, + ]); testInvocationMirror( - self.flaf(x: 42), const Symbol("flaf"), [], [const Symbol("x"), 42]); - testInvocationMirror(self.flaf(37, x: 42), const Symbol("flaf"), [37], - [const Symbol("x"), 42]); - testInvocationMirror(() { - self.flaf = 42; - return last; - }(), const Symbol("flaf="), [42]); + self.flaf(37, x: 42), + const Symbol("flaf"), + [37], + [const Symbol("x"), 42], + ); + testInvocationMirror( + () { + self.flaf = 42; + return last; + }(), + const Symbol("flaf="), + [42], + ); testInvocationMirror(self.flof(37, 42), const Symbol("flof"), [37, 42], []); + testInvocationMirror(self.flof(x: 42), const Symbol("flof"), [], [ + const Symbol("x"), + 42, + ]); testInvocationMirror( - self.flof(x: 42), const Symbol("flof"), [], [const Symbol("x"), 42]); - testInvocationMirror(self.flof(37, y: 42), const Symbol("flof"), [37], - [const Symbol("y"), 42]); - testInvocationMirror(() { - self.flof = 42; - return last; - }(), const Symbol("flof="), [42]); + self.flof(37, y: 42), + const Symbol("flof"), + [37], + [const Symbol("y"), 42], + ); + testInvocationMirror( + () { + self.flof = 42; + return last; + }(), + const Symbol("flof="), + [42], + ); // Reading works. Expect.isTrue(self.flif is Function); @@ -258,28 +362,56 @@ Expect.isTrue(self.flof is Function); // Writing to read-only fields. - testInvocationMirror(() { - self.wut = 42; - return last; - }(), const Symbol("wut="), [42]); - testInvocationMirror(() { - self.plif = 42; - return last; - }(), const Symbol("plif="), [42]); - testInvocationMirror(() { - self.plaf = 42; - return last; - }(), const Symbol("plaf="), [42]); + testInvocationMirror( + () { + self.wut = 42; + return last; + }(), + const Symbol("wut="), + [42], + ); + testInvocationMirror( + () { + self.plif = 42; + return last; + }(), + const Symbol("plif="), + [42], + ); + testInvocationMirror( + () { + self.plaf = 42; + return last; + }(), + const Symbol("plaf="), + [42], + ); // Calling noSuchMethod itself, badly. testInvocationMirror( - self.noSuchMethod(), const Symbol("noSuchMethod"), [], []); + self.noSuchMethod(), + const Symbol("noSuchMethod"), + [], + [], + ); testInvocationMirror( - self.noSuchMethod(37, 42), const Symbol("noSuchMethod"), [37, 42], []); - testInvocationMirror(self.noSuchMethod(37, x: 42), - const Symbol("noSuchMethod"), [37], [const Symbol("x"), 42]); - testInvocationMirror(self.noSuchMethod(x: 42), const Symbol("noSuchMethod"), - [], [const Symbol("x"), 42]); + self.noSuchMethod(37, 42), + const Symbol("noSuchMethod"), + [37, 42], + [], + ); + testInvocationMirror( + self.noSuchMethod(37, x: 42), + const Symbol("noSuchMethod"), + [37], + [const Symbol("x"), 42], + ); + testInvocationMirror( + self.noSuchMethod(x: 42), + const Symbol("noSuchMethod"), + [], + [const Symbol("x"), 42], + ); // Closurizing a method means that calling it badly will not hit the // original receivers noSuchMethod, only the one inherited from Object @@ -307,7 +439,9 @@ Expect.throwsNoSuchMethodError(() => o.toString(42)); Expect.throwsNoSuchMethodError(() => o.toString(x: 37)); Expect.throwsNoSuchMethodError(() => o.hashCode = 42); - Expect.throwsNoSuchMethodError(() => (n.flif)()); // Extracted method has no noSuchMethod. + Expect.throwsNoSuchMethodError( + () => (n.flif)(), + ); // Extracted method has no noSuchMethod. } main() {
diff --git a/tests/language/unsorted/large_implicit_getter_test.dart b/tests/language/unsorted/large_implicit_getter_test.dart index 624a063..f07009c 100644 --- a/tests/language/unsorted/large_implicit_getter_test.dart +++ b/tests/language/unsorted/large_implicit_getter_test.dart
@@ -1365,7 +1365,7 @@ [2364.4759911280776, 3677.1700224365045], [2463.7759911280773, 3842.7700224365044], [2463.7759911280773, 4008.3700224365043], - [2364.4759911280776, 3842.7700224365044] + [2364.4759911280776, 3842.7700224365044], ]; main() {
diff --git a/tests/language/unsorted/larger_implicit_getter_test.dart b/tests/language/unsorted/larger_implicit_getter_test.dart index cfadc00..9956ec2 100644 --- a/tests/language/unsorted/larger_implicit_getter_test.dart +++ b/tests/language/unsorted/larger_implicit_getter_test.dart
@@ -4088,7 +4088,7 @@ [2364.4759911280776, 3677.1700224365045], [2463.7759911280773, 3842.7700224365044], [2463.7759911280773, 4008.3700224365043], - [2364.4759911280776, 3842.7700224365044] + [2364.4759911280776, 3842.7700224365044], ]; @pragma('dart2js:assumeDynamic')
diff --git a/tests/language/unsorted/many_named_arguments_test.dart b/tests/language/unsorted/many_named_arguments_test.dart index ed239a4..2aecb8d 100644 --- a/tests/language/unsorted/many_named_arguments_test.dart +++ b/tests/language/unsorted/many_named_arguments_test.dart
@@ -5,33 +5,34 @@ import 'package:expect/expect.dart'; class Fisk { - method( - {a = 'a', - b = 'b', - c = 'c', - d = 'd', - e = 'e', - f = 'f', - g = 'g', - h = 'h', - i = 'i', - j = 'j', - k = 'k', - l = 'l', - m = 'm', - n = 'n', - o = 'o', - p = 'p', - q = 'q', - r = 'r', - s = 's', - t = 't', - u = 'u', - v = 'v', - w = 'w', - x = 'x', - y = 'y', - z = 'z'}) { + method({ + a = 'a', + b = 'b', + c = 'c', + d = 'd', + e = 'e', + f = 'f', + g = 'g', + h = 'h', + i = 'i', + j = 'j', + k = 'k', + l = 'l', + m = 'm', + n = 'n', + o = 'o', + p = 'p', + q = 'q', + r = 'r', + s = 's', + t = 't', + u = 'u', + v = 'v', + w = 'w', + x = 'x', + y = 'y', + z = 'z', + }) { return 'a: $a, ' 'b: $b, ' 'c: $c, ' @@ -66,39 +67,44 @@ var namedArguments = new Map<Symbol, dynamic>(); namedArguments[const Symbol('a')] = 'a'; Expect.stringEquals( - EXPECTED_RESULT, Function.apply(method, [], namedArguments)); + EXPECTED_RESULT, + Function.apply(method, [], namedArguments), + ); Expect.stringEquals( - EXPECTED_RESULT, - new Fisk().method( - a: 'a', - b: 'b', - c: 'c', - d: 'd', - e: 'e', - f: 'f', - g: 'g', - h: 'h', - i: 'i', - j: 'j', - k: 'k', - l: 'l', - m: 'm', - n: 'n', - o: 'o', - p: 'p', - q: 'q', - r: 'r', - s: 's', - t: 't', - u: 'u', - v: 'v', - w: 'w', - x: 'x', - y: 'y', - z: 'z')); + EXPECTED_RESULT, + new Fisk().method( + a: 'a', + b: 'b', + c: 'c', + d: 'd', + e: 'e', + f: 'f', + g: 'g', + h: 'h', + i: 'i', + j: 'j', + k: 'k', + l: 'l', + m: 'm', + n: 'n', + o: 'o', + p: 'p', + q: 'q', + r: 'r', + s: 's', + t: 't', + u: 'u', + v: 'v', + w: 'w', + x: 'x', + y: 'y', + z: 'z', + ), + ); } -const String EXPECTED_RESULT = 'a: a, ' +const String EXPECTED_RESULT = + 'a: a, ' 'b: b, ' 'c: c, ' 'd: d, '
diff --git a/tests/language/unsorted/third_test.dart b/tests/language/unsorted/third_test.dart index 3df66d3..bf3cb13 100644 --- a/tests/language/unsorted/third_test.dart +++ b/tests/language/unsorted/third_test.dart
@@ -13,9 +13,7 @@ return s; } - A(x, y) - : a = x, - super(y) {} + A(x, y) : a = x, super(y) {} value() { return a + b + foo();
diff --git a/tests/language/unsorted/typed_selector2_test.dart b/tests/language/unsorted/typed_selector2_test.dart index 463b376..9eb4938 100644 --- a/tests/language/unsorted/typed_selector2_test.dart +++ b/tests/language/unsorted/typed_selector2_test.dart
@@ -4,7 +4,8 @@ // Test for dart2js to handle a typed selector with a typedef as a // receiver type. -getComparator() => (a, b) => 42; +getComparator() => + (a, b) => 42; class A { foo() => 42;
diff --git a/tests/language/unsorted/unevaluated_field_test.dart b/tests/language/unsorted/unevaluated_field_test.dart index f33fbb5..a79b273 100644 --- a/tests/language/unsorted/unevaluated_field_test.dart +++ b/tests/language/unsorted/unevaluated_field_test.dart
@@ -6,13 +6,15 @@ import "package:expect/expect.dart"; -const int? gx = - const bool.hasEnvironment("x") ? const int.fromEnvironment("x") : null; +const int? gx = const bool.hasEnvironment("x") + ? const int.fromEnvironment("x") + : null; class A { final int? x = gx; - final int? y = - const bool.hasEnvironment("y") ? const int.fromEnvironment("y") : null; + final int? y = const bool.hasEnvironment("y") + ? const int.fromEnvironment("y") + : null; const A(); }
diff --git a/tests/language/value_class/has_non_final_field_error_test.dart b/tests/language/value_class/has_non_final_field_error_test.dart index d0ed8e5..9a81564 100644 --- a/tests/language/value_class/has_non_final_field_error_test.dart +++ b/tests/language/value_class/has_non_final_field_error_test.dart
@@ -9,6 +9,7 @@ @valueClass class Animal { int numberOfLegs; - //^ - // [cfe] unspecified + // ^^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD + // [cfe] Field 'numberOfLegs' should be initialized because its type 'int' doesn't allow null. }
diff --git a/tests/language/variable/bad_initializer1_runtime_test.dart b/tests/language/variable/bad_initializer1_runtime_test.dart index e97f36b..768e640 100644 --- a/tests/language/variable/bad_initializer1_runtime_test.dart +++ b/tests/language/variable/bad_initializer1_runtime_test.dart
@@ -9,15 +9,8 @@ main() { const elems = const [ - const [ - 1, - 2.0, - true, - false, - 0xffffffffff, - - ], + const [1, 2.0, true, false, 0xffffffffff], "a", - "b" + "b", ]; }
diff --git a/tests/language/variable/bad_initializer1_test.dart b/tests/language/variable/bad_initializer1_test.dart index 57cd57c..fe08dc2 100644 --- a/tests/language/variable/bad_initializer1_test.dart +++ b/tests/language/variable/bad_initializer1_test.dart
@@ -6,21 +6,21 @@ main() { const elems = const [ - // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.RECURSIVE_COMPILE_TIME_CONSTANT + // ^^^^^ + // [analyzer] COMPILE_TIME_ERROR.RECURSIVE_COMPILE_TIME_CONSTANT const [ 1, 2.0, true, false, 0xffffffffff, - elems -// ^^^^^ -// [analyzer] COMPILE_TIME_ERROR.REFERENCED_BEFORE_DECLARATION -// [cfe] Local variable 'elems' can't be referenced before it is declared. -// [cfe] Undefined name 'elems'. + elems, + // [error column 7, length 5] + // [analyzer] COMPILE_TIME_ERROR.REFERENCED_BEFORE_DECLARATION + // [cfe] Local variable 'elems' can't be referenced before it is declared. + // [cfe] Undefined name 'elems'. ], "a", - "b" + "b", ]; }
diff --git a/tests/language/variable/bad_initializer2_runtime_test.dart b/tests/language/variable/bad_initializer2_runtime_test.dart index 5163cf0..10ae956 100644 --- a/tests/language/variable/bad_initializer2_runtime_test.dart +++ b/tests/language/variable/bad_initializer2_runtime_test.dart
@@ -13,9 +13,7 @@ if (n == 0) { return 0; } else { - return 1 - - ; + return 1; } }; foo(1);
diff --git a/tests/language/variable/bad_initializer2_test.dart b/tests/language/variable/bad_initializer2_test.dart index d377181..3ce1084 100644 --- a/tests/language/variable/bad_initializer2_test.dart +++ b/tests/language/variable/bad_initializer2_test.dart
@@ -10,16 +10,14 @@ if (n == 0) { return 0; } else { - return 1 - + foo(n - 1) - //^^^ - // [analyzer] COMPILE_TIME_ERROR.REFERENCED_BEFORE_DECLARATION - // [cfe] Local variable 'foo' can't be referenced before it is declared. - // [cfe] Method not found: 'foo'. - ; + return 1 + foo(n - 1); + // ^^^ + // [analyzer] COMPILE_TIME_ERROR.REFERENCED_BEFORE_DECLARATION + // [cfe] Local variable 'foo' can't be referenced before it is declared. + // [cfe] Method not found: 'foo'. } }; foo(1); -//^ -// [cfe] Method not found: 'foo'. + // [error column 3] + // [cfe] Method not found: 'foo'. }
diff --git a/tests/language/variable/duplicate_field_with_initializer_runtime_test.dart b/tests/language/variable/duplicate_field_with_initializer_runtime_test.dart index ab879a6..5c60d2c 100644 --- a/tests/language/variable/duplicate_field_with_initializer_runtime_test.dart +++ b/tests/language/variable/duplicate_field_with_initializer_runtime_test.dart
@@ -7,7 +7,6 @@ class Repeated { var a = '', b = 'Something'; - } main() {}
diff --git a/tests/language/variable/illegal_initializer_runtime_test.dart b/tests/language/variable/illegal_initializer_runtime_test.dart index fecbeba..7e9ed69 100644 --- a/tests/language/variable/illegal_initializer_runtime_test.dart +++ b/tests/language/variable/illegal_initializer_runtime_test.dart
@@ -11,35 +11,15 @@ } class B extends A { - B.c1() - : super.foo - - () - - ; + B.c1() : super.foo(); B.foo(); - B.c2() - : this.foo + B.c2() : this.foo(); - () - - ; - - B.c3() - : super - - () - - ; + B.c3() : super(); B(); - B.c4() - : this - - () - - ; + B.c4() : this(); } main() {
diff --git a/tests/language/variable/illegal_initializer_test.dart b/tests/language/variable/illegal_initializer_test.dart index 3b8b083..73ac547 100644 --- a/tests/language/variable/illegal_initializer_test.dart +++ b/tests/language/variable/illegal_initializer_test.dart
@@ -17,12 +17,11 @@ B.c2() : this.foo; // ^^^^ // [analyzer] COMPILE_TIME_ERROR.INVALID_REFERENCE_TO_THIS - // [cfe] Can't access 'this' in a field initializer. - // ^^^^ // [analyzer] SYNTACTIC_ERROR.MISSING_ASSIGNMENT_IN_INITIALIZER - // [cfe] Expected an assignment after the field name. // ^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.INITIALIZER_FOR_NON_EXISTENT_FIELD + // [cfe] Can't access 'this' in a field initializer. + // [cfe] Expected an assignment after the field name. // ^^^ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER @@ -39,15 +38,12 @@ B.c4() : this; // ^^^^ // [analyzer] COMPILE_TIME_ERROR.INITIALIZER_FOR_NON_EXISTENT_FIELD - // [cfe] Expected an assignment after the field name. - // ^^^^ // [analyzer] COMPILE_TIME_ERROR.INVALID_REFERENCE_TO_THIS - // ^^^^ // [analyzer] SYNTACTIC_ERROR.MISSING_ASSIGNMENT_IN_INITIALIZER - // [error line 39, column 16, length 0] - // [cfe] Expected '.' before this. + // [cfe] Expected an assignment after the field name. // ^ // [analyzer] SYNTACTIC_ERROR.EXPECTED_TOKEN + // [cfe] Expected '.' before this. // [cfe] Expected an identifier, but got ''. }
diff --git a/tests/language/variable/initializer_super_last_runtime_test.dart b/tests/language/variable/initializer_super_last_runtime_test.dart index a23f5c2..0fce414 100644 --- a/tests/language/variable/initializer_super_last_runtime_test.dart +++ b/tests/language/variable/initializer_super_last_runtime_test.dart
@@ -17,119 +17,67 @@ class C extends S { final int x; - C.cc01(int x) - : x = x, - super(); - C.cc02(int x) - : x = x, - super.named(); + C.cc01(int x) : x = x, super(); + C.cc02(int x) : x = x, super.named(); C.cc03(this.x) : super(); C.cc04(this.x) : super.named(); - C.cc05(int x) - : x = x, - assert(x == x), - super(); - C.cc06(int x) - : x = x, - assert(x == x), - super.named(); - C.cc07(this.x) - : assert(x == x), - super(); - C.cc08(this.x) - : assert(x == x), - super.named(); + C.cc05(int x) : x = x, assert(x == x), super(); + C.cc06(int x) : x = x, assert(x == x), super.named(); + C.cc07(this.x) : assert(x == x), super(); + C.cc08(this.x) : assert(x == x), super.named(); C.cc09(int x) - : // - - x = x; + : // + x = x; C.cc10(int x) - : // - - x = x; + : // + x = x; C.cc11(this.x) - : // - - assert(x == x); + : // + assert(x == x); C.cc12(this.x) - : // - - assert(x == x); + : // + assert(x == x); C.cc13(int x) - : // - - x = x, - assert(x == x); + : // + x = x, + assert(x == x); C.cc14(int x) - : // + : // + x = x, + assert(x == x); + C.cc15(int x) : x = x, assert(x == x); + C.cc16(int x) : x = x, assert(x == x); - x = x, - assert(x == x); - C.cc15(int x) - : x = x, - - assert(x == x); - C.cc16(int x) - : x = x, - - assert(x == x); - - const C.cc17(int x) - : x = x, - super(); - const C.cc18(int x) - : x = x, - super.named(); + const C.cc17(int x) : x = x, super(); + const C.cc18(int x) : x = x, super.named(); const C.cc19(this.x) : super(); const C.cc20(this.x) : super.named(); - const C.cc21(int x) - : x = x, - assert(x == x), - super(); - const C.cc22(int x) - : x = x, - assert(x == x), - super.named(); - const C.cc23(this.x) - : assert(x == x), - super(); - const C.cc24(this.x) - : assert(x == x), - super.named(); + const C.cc21(int x) : x = x, assert(x == x), super(); + const C.cc22(int x) : x = x, assert(x == x), super.named(); + const C.cc23(this.x) : assert(x == x), super(); + const C.cc24(this.x) : assert(x == x), super.named(); const C.cc25(int x) - : // - - x = x; + : // + x = x; const C.cc26(int x) - : // - - x = x; + : // + x = x; const C.cc27(this.x) - : // - - assert(x == x); + : // + assert(x == x); const C.cc28(this.x) - : // - - assert(x == x); + : // + assert(x == x); const C.cc29(int x) - : // - - x = x, - assert(x == x); + : // + x = x, + assert(x == x); const C.cc30(int x) - : // - - x = x, - assert(x == x); - const C.cc31(int x) - : x = x, - - assert(x == x); - const C.cc32(int x) - : x = x, - - assert(x == x); + : // + x = x, + assert(x == x); + const C.cc31(int x) : x = x, assert(x == x); + const C.cc32(int x) : x = x, assert(x == x); } main() {
diff --git a/tests/language/variable/initializer_super_last_test.dart b/tests/language/variable/initializer_super_last_test.dart index edcd645..1b363b3 100644 --- a/tests/language/variable/initializer_super_last_test.dart +++ b/tests/language/variable/initializer_super_last_test.dart
@@ -14,191 +14,151 @@ class C extends S { final int x; - C.cc01(int x) - : x = x, - super(); - C.cc02(int x) - : x = x, - super.named(); + C.cc01(int x) : x = x, super(); + C.cc02(int x) : x = x, super.named(); C.cc03(this.x) : super(); C.cc04(this.x) : super.named(); - C.cc05(int x) - : x = x, - assert(x == x), - super(); - C.cc06(int x) - : x = x, - assert(x == x), - super.named(); - C.cc07(this.x) - : assert(x == x), - super(); - C.cc08(this.x) - : assert(x == x), - super.named(); + C.cc05(int x) : x = x, assert(x == x), super(); + C.cc06(int x) : x = x, assert(x == x), super.named(); + C.cc07(this.x) : assert(x == x), super(); + C.cc08(this.x) : assert(x == x), super.named(); C.cc09(int x) - : // - super(), -// ^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST - x = x; - //^ - // [cfe] Can't have initializers after 'super'. + : super(), + //^^^^^ + // [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST + x = x; + // ^ + // [cfe] Can't have initializers after 'super'. C.cc10(int x) - : // - super.named(), -// ^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST - x = x; - //^ - // [cfe] Can't have initializers after 'super'. + : super.named(), + //^^^^^ + // [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST + x = x; + // ^ + // [cfe] Can't have initializers after 'super'. C.cc11(this.x) - : // - super(), -// ^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST - assert(x == x); -// ^ -// [cfe] Can't have initializers after 'super'. + : super(), + //^^^^^ + // [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST + assert(x == x); + // ^ + // [cfe] Can't have initializers after 'super'. C.cc12(this.x) - : // - super.named(), -// ^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST - assert(x == x); -// ^ -// [cfe] Can't have initializers after 'super'. + : super.named(), + //^^^^^ + // [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST + assert(x == x); + // ^ + // [cfe] Can't have initializers after 'super'. C.cc13(int x) - : // - super(), -// ^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST - x = x, - //^ - // [cfe] Can't have initializers after 'super'. - assert(x == x); -// ^ -// [cfe] Can't have initializers after 'super'. + : super(), + //^^^^^ + // [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST + x = x, + //^ + // [cfe] Can't have initializers after 'super'. + assert(x == x); + // ^ + // [cfe] Can't have initializers after 'super'. C.cc14(int x) - : // - super.named(), -// ^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST - x = x, - //^ - // [cfe] Can't have initializers after 'super'. - assert(x == x); -// ^ -// [cfe] Can't have initializers after 'super'. + : super.named(), + //^^^^^ + // [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST + x = x, + //^ + // [cfe] Can't have initializers after 'super'. + assert(x == x); + // ^ + // [cfe] Can't have initializers after 'super'. C.cc15(int x) - : x = x, - super(), -// ^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST - assert(x == x); -// ^ -// [cfe] Can't have initializers after 'super'. + : x = x, + super(), + // [error column 7, length 5] + // [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST + assert(x == x); + // ^ + // [cfe] Can't have initializers after 'super'. C.cc16(int x) - : x = x, - super.named(), -// ^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST - assert(x == x); -// ^ -// [cfe] Can't have initializers after 'super'. + : x = x, + super.named(), + // [error column 7, length 5] + // [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST + assert(x == x); + // ^ + // [cfe] Can't have initializers after 'super'. - const C.cc17(int x) - : x = x, - super(); - const C.cc18(int x) - : x = x, - super.named(); + const C.cc17(int x) : x = x, super(); + const C.cc18(int x) : x = x, super.named(); const C.cc19(this.x) : super(); const C.cc20(this.x) : super.named(); - const C.cc21(int x) - : x = x, - assert(x == x), - super(); - const C.cc22(int x) - : x = x, - assert(x == x), - super.named(); - const C.cc23(this.x) - : assert(x == x), - super(); - const C.cc24(this.x) - : assert(x == x), - super.named(); + const C.cc21(int x) : x = x, assert(x == x), super(); + const C.cc22(int x) : x = x, assert(x == x), super.named(); + const C.cc23(this.x) : assert(x == x), super(); + const C.cc24(this.x) : assert(x == x), super.named(); const C.cc25(int x) - : // - super(), -// ^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST - x = x; - //^ - // [cfe] Can't have initializers after 'super'. + : super(), + //^^^^^ + // [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST + x = x; + // ^ + // [cfe] Can't have initializers after 'super'. const C.cc26(int x) - : // - super.named(), -// ^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST - x = x; - //^ - // [cfe] Can't have initializers after 'super'. + : super.named(), + //^^^^^ + // [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST + x = x; + // ^ + // [cfe] Can't have initializers after 'super'. const C.cc27(this.x) - : // - super(), -// ^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST - assert(x == x); -// ^ -// [cfe] Can't have initializers after 'super'. + : super(), + //^^^^^ + // [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST + assert(x == x); + // ^ + // [cfe] Can't have initializers after 'super'. const C.cc28(this.x) - : // - super.named(), -// ^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST - assert(x == x); -// ^ -// [cfe] Can't have initializers after 'super'. + : super.named(), + //^^^^^ + // [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST + assert(x == x); + // ^ + // [cfe] Can't have initializers after 'super'. const C.cc29(int x) - : // - super(), -// ^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST - x = x, - //^ - // [cfe] Can't have initializers after 'super'. - assert(x == x); -// ^ -// [cfe] Can't have initializers after 'super'. + : super(), + //^^^^^ + // [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST + x = x, + //^ + // [cfe] Can't have initializers after 'super'. + assert(x == x); + // ^ + // [cfe] Can't have initializers after 'super'. const C.cc30(int x) - : // - super.named(), -// ^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST - x = x, - //^ - // [cfe] Can't have initializers after 'super'. - assert(x == x); -// ^ -// [cfe] Can't have initializers after 'super'. + : super.named(), + //^^^^^ + // [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST + x = x, + //^ + // [cfe] Can't have initializers after 'super'. + assert(x == x); + // ^ + // [cfe] Can't have initializers after 'super'. const C.cc31(int x) - : x = x, - super(), -// ^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST - assert(x == x); -// ^ -// [cfe] Can't have initializers after 'super'. + : x = x, + super(), + // [error column 7, length 5] + // [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST + assert(x == x); + // ^ + // [cfe] Can't have initializers after 'super'. const C.cc32(int x) - : x = x, - super.named(), -// ^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST - assert(x == x); -// ^ -// [cfe] Can't have initializers after 'super'. + : x = x, + super.named(), + // [error column 7, length 5] + // [analyzer] COMPILE_TIME_ERROR.SUPER_INVOCATION_NOT_LAST + assert(x == x); + // ^ + // [cfe] Can't have initializers after 'super'. } main() {
diff --git a/tests/language/variable/ref_before_declaration_runtime_test.dart b/tests/language/variable/ref_before_declaration_runtime_test.dart index 84949d0..7a003bf 100644 --- a/tests/language/variable/ref_before_declaration_runtime_test.dart +++ b/tests/language/variable/ref_before_declaration_runtime_test.dart
@@ -21,7 +21,6 @@ void test1() { use(f); // Refers to instance field f. - } void test2() { @@ -29,7 +28,6 @@ use(f); // Refers to instance field f. } - if (true) { var f = 1; // ok, shadows outer f and instance field f. } @@ -40,19 +38,10 @@ use(x); // Refers to top-level x. use(y); // Refers to top-level y. } - - } void test4() { - void Q() { - - } - - - - - + void Q() {} } test() { @@ -65,12 +54,10 @@ void testTypeRef() { String s = 'Can vegetarians eat animal crackers?'; - } void testLibPrefix() { var pie = math.pi; - } void noErrorsExpected() {
diff --git a/tests/language/variable/ref_before_declaration_test.dart b/tests/language/variable/ref_before_declaration_test.dart index dea2a5a..9173482 100644 --- a/tests/language/variable/ref_before_declaration_test.dart +++ b/tests/language/variable/ref_before_declaration_test.dart
@@ -57,20 +57,23 @@ void test4() { void Q() { P(); // Refers to non-existing top-level function P -// ^ -// [analyzer] COMPILE_TIME_ERROR.REFERENCED_BEFORE_DECLARATION -// [cfe] Local variable 'P' can't be referenced before it is declared. -// [cfe] The method 'P' isn't defined for the class 'C'. + // [error column 7, length 1] + // [analyzer] COMPILE_TIME_ERROR.REFERENCED_BEFORE_DECLARATION + // [cfe] Local variable 'P' can't be referenced before it is declared. + // [cfe] The method 'P' isn't defined for the class 'C'. } + void P() { Q(); } - Function f = () {x = f;}; - // ^ - // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT - // [analyzer] COMPILE_TIME_ERROR.REFERENCED_BEFORE_DECLARATION - // [cfe] Local variable 'f' can't be referenced before it is declared. + Function f = () { + x = f; + // ^ + // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT + // [analyzer] COMPILE_TIME_ERROR.REFERENCED_BEFORE_DECLARATION + // [cfe] Local variable 'f' can't be referenced before it is declared. + }; } test() { @@ -83,9 +86,9 @@ void testTypeRef() { String s = 'Can vegetarians eat animal crackers?'; -//^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.REFERENCED_BEFORE_DECLARATION -// [cfe] Local variable 'String' can't be referenced before it is declared. + // [error column 3, length 6] + // [analyzer] COMPILE_TIME_ERROR.REFERENCED_BEFORE_DECLARATION + // [cfe] Local variable 'String' can't be referenced before it is declared. var String = "I distinctly remember forgetting that."; }
diff --git a/tests/language/variance/variance_in_field_error_test.dart b/tests/language/variance/variance_in_field_error_test.dart index 172c2e29..6e19b9d 100644 --- a/tests/language/variance/variance_in_field_error_test.dart +++ b/tests/language/variance/variance_in_field_error_test.dart
@@ -84,8 +84,7 @@ var a; // ^ // [analyzer] COMPILE_TIME_ERROR.NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD - // [cfe] Can't use 'in' type variable 'T' in an 'out' position. - // ^ // [analyzer] COMPILE_TIME_ERROR.WRONG_TYPE_PARAMETER_VARIANCE_POSITION + // [cfe] Can't use 'in' type variable 'T' in an 'out' position. // [cfe] Field 'a' should be initialized because its type 'T' doesn't allow null. }
diff --git a/tests/language/variance/variance_in_inference_error_test.dart b/tests/language/variance/variance_in_inference_error_test.dart index a4c67b7..7341f1c 100644 --- a/tests/language/variance/variance_in_inference_error_test.dart +++ b/tests/language/variance/variance_in_inference_error_test.dart
@@ -47,41 +47,41 @@ inferCovContra(Covariant<int>(), Contravariant<String>()); //^^^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER -// [cfe] unspecified // ^^^^^^^^^^^^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE +// [cfe] The argument type 'Contravariant<String>' can't be assigned to the parameter type 'Contravariant<int>'. // String <: T <: int is not a valid constraint. inferCovContra(Covariant<String>(), Contravariant<int>()); //^^^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER -// [cfe] unspecified // ^^^^^^^^^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE +// [cfe] The argument type 'Contravariant<int>' can't be assigned to the parameter type 'Contravariant<String>'. // Middle <: T <: Lower is not a valid constraint inferCovContra(Covariant<Middle>(), Contravariant<Lower>()); //^^^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER -// [cfe] unspecified // ^^^^^^^^^^^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE +// [cfe] The argument type 'Contravariant<Lower>' can't be assigned to the parameter type 'Contravariant<Middle>'. // Upper <: T <: Lower is not a valid constraint inferCovContra(Covariant<Upper>(), Contravariant<Lower>()); //^^^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER -// [cfe] unspecified // ^^^^^^^^^^^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE +// [cfe] The argument type 'Contravariant<Lower>' can't be assigned to the parameter type 'Contravariant<Upper>'. // Upper <: T <: Middle is not a valid constraint inferCovContra(Covariant<Upper>(), Contravariant<Middle>()); //^^^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER -// [cfe] unspecified // ^^^^^^^^^^^^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE +// [cfe] The argument type 'Contravariant<Middle>' can't be assigned to the parameter type 'Contravariant<Upper>'. // Inference for Contrabound(...) produces Lower <: T <: Upper. // Since T is contravariant, we choose Upper as the solution.
diff --git a/tests/language/variance/variance_in_subclass_error_test.dart b/tests/language/variance/variance_in_subclass_error_test.dart index 123b3e5..76e4468 100644 --- a/tests/language/variance/variance_in_subclass_error_test.dart +++ b/tests/language/variance/variance_in_subclass_error_test.dart
@@ -136,9 +136,7 @@ class T<in X> = Invariant<X> with MInvariant<X>; // ^ // [cfe] Can't use 'in' type variable 'X' in an 'inout' position in supertype 'Invariant'. -// ^ // [cfe] Can't use 'in' type variable 'X' in an 'inout' position in supertype 'MInvariant'. // ^ // [analyzer] COMPILE_TIME_ERROR.WRONG_EXPLICIT_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE -// ^ // [analyzer] COMPILE_TIME_ERROR.WRONG_EXPLICIT_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE
diff --git a/tests/language/vm/allocate_overflow_array_test.dart b/tests/language/vm/allocate_overflow_array_test.dart index 3e66f67..52585a4 100644 --- a/tests/language/vm/allocate_overflow_array_test.dart +++ b/tests/language/vm/allocate_overflow_array_test.dart
@@ -26,7 +26,9 @@ Expect.throws(() { var array = new List<dynamic>.filled( - interestingLength ~/ elementLength, null); + interestingLength ~/ elementLength, + null, + ); print(array.first); }, (e) => e is OutOfMemoryError); }
diff --git a/tests/language/vm/allocation_sinking_arrays_test.dart b/tests/language/vm/allocation_sinking_arrays_test.dart index c6dc0a5..db856d3 100644 --- a/tests/language/vm/allocation_sinking_arrays_test.dart +++ b/tests/language/vm/allocation_sinking_arrays_test.dart
@@ -85,7 +85,8 @@ final num doDeopt = (i < 120 ? 1 : 2.0); final result = foo(3.0, doDeopt); Expect.equals( - "v1: [1,hi], v2: [1.0,2.0], v3: [4.0,5.0], v4: [11.0, 12.0], sum: 9.0", - result); + "v1: [1,hi], v2: [1.0,2.0], v3: [4.0,5.0], v4: [11.0, 12.0], sum: 9.0", + result, + ); } }
diff --git a/tests/language/vm/allocation_sinking_vm_test.dart b/tests/language/vm/allocation_sinking_vm_test.dart index f96fcbd..c9bd90f 100644 --- a/tests/language/vm/allocation_sinking_vm_test.dart +++ b/tests/language/vm/allocation_sinking_vm_test.dart
@@ -195,14 +195,15 @@ for (var i = 0; i < 100; i++) f(0.1); Expect.equals(0.1, f(0.1)); Expect.equals( - 0.1, - f(0.1, (val) { - Expect.isTrue(val is CompoundA); - Expect.isTrue(val.b is CompoundB); - Expect.isTrue(val.b.c is CompoundC); - Expect.isNull(val.b.c.root); - Expect.equals(0.1, val.b.c.d); - })); + 0.1, + f(0.1, (val) { + Expect.isTrue(val is CompoundA); + Expect.isTrue(val.b is CompoundB); + Expect.isTrue(val.b.c is CompoundC); + Expect.isNull(val.b.c.root); + Expect.equals(0.1, val.b.c.d); + }), + ); } testCompound2() { @@ -218,14 +219,15 @@ for (var i = 0; i < 100; i++) f(0.1); Expect.equals(0.1, f(0.1)); Expect.equals( - 0.1, - f(0.1, (val) { - Expect.isTrue(val is CompoundA); - Expect.isTrue(val.b is CompoundB); - Expect.isTrue(val.b.c is CompoundC); - Expect.equals(val, val.b.c.root); - Expect.equals(0.1, val.b.c.d); - })); + 0.1, + f(0.1, (val) { + Expect.isTrue(val is CompoundA); + Expect.isTrue(val.b is CompoundB); + Expect.isTrue(val.b.c is CompoundC); + Expect.equals(val, val.b.c.root); + Expect.equals(0.1, val.b.c.d); + }), + ); } testCompound3() { @@ -240,12 +242,13 @@ for (var i = 0; i < 100; i++) f(0.1); Expect.equals(0.1, f(0.1)); Expect.equals( - 0.1, - f(0.1, (val) { - Expect.isTrue(val is CompoundC); - Expect.equals(val, val.root); - Expect.equals(0.1, val.d); - })); + 0.1, + f(0.1, (val) { + Expect.isTrue(val is CompoundC); + Expect.equals(val, val.root); + Expect.equals(0.1, val.d); + }), + ); } testCompound4() { @@ -263,12 +266,13 @@ for (var i = 0; i < 100; i++) f(1.0); Expect.equals(1.0, f(1.0)); Expect.equals( - 1.0, - f(1.0, (val) { - Expect.isTrue(val is CompoundC); - Expect.equals(val, val.root); - Expect.equals(11.0, val.d); - })); + 1.0, + f(1.0, (val) { + Expect.isTrue(val is CompoundC); + Expect.equals(val, val.root); + Expect.equals(11.0, val.d); + }), + ); } main() { @@ -276,14 +280,19 @@ // Compute initial values. final x0 = test1(c, 11.11, 22.22); - var fc = new Cx4(new Pointx4( - new Float32x4(1.0, 1.0, 1.0, 1.0), new Float32x4(1.0, 1.0, 1.0, 1.0))); + var fc = new Cx4( + new Pointx4( + new Float32x4(1.0, 1.0, 1.0, 1.0), + new Float32x4(1.0, 1.0, 1.0, 1.0), + ), + ); final fx0 = test1x4( - fc, - new Float32x4(1.0, 1.0, 1.0, 1.0), - new Float32x4(1.0, 1.0, 1.0, 1.0), - new Float32x4(1.0, 1.0, 1.0, 1.0), - new Float32x4(1.0, 1.0, 1.0, 1.0)); + fc, + new Float32x4(1.0, 1.0, 1.0, 1.0), + new Float32x4(1.0, 1.0, 1.0, 1.0), + new Float32x4(1.0, 1.0, 1.0, 1.0), + new Float32x4(1.0, 1.0, 1.0, 1.0), + ); final y0 = testForwardingThroughEffects(c, 11.11, 22.22); final z0 = testIdentity(c.p); @@ -291,11 +300,12 @@ for (var i = 0; i < 100; i++) { test1(c, i.toDouble(), i.toDouble()); test1x4( - fc, - new Float32x4(1.0, 1.0, 1.0, 1.0), - new Float32x4(1.0, 1.0, 1.0, 1.0), - new Float32x4(1.0, 1.0, 1.0, 1.0), - new Float32x4(1.0, 1.0, 1.0, 1.0)); + fc, + new Float32x4(1.0, 1.0, 1.0, 1.0), + new Float32x4(1.0, 1.0, 1.0, 1.0), + new Float32x4(1.0, 1.0, 1.0, 1.0), + new Float32x4(1.0, 1.0, 1.0, 1.0), + ); testForwardingThroughEffects(c, i.toDouble(), i.toDouble()); testIdentity(c.p); foo2();
diff --git a/tests/language/vm/clamp_37868_test.dart b/tests/language/vm/clamp_37868_test.dart index 58d3eae..77d53bc 100755 --- a/tests/language/vm/clamp_37868_test.dart +++ b/tests/language/vm/clamp_37868_test.dart
@@ -37,10 +37,38 @@ 0, -1, ]; - Expect.listEquals( - [255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 11, 0, 0, 0], foo(x)); - Expect.listEquals( - [255, 0, 1, 255, 0, 0, 255, 0, 255, 1, 11, 245, 0, 255], bar(x)); + Expect.listEquals([ + 255, + 0, + 255, + 0, + 255, + 0, + 255, + 0, + 255, + 0, + 11, + 0, + 0, + 0, + ], foo(x)); + Expect.listEquals([ + 255, + 0, + 1, + 255, + 0, + 0, + 255, + 0, + 255, + 1, + 11, + 245, + 0, + 255, + ], bar(x)); Expect.listEquals([-1, 0, 1, -1, 0, 0, -1, 0, -1, 1, 11, -11, 0, -1], baz(x)); // Hidden null.
diff --git a/tests/language/vm/deep_loop_test.dart b/tests/language/vm/deep_loop_test.dart index 92262db..b3a88de 100644 --- a/tests/language/vm/deep_loop_test.dart +++ b/tests/language/vm/deep_loop_test.dart
@@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +// Don't try to fit in 80 columns with this much nesting. +// dart format width=300 import 'package:expect/expect.dart'; // Stress tests on loop nesting depth. Make sure loop and induction @@ -27,87 +29,27 @@ for (int i14 = i13 - 1; i14 <= i13 + 1; i14++) for (int i15 = i14 - 1; i15 <= i14 + 1; i15++) for (int i16 = i15 - 1; i16 <= i15 + 1; i16++) - for (int i17 = i16 - 1; - i17 <= i16 + 1; - i17++) - for (int i18 = i17 - 1; - i18 <= i17 + 1; - i18++) - for (int i19 = i18 - 1; - i19 <= i18 + 1; - i19++) - for (int i20 = i19 - 1; - i20 <= i19 + 1; - i20++) - for (int i21 = i20 - 1; - i21 <= i20 + 1; - i21++) - for (int i22 = i21 - 1; - i22 <= i21 + 1; - i22++) - for (int i23 = i22 - 1; - i23 <= i22 + 1; - i23++) - for (int i24 = i23 - 1; - i24 <= i23 + 1; - i24++) - for (int i25 = i24 - 1; - i25 <= i24 + 1; - i25++) - for (int i26 = i25 - 1; - i26 <= i25 + 1; - i26++) - for (int i27 = i26 - 1; - i27 <= i26 + 1; - i27++) - for (int i28 = - i27 - 1; - i28 <= i27 + 1; - i28++) - for (int i29 = - i28 - 1; - i29 <= i28 + 1; - i29++) - for (int i30 = - i29 - 1; - i30 <= - i29 + 1; - i30++) - for (int i31 = - i30 - 1; - i31 <= - i30 + 1; - i31++) - for (int i32 = - i31 - - 1; - i32 <= - i31 + - 1; - i32++) - for (int i33 = - i32 - - 1; - i33 <= - i32 + - 1; - i33++) - for (int i34 = i33 - - 1; - i34 <= - i33 + 1; - i34++) - for (int i35 = i34 - - 1; - i35 <= - i34 + 1; - i35++) - for (int i36 = i35 - 1; - i36 <= i35 + 1; - i36++) - for (int i37 = i36 - 1; - i37 <= i36 + 1; - i37++) + for (int i17 = i16 - 1; i17 <= i16 + 1; i17++) + for (int i18 = i17 - 1; i18 <= i17 + 1; i18++) + for (int i19 = i18 - 1; i19 <= i18 + 1; i19++) + for (int i20 = i19 - 1; i20 <= i19 + 1; i20++) + for (int i21 = i20 - 1; i21 <= i20 + 1; i21++) + for (int i22 = i21 - 1; i22 <= i21 + 1; i22++) + for (int i23 = i22 - 1; i23 <= i22 + 1; i23++) + for (int i24 = i23 - 1; i24 <= i23 + 1; i24++) + for (int i25 = i24 - 1; i25 <= i24 + 1; i25++) + for (int i26 = i25 - 1; i26 <= i25 + 1; i26++) + for (int i27 = i26 - 1; i27 <= i26 + 1; i27++) + for (int i28 = i27 - 1; i28 <= i27 + 1; i28++) + for (int i29 = i28 - 1; i29 <= i28 + 1; i29++) + for (int i30 = i29 - 1; i30 <= i29 + 1; i30++) + for (int i31 = i30 - 1; i31 <= i30 + 1; i31++) + for (int i32 = i31 - 1; i32 <= i31 + 1; i32++) + for (int i33 = i32 - 1; i33 <= i32 + 1; i33++) + for (int i34 = i33 - 1; i34 <= i33 + 1; i34++) + for (int i35 = i34 - 1; i35 <= i34 + 1; i35++) + for (int i36 = i35 - 1; i36 <= i35 + 1; i36++) + for (int i37 = i36 - 1; i37 <= i36 + 1; i37++) for (int i38 = i37 - 1; i38 <= i37 + 1; i38++) for (int i39 = i38 - 1; i39 <= i38 + 1; i39++) for (int i40 = i39 - 1; i40 <= i39 + 1; i40++) @@ -195,87 +137,27 @@ for (int i14 = i13 + 1; i14 >= i13 - 1; i14--) for (int i15 = i14 + 1; i15 >= i14 - 1; i15--) for (int i16 = i15 + 1; i16 >= i15 - 1; i16--) - for (int i17 = i16 + 1; - i17 >= i16 - 1; - i17--) - for (int i18 = i17 + 1; - i18 >= i17 - 1; - i18--) - for (int i19 = i18 + 1; - i19 >= i18 - 1; - i19--) - for (int i20 = i19 + 1; - i20 >= i19 - 1; - i20--) - for (int i21 = i20 + 1; - i21 >= i20 - 1; - i21--) - for (int i22 = i21 + 1; - i22 >= i21 - 1; - i22--) - for (int i23 = i22 + 1; - i23 >= i22 - 1; - i23--) - for (int i24 = i23 + 1; - i24 >= i23 - 1; - i24--) - for (int i25 = i24 + 1; - i25 >= i24 - 1; - i25--) - for (int i26 = i25 + 1; - i26 >= i25 - 1; - i26--) - for (int i27 = i26 + 1; - i27 >= i26 - 1; - i27--) - for (int i28 = - i27 + 1; - i28 >= i27 - 1; - i28--) - for (int i29 = - i28 + 1; - i29 >= i28 - 1; - i29--) - for (int i30 = - i29 + 1; - i30 >= - i29 - 1; - i30--) - for (int i31 = - i30 + 1; - i31 >= - i30 - 1; - i31--) - for (int i32 = - i31 + - 1; - i32 >= - i31 - - 1; - i32--) - for (int i33 = - i32 + - 1; - i33 >= - i32 - - 1; - i33--) - for (int i34 = i33 + - 1; - i34 >= - i33 - 1; - i34--) - for (int i35 = i34 + - 1; - i35 >= - i34 - 1; - i35--) - for (int i36 = i35 + 1; - i36 >= i35 - 1; - i36--) - for (int i37 = i36 + 1; - i37 >= i36 - 1; - i37--) + for (int i17 = i16 + 1; i17 >= i16 - 1; i17--) + for (int i18 = i17 + 1; i18 >= i17 - 1; i18--) + for (int i19 = i18 + 1; i19 >= i18 - 1; i19--) + for (int i20 = i19 + 1; i20 >= i19 - 1; i20--) + for (int i21 = i20 + 1; i21 >= i20 - 1; i21--) + for (int i22 = i21 + 1; i22 >= i21 - 1; i22--) + for (int i23 = i22 + 1; i23 >= i22 - 1; i23--) + for (int i24 = i23 + 1; i24 >= i23 - 1; i24--) + for (int i25 = i24 + 1; i25 >= i24 - 1; i25--) + for (int i26 = i25 + 1; i26 >= i25 - 1; i26--) + for (int i27 = i26 + 1; i27 >= i26 - 1; i27--) + for (int i28 = i27 + 1; i28 >= i27 - 1; i28--) + for (int i29 = i28 + 1; i29 >= i28 - 1; i29--) + for (int i30 = i29 + 1; i30 >= i29 - 1; i30--) + for (int i31 = i30 + 1; i31 >= i30 - 1; i31--) + for (int i32 = i31 + 1; i32 >= i31 - 1; i32--) + for (int i33 = i32 + 1; i33 >= i32 - 1; i33--) + for (int i34 = i33 + 1; i34 >= i33 - 1; i34--) + for (int i35 = i34 + 1; i35 >= i34 - 1; i35--) + for (int i36 = i35 + 1; i36 >= i35 - 1; i36--) + for (int i37 = i36 + 1; i37 >= i36 - 1; i37--) for (int i38 = i37 + 1; i38 >= i37 - 1; i38--) for (int i39 = i38 + 1; i39 >= i38 - 1; i39--) for (int i40 = i39 + 1; i40 >= i39 - 1; i40--)
diff --git a/tests/language/vm/fuzzer_unsigned_shift_right_test.dart b/tests/language/vm/fuzzer_unsigned_shift_right_test.dart index 42660ed..97eb1f8 100644 --- a/tests/language/vm/fuzzer_unsigned_shift_right_test.dart +++ b/tests/language/vm/fuzzer_unsigned_shift_right_test.dart
@@ -15,8 +15,9 @@ return Int16List(40); } for (int loc0 = 0; loc0 < 31; loc0++) { - for (int loc1 in ((Uint8ClampedList.fromList(Uint8List(26))) - .sublist((11 >>> loc0), null))) {} + for (int loc1 in ((Uint8ClampedList.fromList( + Uint8List(26), + )).sublist((11 >>> loc0), null))) {} } return foo0_0(par4 + 1); }
diff --git a/tests/language/vm/lazy_async_exception_stack2_test.dart b/tests/language/vm/lazy_async_exception_stack2_test.dart index 8b3a24c..f312485 100644 --- a/tests/language/vm/lazy_async_exception_stack2_test.dart +++ b/tests/language/vm/lazy_async_exception_stack2_test.dart
@@ -27,13 +27,9 @@ } catch (e, st) { // st has foo,2,3 and not bar,2,3. expect( - h.stringContainsInOrder(st.toString(), [ - 'foo3', - 'foo2', - 'foo', - 'test1', - ]), - isTrue); + h.stringContainsInOrder(st.toString(), ['foo3', 'foo2', 'foo', 'test1']), + isTrue, + ); expect(st.toString().contains('bar'), isFalse); } @@ -42,13 +38,9 @@ } catch (e, st) { // st has bar,2,3 but not foo,2,3 expect( - h.stringContainsInOrder(st.toString(), [ - 'bar3', - 'bar2', - 'bar', - 'test1', - ]), - isTrue); + h.stringContainsInOrder(st.toString(), ['bar3', 'bar2', 'bar', 'test1']), + isTrue, + ); expect(st.toString().contains('foo'), isFalse); } } @@ -64,13 +56,9 @@ } catch (e, st) { // st has foo,2,3 but not bar,2,3 expect( - h.stringContainsInOrder(st.toString(), [ - 'foo3', - 'foo2', - 'foo', - 'test2', - ]), - isTrue); + h.stringContainsInOrder(st.toString(), ['foo3', 'foo2', 'foo', 'test2']), + isTrue, + ); expect(st.toString().contains('bar'), isFalse); } @@ -79,13 +67,9 @@ } catch (e, st) { // st has bar,2,3 but not foo,2,3 expect( - h.stringContainsInOrder(st.toString(), [ - 'bar3', - 'bar2', - 'bar', - 'test2', - ]), - isTrue); + h.stringContainsInOrder(st.toString(), ['bar3', 'bar2', 'bar', 'test2']), + isTrue, + ); expect(st.toString().contains('foo'), isFalse); } }
diff --git a/tests/language/vm/lazy_async_exception_stack_test.dart b/tests/language/vm/lazy_async_exception_stack_test.dart index ad088a7..9937779 100644 --- a/tests/language/vm/lazy_async_exception_stack_test.dart +++ b/tests/language/vm/lazy_async_exception_stack_test.dart
@@ -33,14 +33,15 @@ fail("Did not throw"); } catch (e, st) { expect( - h.stringContainsInOrder(st.toString(), [ - 'thrower', '.dart:10', // no auto-format. - 'generator', '.dart:19', // no auto-format. - '<asynchronous suspension>', // no auto-format. - 'foo', '.dart', // no auto-format. - 'main', - ]), - isTrue); + h.stringContainsInOrder(st.toString(), [ + 'thrower', '.dart:10', // no auto-format. + 'generator', '.dart:19', // no auto-format. + '<asynchronous suspension>', // no auto-format. + 'foo', '.dart', // no auto-format. + 'main', + ]), + isTrue, + ); } inner() async { @@ -56,14 +57,15 @@ await inner(); } catch (e, st) { expect( - h.stringContainsInOrder(st.toString(), [ - 'thrower', - 'main.<anonymous closure>.inner.deep', - 'main.<anonymous closure>.inner', - 'main', - '<asynchronous suspension>', - ]), - isTrue); + h.stringContainsInOrder(st.toString(), [ + 'thrower', + 'main.<anonymous closure>.inner.deep', + 'main.<anonymous closure>.inner', + 'main', + '<asynchronous suspension>', + ]), + isTrue, + ); } // Test for correct linkage. @@ -71,11 +73,12 @@ await thrower(); } catch (e, st) { expect( - h.stringContainsInOrder(st.toString(), [ - 'thrower', '.dart:10', // no auto-format. - 'main.<anonymous closure>', '.dart:71', // no auto-format. - ]), - isTrue); + h.stringContainsInOrder(st.toString(), [ + 'thrower', '.dart:10', // no auto-format. + 'main.<anonymous closure>', '.dart:73', // no auto-format. + ]), + isTrue, + ); } }); }
diff --git a/tests/language/vm/load_to_load_forwarding_vm_test.dart b/tests/language/vm/load_to_load_forwarding_vm_test.dart index 69c830d..038ce1c 100644 --- a/tests/language/vm/load_to_load_forwarding_vm_test.dart +++ b/tests/language/vm/load_to_load_forwarding_vm_test.dart
@@ -189,9 +189,7 @@ class U { var x, y; - U() - : x = 0, - y = 0; + U() : x = 0, y = 0; } testEqualPhisElimination() {
diff --git a/tests/language/vm/no_such_args_error_message_vm_test.dart b/tests/language/vm/no_such_args_error_message_vm_test.dart index 2263209..ca5084c 100644 --- a/tests/language/vm/no_such_args_error_message_vm_test.dart +++ b/tests/language/vm/no_such_args_error_message_vm_test.dart
@@ -17,8 +17,9 @@ // The latter may happen if in --dwarf-stack-traces mode. final possibleNames = ['testClosureMessage', '<optimized out>']; Expect.containsAny( - possibleNames.map((s) => s + '.<anonymous closure>("bar")').toList(), - e.toString()); + possibleNames.map((s) => s + '.<anonymous closure>("bar")').toList(), + e.toString(), + ); } } @@ -28,9 +29,7 @@ try { call_with_bar(noargs); } catch (e) { - final expectedStrings = [ - 'Tried calling: noargs("bar")', - ]; + final expectedStrings = ['Tried calling: noargs("bar")']; Expect.containsInOrder(expectedStrings, e.toString()); } }
diff --git a/tests/language/vm/osr_nonempty_stack_test.dart b/tests/language/vm/osr_nonempty_stack_test.dart index a31df50..e3f7afc 100644 --- a/tests/language/vm/osr_nonempty_stack_test.dart +++ b/tests/language/vm/osr_nonempty_stack_test.dart
@@ -74,9 +74,12 @@ // leaves the stack non-empty during a potential OSR. @pragma('vm:never-inline') List<int> test4(int n) { - var x = [10] + - z.check(42, bazz(), 'abc', - [more_bazz(), for (int i = 0; i < n; i++) bar(2 * i)]); + var x = + [10] + + z.check(42, bazz(), 'abc', [ + more_bazz(), + for (int i = 0; i < n; i++) bar(2 * i), + ]); return x; } @@ -86,9 +89,12 @@ List<int> test5(int m, int n) { List<int> x = []; for (int k = 0; k < m; k++) { - x += [10] + - z.check(42, bazz(), 'abc', - [more_bazz(), for (int i = 0; i < n; i++) bar(2 * i)]); + x += + [10] + + z.check(42, bazz(), 'abc', [ + more_bazz(), + for (int i = 0; i < n; i++) bar(2 * i), + ]); } return x; } @@ -96,7 +102,7 @@ List<int> globalList = [ 1, for (int loc1 = 2; loc1 <= 100000; loc1++) loc1, - 100001 + 100001, ]; main() {
diff --git a/tests/language/vm/reflect_core_vm_test.dart b/tests/language/vm/reflect_core_vm_test.dart index 40d6793..b03e2f3 100644 --- a/tests/language/vm/reflect_core_vm_test.dart +++ b/tests/language/vm/reflect_core_vm_test.dart
@@ -10,7 +10,10 @@ main() { var s = "string"; var im = reflect(s); - Expect.throwsNoSuchMethodError(() => - im.invoke(MirrorSystem.getSymbol( - "_setAt", im.type.owner as LibraryMirror), [0, 65])); + Expect.throwsNoSuchMethodError( + () => im.invoke( + MirrorSystem.getSymbol("_setAt", im.type.owner as LibraryMirror), + [0, 65], + ), + ); }
diff --git a/tests/language/vm/regress_35325_test.dart b/tests/language/vm/regress_35325_test.dart index 51b1122..04d5fef 100644 --- a/tests/language/vm/regress_35325_test.dart +++ b/tests/language/vm/regress_35325_test.dart
@@ -18,10 +18,9 @@ bool foo(double par1) { return (bar( - [81, 17], - ((!(var1)) - ? double.maxFinite - : (var1 ? (80).floorToDouble() : par1))) == + [81, 17], + ((!(var1)) ? double.maxFinite : (var1 ? (80).floorToDouble() : par1)), + ) == (((~(var2))).roundToDouble()).sign); }
diff --git a/tests/language/vm/regress_37149_test.dart b/tests/language/vm/regress_37149_test.dart index 680c065..bcc9dc9 100644 --- a/tests/language/vm/regress_37149_test.dart +++ b/tests/language/vm/regress_37149_test.dart
@@ -9,12 +9,18 @@ import 'dart:async' show FutureOr; typedef ComputeCallback<Q, R> = FutureOr<R> Function(Q message); -typedef _ComputeImpl = Future<R?> Function<Q, R>( - ComputeCallback<Q, R>? callback, Q? message, - {String debugLabel}); +typedef _ComputeImpl = + Future<R?> Function<Q, R>( + ComputeCallback<Q, R>? callback, + Q? message, { + String debugLabel, + }); -Future<R?> isolatesCompute<Q, R>(ComputeCallback<Q, R>? callback, Q? message, - {String? debugLabel}) async { +Future<R?> isolatesCompute<Q, R>( + ComputeCallback<Q, R>? callback, + Q? message, { + String? debugLabel, +}) async { return null; }
diff --git a/tests/language/vm/regress_45260_test.dart b/tests/language/vm/regress_45260_test.dart index d4fb0c5..d0ce355 100644 --- a/tests/language/vm/regress_45260_test.dart +++ b/tests/language/vm/regress_45260_test.dart
@@ -15,10 +15,10 @@ for (var i2 = 0; i2 < 2; i2++) [ for (var i3 = 0; i3 < 2; i3++) - 1000 * i0 + 100 * i1 + 10 * i2 + i3 - ] - ] - ] + 1000 * i0 + 100 * i1 + 10 * i2 + i3, + ], + ], + ], ]; return list; } @@ -32,7 +32,7 @@ [ [0100, 0101], [0110, 0111], - ] + ], ], [ [ @@ -42,8 +42,8 @@ [ [1100, 1101], [1110, 1111], - ] - ] + ], + ], ]; void main() {
diff --git a/tests/language/vm/regress_b131091988_test.dart b/tests/language/vm/regress_b131091988_test.dart index 359b4fe..42e7b8f 100644 --- a/tests/language/vm/regress_b131091988_test.dart +++ b/tests/language/vm/regress_b131091988_test.dart
@@ -11,7 +11,8 @@ } class B extends A<int> { - int Function(List<int> raw) get decode => (List<int> raw) => raw.first; + int Function(List<int> raw) get decode => + (List<int> raw) => raw.first; } class C<T> {
diff --git a/tests/language/vm/regress_flutter_14891_test.dart b/tests/language/vm/regress_flutter_14891_test.dart index 1f410df..03b4b2e 100644 --- a/tests/language/vm/regress_flutter_14891_test.dart +++ b/tests/language/vm/regress_flutter_14891_test.dart
@@ -10,6 +10,7 @@ class _ClassOnlyUsedAsTypeLiteral {} void main() { - Expect - .isTrue((const [_ClassOnlyUsedAsTypeLiteral]).toString().startsWith('[')); + Expect.isTrue( + (const [_ClassOnlyUsedAsTypeLiteral]).toString().startsWith('['), + ); }
diff --git a/tests/language/vm/regress_flutter_23879_test.dart b/tests/language/vm/regress_flutter_23879_test.dart index 27d6f26..0bc6d96 100644 --- a/tests/language/vm/regress_flutter_23879_test.dart +++ b/tests/language/vm/regress_flutter_23879_test.dart
@@ -10,8 +10,18 @@ List<int?> list = new List<int?>.filled(10, null); -List<int?> expected_values = - [null, 152, 168, 184, 200, 216, 232, 248, 264, 280]; +List<int?> expected_values = [ + null, + 152, + 168, + 184, + 200, + 216, + 232, + 248, + 264, + 280, +]; int count = 0;
diff --git a/tests/language/vm/regress_flutter_89584_test.dart b/tests/language/vm/regress_flutter_89584_test.dart index 2dd0e3e..fee541f 100644 --- a/tests/language/vm/regress_flutter_89584_test.dart +++ b/tests/language/vm/regress_flutter_89584_test.dart
@@ -21,9 +21,7 @@ void isolateEntry(SendPort sendPort) async { final uint8list = Uint8List(uint8ListLength); - sendPort.send(Wrapper( - uint8list.buffer.asUint8List(0, uint8list.length), - )); + sendPort.send(Wrapper(uint8list.buffer.asUint8List(0, uint8list.length))); } int readWrapperUint8ListView(Wrapper wrapper) {
diff --git a/tests/language/vm/regress_licm_test.dart b/tests/language/vm/regress_licm_test.dart index 1855c15..7776aac 100644 --- a/tests/language/vm/regress_licm_test.dart +++ b/tests/language/vm/regress_licm_test.dart
@@ -62,7 +62,7 @@ new Member(new BName("a")), new Member(new BName("b")), new Member(new BName("c")), - new Member(new BName("d")) + new Member(new BName("d")), ]; find(list, new AName());
diff --git a/tests/language/vm/regression_36587_test.dart b/tests/language/vm/regression_36587_test.dart index 595327b..ac6910e 100644 --- a/tests/language/vm/regression_36587_test.dart +++ b/tests/language/vm/regression_36587_test.dart
@@ -32,7 +32,7 @@ 99: 't', 49: 'Qu', 20: 'FujA\u2665', - 47: '' + 47: '', }; String? foo2() { @@ -55,22 +55,25 @@ : { (var4++), (var7[(false ? -87 : (++loc0))] % - (var7[((++loc0) * var4)] ~/ 73)) + (var7[((++loc0) * var4)] ~/ 73)), }); - var0 = ((((-((((true ? var2 : false) ? (!(var3)) : true) + var0 = + ((((-((((true ? var2 : false) ? (!(var3)) : true) ? var5 : ((0.38834735336907733 as dynamic) ?? - 0.8105736840461367)))) + + 0.8105736840461367)))) + (0.3752597438445757).abs())) .isFinite ? { (true ? 65 : (var3 ? (loc0--) : var4)), - var7[Float32x4.xxxx] + var7[Float32x4.xxxx], } : Set.identity()); - var1 = (((true - ? ({var7[var7[-9223372032559808513]]}).toSet() - : (Set.identity()).difference(var8!)) as dynamic) ?? + var1 = + (((true + ? ({var7[var7[-9223372032559808513]]}).toSet() + : (Set.identity()).difference(var8!)) + as dynamic) ?? var8); var9[Float32x4.zxyz] = ''; } catch (e) { @@ -86,7 +89,7 @@ (var4--), (-(ZLibOption.defaultWindowBits)), (~((loc0--))), - (var4++) + (var4++), ]; } }
diff --git a/tests/language/vm/regression_38231_legacy_test.dart b/tests/language/vm/regression_38231_legacy_test.dart index cab6d2b..7755133 100644 --- a/tests/language/vm/regression_38231_legacy_test.dart +++ b/tests/language/vm/regression_38231_legacy_test.dart
@@ -26,7 +26,10 @@ Map<int, String> var0 = { 41: 'V\u2665Y\u2665#Xs', for (int loc0 in { - if (true) for (int loc0 in {-2147483649}) -4294967167 else if (false) -1, + if (true) + for (int loc0 in {-2147483649}) -4294967167 + else if (false) + -1, -60, -82, -21, @@ -40,7 +43,8 @@ }) 95: '', 5: 'z2\u2665e', - if (false) for (int loc0 in [-87, -2147483649, 0, 97, -53, 95]) 10: '#synP3', + if (false) + for (int loc0 in [-87, -2147483649, 0, 97, -53, 95]) 10: '#synP3', 22: '' }; String var1 = ')LIpwG';
diff --git a/tests/language/vm/regression_38231_test.dart b/tests/language/vm/regression_38231_test.dart index 3c7475d..bc01f1d 100644 --- a/tests/language/vm/regression_38231_test.dart +++ b/tests/language/vm/regression_38231_test.dart
@@ -24,22 +24,26 @@ Map<int, String> var0 = { 41: 'V\u2665Y\u2665#Xs', for (int loc0 in { - if (true) for (int loc0 in {-2147483649}) -4294967167 else if (false) -1, + if (true) + for (int loc0 in {-2147483649}) -4294967167 + else if (false) + -1, -60, -82, -21, for (int loc0 in [ -9223372036854771712, - for (int loc0 = 0; loc0 < 53; loc0++) 96 + for (int loc0 = 0; loc0 < 53; loc0++) 96, ]) 1, -58, - 77 + 77, }) 95: '', 5: 'z2\u2665e', - if (false) for (int loc0 in [-87, -2147483649, 0, 97, -53, 95]) 10: '#synP3', - 22: '' + if (false) + for (int loc0 in [-87, -2147483649, 0, 97, -53, 95]) 10: '#synP3', + 22: '', }; String var1 = ')LIpwG'; double var2 = 0.30016980633333135; @@ -60,14 +64,14 @@ -26, -38, 9223372032559808513, - 60 + 60, }) for (int loc1 in { for (int loc1 in {19, 60}) -4294967280, -17, - -62 + -62, }) ...{23, 11}, - for (int loc0 = 0; loc0 < 30; loc0++) -44 + for (int loc0 = 0; loc0 < 30; loc0++) -44, }; Map<int, String> var10 = { for (int loc0 in { @@ -77,18 +81,18 @@ if (true) 82, ...{76, 5, 9223372032559841279, 98, 58, 97, -127, 72}, for (int loc0 in [-97]) -14, - for (int loc0 = 0; loc0 < 21; loc0++) 88 + for (int loc0 = 0; loc0 < 21; loc0++) 88, }, -52, for (int loc0 = 0; loc0 < 63; loc0++) ...{64, 0}, - for (int loc0 = 0; loc0 < 67; loc0++) ...{67} + for (int loc0 = 0; loc0 < 67; loc0++) ...{67}, }) 54: '', 41: 'cvokV0', 4: '9\u2665', 35: 'vRkv', 41: '\u2665', - 63: 'Nu+u\u26659S' + 63: 'Nu+u\u26659S', }; mixin class X0 {} @@ -108,18 +112,19 @@ } try { X1().foo1_1( - { - 32, - -94, - -2147483649, - -43, - for (int loc0 in {56, -31}) -9223372032559775745, - 53, - 86, - 4294967296 - }, - var4, - {1, 2}); + { + 32, + -94, + -2147483649, + -43, + for (int loc0 in {56, -31}) -9223372032559775745, + 53, + 86, + 4294967296, + }, + var4, + {1, 2}, + ); } catch (exception, stackTrace) { print('X1().foo1_1() throws'); }
diff --git a/tests/language/vm/regression_38412_test.dart b/tests/language/vm/regression_38412_test.dart index b904f05..1f3e808 100644 --- a/tests/language/vm/regression_38412_test.dart +++ b/tests/language/vm/regression_38412_test.dart
@@ -34,7 +34,8 @@ "a" == Uri.parse("\u2665"); } print('fuzzvar8 runtime type: ${fuzzvar8.runtimeType}'); - var x = - X1().foo1_0([for (int i = 0; i < 10; ++i) 0], bar(fuzzvar8, --fuzzvar1)); + var x = X1().foo1_0([ + for (int i = 0; i < 10; ++i) 0, + ], bar(fuzzvar8, --fuzzvar1)); Expect.equals(1, x[0]); }
diff --git a/tests/language/vm/regression_39071_test.dart b/tests/language/vm/regression_39071_test.dart index 82049b4..ca748ad 100644 --- a/tests/language/vm/regression_39071_test.dart +++ b/tests/language/vm/regression_39071_test.dart
@@ -9,6 +9,6 @@ main() { var x = [ - [for (int i = 0; i < 20; ++i) i] + [for (int i = 0; i < 20; ++i) i], ]; }
diff --git a/tests/language/vm/regression_39193_test.dart b/tests/language/vm/regression_39193_test.dart index bf48765..97fecea 100644 --- a/tests/language/vm/regression_39193_test.dart +++ b/tests/language/vm/regression_39193_test.dart
@@ -10,7 +10,8 @@ Map<int, Set<int>> var75 = {}; main() { - try {} catch (e, st) {} finally { + try {} catch (e, st) { + } finally { print('before'); var75[42] = (false ? const {}
diff --git a/tests/language/vm/smi_widening_test.dart b/tests/language/vm/smi_widening_test.dart index 5d67699..86cf074 100644 --- a/tests/language/vm/smi_widening_test.dart +++ b/tests/language/vm/smi_widening_test.dart
@@ -56,19 +56,21 @@ final int _value; @pragma('vm:never-inline') - Box( - {int days = 0, - int hours = 0, - int minutes = 0, - int seconds = 0, - int milliseconds = 0, - int microseconds = 0}) - : this._microseconds(1000 * 1000 * 60 * 60 * 24 * days + - 1000 * 1000 * 60 * 60 * hours + - 1000 * 1000 * 60 * minutes + - 1000 * 1000 * seconds + - 1000 * milliseconds + - microseconds); + Box({ + int days = 0, + int hours = 0, + int minutes = 0, + int seconds = 0, + int milliseconds = 0, + int microseconds = 0, + }) : this._microseconds( + 1000 * 1000 * 60 * 60 * 24 * days + + 1000 * 1000 * 60 * 60 * hours + + 1000 * 1000 * 60 * minutes + + 1000 * 1000 * seconds + + 1000 * milliseconds + + microseconds, + ); Box._microseconds(this._value);
diff --git a/tests/language/vm/type_cast_vm_test.dart b/tests/language/vm/type_cast_vm_test.dart index 50b30c4..5edfc3e 100644 --- a/tests/language/vm/type_cast_vm_test.dart +++ b/tests/language/vm/type_cast_vm_test.dart
@@ -6,7 +6,10 @@ import "package:expect/expect.dart"; checkSecondFunction( - String expectedFileAndLine, int expectedColum, StackTrace stacktrace) { + String expectedFileAndLine, + int expectedColum, + StackTrace stacktrace, +) { var topLine = stacktrace.toString().split("\n")[0]; int startPos = topLine.lastIndexOf("/"); int endPos = topLine.lastIndexOf(")"); @@ -31,7 +34,10 @@ Expect.isTrue(msg.contains("int")); // dstType Expect.isTrue(msg.contains("String")); // srcType checkSecondFunction( - "type_cast_vm_test.dart:26", 23, (error as dynamic).stackTrace); + "type_cast_vm_test.dart:29", + 23, + (error as dynamic).stackTrace, + ); } return result; } @@ -69,7 +75,10 @@ Expect.isTrue(msg.contains("int")); // dstType Expect.isTrue(msg.contains("String")); // srcType checkSecondFunction( - "type_cast_vm_test.dart:64", 25, (error as dynamic).stackTrace); + "type_cast_vm_test.dart:70", + 25, + (error as dynamic).stackTrace, + ); } return result; } @@ -89,7 +98,10 @@ Expect.isTrue(msg.contains("int")); // dstType Expect.isTrue(msg.contains("String")); // srcType checkSecondFunction( - "type_cast_vm_test.dart:80", 16, (error as dynamic).stackTrace); + "type_cast_vm_test.dart:89", + 16, + (error as dynamic).stackTrace, + ); } return result; } @@ -107,7 +119,10 @@ Expect.isTrue(msg.contains("int")); // dstType Expect.isTrue(msg.contains("String")); // srcType checkSecondFunction( - "type_cast_vm_test.dart:103", 13, (error as dynamic).stackTrace); + "type_cast_vm_test.dart:115", + 13, + (error as dynamic).stackTrace, + ); } return result; } @@ -126,7 +141,10 @@ Expect.isTrue(msg.contains("int")); // dstType Expect.isTrue(msg.contains("() => Null")); // srcType checkSecondFunction( - "type_cast_vm_test.dart:122", 17, (error as dynamic).stackTrace); + "type_cast_vm_test.dart:137", + 17, + (error as dynamic).stackTrace, + ); } return result; }
diff --git a/tests/language/vm/unregistered_closure_in_finally_test.dart b/tests/language/vm/unregistered_closure_in_finally_test.dart index fa970af..c9c3d7e 100644 --- a/tests/language/vm/unregistered_closure_in_finally_test.dart +++ b/tests/language/vm/unregistered_closure_in_finally_test.dart
@@ -17,7 +17,9 @@ @pragma('vm:never-inline') run(action) { - try { action(); } catch(e) {} + try { + action(); + } catch (e) {} } test(bool doThrow) { @@ -25,12 +27,16 @@ maybeThrow(doThrow); } finally { run(() { - doSomething(); // Should not crash here. + doSomething(); // Should not crash here. }); } } main() { - try { test(true); } catch(e) {} - try { test(false); } catch(e) {} + try { + test(true); + } catch (e) {} + try { + test(false); + } catch (e) {} }
diff --git a/tests/language/void/await_void_error_test.dart b/tests/language/void/await_void_error_test.dart index fb52fda..52cbba0 100644 --- a/tests/language/void/await_void_error_test.dart +++ b/tests/language/void/await_void_error_test.dart
@@ -12,25 +12,25 @@ void main() async { await print(''); - // ^ - // [analyzer] unspecified + // ^^^^^ + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT // [cfe] This expression has type 'void' and can't be used. await v; // ^ - // [analyzer] unspecified + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT // [cfe] This expression has type 'void' and can't be used. await vs[0]; - // ^ - // [analyzer] unspecified + // ^^^^^ + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT // ^ // [cfe] This expression has type 'void' and can't be used. var v2 = vs[0]; await v2; - // ^ - // [analyzer] unspecified + // ^^ + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT // [cfe] This expression has type 'void' and can't be used. // A `FutureOr<void>` can be awaited.
diff --git a/tests/language/void/generalized_void_usage_test.dart b/tests/language/void/generalized_void_usage_test.dart index 13bb717..74c2856 100644 --- a/tests/language/void/generalized_void_usage_test.dart +++ b/tests/language/void/generalized_void_usage_test.dart
@@ -17,7 +17,7 @@ // In the initialization and increment expressions of a for-loop, // `for (e1; e2; e3) {..}`, `e1` and `e3` may have type void. - for (x;; x) { + for (x; ; x) { break; }
diff --git a/tests/language/void/return_future_future_or_void_sync_error1_test.dart b/tests/language/void/return_future_future_or_void_sync_error1_test.dart index 604bd35..034ea81 100644 --- a/tests/language/void/return_future_future_or_void_sync_error1_test.dart +++ b/tests/language/void/return_future_future_or_void_sync_error1_test.dart
@@ -11,7 +11,7 @@ // Testing that a block bodied function may not have an empty return Future<FutureOr<void>> test() { return; -//^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.RETURN_WITHOUT_VALUE -// [cfe] A value must be explicitly returned from a non-void function. + // [error column 3, length 6] + // [analyzer] COMPILE_TIME_ERROR.RETURN_WITHOUT_VALUE + // [cfe] A value must be explicitly returned from a non-void function. }
diff --git a/tests/language/void/return_future_or_future_or_void_sync_test.dart b/tests/language/void/return_future_or_future_or_void_sync_test.dart index 1ccb54f..ecb9ab5 100644 --- a/tests/language/void/return_future_or_future_or_void_sync_test.dart +++ b/tests/language/void/return_future_or_future_or_void_sync_test.dart
@@ -47,5 +47,6 @@ // values, because `Future` is a subtype of `void`. FutureOr<FutureOr<void>> test() { return Future<Future<Future<void>>>.value( - Future<Future<void>>.value(Future<void>.value(null))); + Future<Future<void>>.value(Future<void>.value(null)), + ); }
diff --git a/tests/language/void/void_type_usage_test.dart b/tests/language/void/void_type_usage_test.dart index 3c49289..ce386c2 100644 --- a/tests/language/void/void_type_usage_test.dart +++ b/tests/language/void/void_type_usage_test.dart
@@ -35,16 +35,16 @@ // [cfe] This expression has type 'void' and can't be used. x is Object?; // param_is -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. throw x; // param_throw // ^ // [analyzer] COMPILE_TIME_ERROR.THROW_OF_INVALID_TYPE // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT - // [cfe] This expression has type 'void' and can't be used. // [cfe] Can't throw a value of 'void' since it is neither dynamic nor non-nullable. + // [cfe] This expression has type 'void' and can't be used. <void>[x]; // param_literal_void_list_init: ok @@ -68,9 +68,9 @@ // [cfe] This expression has type 'void' and can't be used. x ?? 499; // param_null_equals1 -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. null ?? x; // param_null_equals2: ok @@ -101,26 +101,26 @@ for (x in [1, 2]) {} // param_for_in2: ok x += 1; // param_plus_eq -//^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3] + // [cfe] This expression has type 'void' and can't be used. //^^ // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT // [cfe] The operator '+' isn't defined for the class 'void'. x.toString(); // param_toString -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. x?.toString(); // param_null_dot -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. x..toString(); // param_cascade -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. if (x) {} // param_conditional_stmt // ^ @@ -128,14 +128,14 @@ // [cfe] This expression has type 'void' and can't be used. !x; // param_boolean_negation -// ^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 4, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. x && true; // param_boolean_and_left -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. true && x; // param_boolean_and_right // ^ @@ -143,9 +143,9 @@ // [cfe] This expression has type 'void' and can't be used. x || true; // param_boolean_or_left -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. true || x; // param_boolean_or_right // ^ @@ -153,9 +153,9 @@ // [cfe] This expression has type 'void' and can't be used. x == 3; // param_equals_left -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. 3 == x; // param_equals_right // ^ @@ -178,19 +178,19 @@ // [cfe] This expression has type 'void' and can't be used. -x; // param_negation -//^ -// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe] The operator 'unary-' isn't defined for the class 'void'. -// ^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] The operator 'unary-' isn't defined for the class 'void'. + // [error column 4, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. x(3); // param_use_as_function -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. -// ^ -// [cfe] The method 'call' isn't defined for the class 'void'. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. + // [error column 4] + // [cfe] The method 'call' isn't defined for the class 'void'. "hello$x"; // param_use_in_string_interpolation // ^ @@ -198,8 +198,8 @@ // [cfe] This expression has type 'void' and can't be used. x ??= 3; // param_use_in_conditional_assignment_left -//^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3] + // [cfe] This expression has type 'void' and can't be used. //^^^ // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT @@ -273,11 +273,12 @@ const void c = null; -dynamic testVoidDefaultParameter( - [int y = c]) {} // void_default_parameter_global -// ^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. +dynamic testVoidDefaultParameter([ + int y = c, + // ^ + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. +]) {} // void_default_parameter_global dynamic testVoidDefaultParameterClosure() { ([int y = c]) => 3; // void_default_parameter_closure @@ -320,10 +321,10 @@ // [cfe] This expression has type 'void' and can't be used. f() is Object?; // call_is -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 4] + // [cfe] This expression has type 'void' and can't be used. throw f(); // call_throw // ^^^ @@ -358,10 +359,10 @@ // [cfe] This expression has type 'void' and can't be used. f() ?? 499; // call_null_equals1 -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 4] + // [cfe] This expression has type 'void' and can't be used. null ?? f(); // call_null_equals2: ok @@ -394,22 +395,22 @@ // [cfe] This expression has type 'void' and can't be used. f().toString(); // call_toString -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 4] + // [cfe] This expression has type 'void' and can't be used. f()?.toString(); // call_null_dot -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 4] + // [cfe] This expression has type 'void' and can't be used. f()..toString(); // call_cascade -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 4] + // [cfe] This expression has type 'void' and can't be used. if (f()) {} // call_conditional_stmt // ^^^ @@ -418,16 +419,16 @@ // [cfe] This expression has type 'void' and can't be used. !f(); // call_boolean_negation -// ^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 4, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT //^ // [cfe] This expression has type 'void' and can't be used. f() && true; // call_boolean_and_left -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 4] + // [cfe] This expression has type 'void' and can't be used. true && f(); // call_boolean_and_right // ^^^ @@ -436,10 +437,10 @@ // [cfe] This expression has type 'void' and can't be used. f() || true; // call_boolean_or_left -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 4] + // [cfe] This expression has type 'void' and can't be used. true || f(); // call_boolean_or_right // ^^^ @@ -448,10 +449,10 @@ // [cfe] This expression has type 'void' and can't be used. f() == 3; // call_equals_left -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 4] + // [cfe] This expression has type 'void' and can't be used. 3 == f(); // call_equals_right // ^^^ @@ -478,19 +479,19 @@ // [cfe] This expression has type 'void' and can't be used. -f(); // call_negation -//^ -// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe] The operator 'unary-' isn't defined for the class 'void'. -// ^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] The operator 'unary-' isn't defined for the class 'void'. + // [error column 4, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT //^ // [cfe] This expression has type 'void' and can't be used. f()(3); // call_use_as_function -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 4] + // [cfe] This expression has type 'void' and can't be used. // ^ // [cfe] The method 'call' isn't defined for the class 'void'. @@ -561,16 +562,16 @@ // [cfe] This expression has type 'void' and can't be used. x is Object?; // local_is -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. throw x; // local_throw // ^ // [analyzer] COMPILE_TIME_ERROR.THROW_OF_INVALID_TYPE // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT - // [cfe] This expression has type 'void' and can't be used. // [cfe] Can't throw a value of 'void' since it is neither dynamic nor non-nullable. + // [cfe] This expression has type 'void' and can't be used. <void>[x]; // local_literal_void_list_init: ok @@ -594,9 +595,9 @@ // [cfe] This expression has type 'void' and can't be used. x ?? 499; // local_null_equals1 -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. null ?? x; // local_null_equals2: ok @@ -627,26 +628,26 @@ for (x in [1, 2]) {} // local_for_in2: ok x += 1; // local_plus_eq -//^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3] + // [cfe] This expression has type 'void' and can't be used. //^^ // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT // [cfe] The operator '+' isn't defined for the class 'void'. x.toString(); // local_toString -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. x?.toString(); // local_null_dot -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. x..toString(); // local_cascade -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. if (x) {} // local_conditional_stmt // ^ @@ -654,14 +655,14 @@ // [cfe] This expression has type 'void' and can't be used. !x; // local_boolean_negation -// ^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 4, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. x && true; // local_boolean_and_left -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. true && x; // local_boolean_and_right // ^ @@ -669,9 +670,9 @@ // [cfe] This expression has type 'void' and can't be used. x || true; // local_boolean_or_left -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. true || x; // local_boolean_or_right // ^ @@ -679,9 +680,9 @@ // [cfe] This expression has type 'void' and can't be used. x == 3; // local_equals_left -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. 3 == x; // local_equals_right // ^ @@ -704,19 +705,19 @@ // [cfe] This expression has type 'void' and can't be used. -x; // local_negation -//^ -// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe] The operator 'unary-' isn't defined for the class 'void'. -// ^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] The operator 'unary-' isn't defined for the class 'void'. + // [error column 4, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. x(3); // local_use_as_function -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. -// ^ -// [cfe] The method 'call' isn't defined for the class 'void'. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. + // [error column 4] + // [cfe] The method 'call' isn't defined for the class 'void'. "hello$x"; // local_use_in_string_interpolation // ^ @@ -724,10 +725,10 @@ // [cfe] This expression has type 'void' and can't be used. x ??= 3; // local_use_in_conditional_assignment_left + // [error column 3] + // [cfe] This expression has type 'void' and can't be used. //^^^ // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -//^ -// [cfe] This expression has type 'void' and can't be used. Object? xx; xx ??= x; // local_use_in_conditional_assignment_right @@ -786,16 +787,16 @@ // [cfe] This expression has type 'void' and can't be used. x is Object?; // final_local_is -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. throw x; // final_local_throw // ^ - // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT // [analyzer] COMPILE_TIME_ERROR.THROW_OF_INVALID_TYPE - // [cfe] This expression has type 'void' and can't be used. + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT // [cfe] Can't throw a value of 'void' since it is neither dynamic nor non-nullable. + // [cfe] This expression has type 'void' and can't be used. <void>[x]; // final_local_literal_void_list_init: ok @@ -819,9 +820,9 @@ // [cfe] This expression has type 'void' and can't be used. x ?? 499; // final_local_null_equals1 -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. null ?? x; // final_local_null_equals2: ok @@ -856,19 +857,19 @@ // x += 1; // final_local_plus_eq x.toString(); // final_local_toString -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. x?.toString(); // final_local_null_dot -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. x..toString(); // final_local_cascade -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. if (x) {} // final_local_conditional_stmt // ^ @@ -876,14 +877,14 @@ // [cfe] This expression has type 'void' and can't be used. !x; // final_local_boolean_negation -// ^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 4, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. x && true; // final_local_boolean_and_left -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. true && x; // final_local_boolean_and_right // ^ @@ -891,9 +892,9 @@ // [cfe] This expression has type 'void' and can't be used. x || true; // final_local_boolean_or_left -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. true || x; // final_local_boolean_or_right // ^ @@ -901,9 +902,9 @@ // [cfe] This expression has type 'void' and can't be used. x == 3; // final_local_equals_left -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. 3 == x; // final_local_equals_right // ^ @@ -926,19 +927,19 @@ // [cfe] This expression has type 'void' and can't be used. -x; // final_local_negation -//^ -// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe] The operator 'unary-' isn't defined for the class 'void'. -// ^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] The operator 'unary-' isn't defined for the class 'void'. + // [error column 4, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. x(3); // final_local_use_as_function -//^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. -// ^ -// [cfe] The method 'call' isn't defined for the class 'void'. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. + // [error column 4] + // [cfe] The method 'call' isn't defined for the class 'void'. "hello$x"; // final_local_use_in_string_interpolation // ^ @@ -946,10 +947,10 @@ // [cfe] This expression has type 'void' and can't be used. x ??= 3; // final_local_use_in_conditional_assignment_left -//^ -// [cfe] This expression has type 'void' and can't be used. -// ^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 3] + // [cfe] This expression has type 'void' and can't be used. + //^^^ + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT Object? xx; xx ??= x; // final_local_use_in_conditional_assignment_right @@ -1001,9 +1002,9 @@ // [cfe] This expression has type 'void' and can't be used. global is Object?; // global_is -//^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 6] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. throw global; // global_throw // ^^^^^^ @@ -1034,9 +1035,9 @@ // [cfe] This expression has type 'void' and can't be used. global ?? 499; // global_null_equals1 -//^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 6] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. null ?? global; // global_null_equals2: ok @@ -1067,26 +1068,26 @@ for (global in [1, 2]) {} // global_for_in2: ok global += 1; // global_plus_eq -//^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3] + // [cfe] This expression has type 'void' and can't be used. // ^^ // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT // [cfe] The operator '+' isn't defined for the class 'void'. global.toString(); // global_toString -//^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 6] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. global?.toString(); // global_null_dot -//^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 6] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. global..toString(); // global_cascade -//^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 6] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. if (global) {} // global_conditional_stmt // ^^^^^^ @@ -1094,14 +1095,14 @@ // [cfe] This expression has type 'void' and can't be used. !global; // global_boolean_negation -// ^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 4, length 6] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. global && true; // global_boolean_and_left -//^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 6] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. true && global; // global_boolean_and_right // ^^^^^^ @@ -1109,9 +1110,9 @@ // [cfe] This expression has type 'void' and can't be used. global || true; // global_boolean_or_left -//^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 6] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. true || global; // global_boolean_or_right // ^^^^^^ @@ -1119,9 +1120,9 @@ // [cfe] This expression has type 'void' and can't be used. global == 3; // global_equals_left -//^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 6] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. 3 == global; // global_equals_right // ^^^^^^ @@ -1144,17 +1145,17 @@ // [cfe] This expression has type 'void' and can't be used. -global; // global_negation -//^ -// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe] The operator 'unary-' isn't defined for the class 'void'. -// ^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] The operator 'unary-' isn't defined for the class 'void'. + // [error column 4, length 6] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. global(3); // global_use_as_function -//^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 6] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [cfe] This expression has type 'void' and can't be used. // ^ // [cfe] The method 'call' isn't defined for the class 'void'. @@ -1164,10 +1165,10 @@ // [cfe] This expression has type 'void' and can't be used. global ??= 3; // global_use_in_conditional_assignment_left + // [error column 3] + // [cfe] This expression has type 'void' and can't be used. // ^^^ // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -//^ -// [cfe] This expression has type 'void' and can't be used. Object? xx; xx ??= global; // global_use_in_conditional_assignment_right @@ -1205,11 +1206,11 @@ true ? true - ? x - : x + ? x + : x : true - ? x - : x; // conditional_conditional: ok + ? x + : x; // conditional_conditional: ok for (true ? x : x; false; true ? x : x) {} // conditional_for: ok @@ -1230,10 +1231,10 @@ // [cfe] This expression has type 'void' and can't be used. (true ? x : x) is Object?; // conditional_is -//^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 14] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // ^ + // [cfe] This expression has type 'void' and can't be used. throw true ? x : x; // conditional_throw // ^^^^^^^^^^^^ @@ -1261,8 +1262,8 @@ // [cfe] This expression has type 'void' and can't be used. (true ? x : x) ?? null; // conditional_null_equals1 -//^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 3, length 14] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT // ^ // [cfe] This expression has type 'void' and can't be used. @@ -1294,22 +1295,22 @@ // [cfe] This expression has type 'void' and can't be used. (true ? x : x).toString(); // conditional_toString -//^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 14] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // ^ + // [cfe] This expression has type 'void' and can't be used. (true ? x : x)?.toString(); // conditional_null_dot -//^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 14] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // ^ + // [cfe] This expression has type 'void' and can't be used. (true ? x : x)..toString(); // conditional_cascade -//^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 14] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // ^ + // [cfe] This expression has type 'void' and can't be used. (true ? 499 : x); // conditional2_parens: ok @@ -1317,11 +1318,11 @@ true ? true - ? 499 - : x + ? 499 + : x : true - ? 499 - : x; // conditional2_conditional: ok + ? 499 + : x; // conditional2_conditional: ok for (true ? 499 : x; false; true ? 499 : x) {} // conditional2_for: ok @@ -1342,10 +1343,10 @@ // [cfe] This expression has type 'void' and can't be used. (true ? 499 : x) is Object?; // conditional2_is -//^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 16] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // ^ + // [cfe] This expression has type 'void' and can't be used. throw true ? 499 : x; // conditional2_throw // ^^^^^^^^^^^^^^ @@ -1364,7 +1365,7 @@ // [cfe] This expression has type 'void' and can't be used. var m12 = <int, void>{ - 4: true ? 499 : x + 4: true ? 499 : x, }; // conditional2_literal_map_value_init: ok // conditional2_literal_map_value_init2 @@ -1375,8 +1376,8 @@ // [cfe] This expression has type 'void' and can't be used. (true ? 499 : x) ?? null; // conditional2_null_equals1 -//^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 3, length 16] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT // ^ // [cfe] This expression has type 'void' and can't be used. @@ -1408,22 +1409,22 @@ // [cfe] This expression has type 'void' and can't be used. (true ? 499 : x).toString(); // conditional2_toString -//^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 16] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // ^ + // [cfe] This expression has type 'void' and can't be used. (true ? 499 : x)?.toString(); // conditional2_null_dot -//^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 16] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // ^ + // [cfe] This expression has type 'void' and can't be used. (true ? 499 : x)..toString(); // conditional2_cascade -//^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 16] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // ^ + // [cfe] This expression has type 'void' and can't be used. (true ? x : 499); // conditional3_parens: ok @@ -1431,11 +1432,11 @@ true ? true - ? x - : 499 + ? x + : 499 : true - ? x - : 499; // conditional3_conditional: ok + ? x + : 499; // conditional3_conditional: ok for (true ? x : 499; false; true ? x : 499) {} // conditional3_for: ok @@ -1456,10 +1457,10 @@ // [cfe] This expression has type 'void' and can't be used. (true ? x : 499) is Object?; // conditional3_is -//^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 16] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // ^ + // [cfe] This expression has type 'void' and can't be used. throw true ? x : 499; // conditional3_throw // ^^^^^^^^^^^^^^ @@ -1478,7 +1479,7 @@ // [cfe] This expression has type 'void' and can't be used. var m13 = <int, void>{ - 4: true ? x : 499 + 4: true ? x : 499, }; // conditional3_literal_map_value_init: ok // conditional3_literal_map_value_init2 @@ -1489,8 +1490,8 @@ // [cfe] This expression has type 'void' and can't be used. (true ? x : 499) ?? null; // conditional3_null_equals1 -//^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 3, length 16] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT // ^ // [cfe] This expression has type 'void' and can't be used. @@ -1522,22 +1523,22 @@ // [cfe] This expression has type 'void' and can't be used. (true ? x : 499).toString(); // conditional3_toString -//^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 16] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // ^ + // [cfe] This expression has type 'void' and can't be used. (true ? x : 499)?.toString(); // conditional3_null_dot -//^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 16] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // ^ + // [cfe] This expression has type 'void' and can't be used. (true ? x : 499)..toString(); // conditional3_cascade -//^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 16] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // ^ + // [cfe] This expression has type 'void' and can't be used. } dynamic testVoidConditionalDynamic() { @@ -1611,8 +1612,8 @@ // [cfe] This expression has type 'void' and can't be used. a.x is Object?; // instance_is -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT //^ // [cfe] This expression has type 'void' and can't be used. @@ -1650,8 +1651,8 @@ // [cfe] This expression has type 'void' and can't be used. a.x ?? 499; // instance_null_equals1 -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT //^ // [cfe] This expression has type 'void' and can't be used. @@ -1683,27 +1684,25 @@ // [cfe] This expression has type 'void' and can't be used. a.x += 1; // instance_plus_eq - //^ - // [cfe] This expression has type 'void' and can't be used. // ^^ // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT // [cfe] The operator '+' isn't defined for the class 'void'. a.x.toString(); // instance_toString -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT //^ // [cfe] This expression has type 'void' and can't be used. a.x?.toString(); // instance_null_dot -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT //^ // [cfe] This expression has type 'void' and can't be used. a.x..toString(); // instance_cascade -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT //^ // [cfe] This expression has type 'void' and can't be used. @@ -1736,8 +1735,8 @@ // [cfe] This expression has type 'void' and can't be used. b.x is Object?; // instance2_is -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT //^ // [cfe] This expression has type 'void' and can't be used. @@ -1774,8 +1773,8 @@ // [cfe] This expression has type 'void' and can't be used. b.x ?? 499; // instance2_null_equals1 -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT //^ // [cfe] This expression has type 'void' and can't be used. @@ -1809,27 +1808,25 @@ b.forInTest(); b.x += 1; // instance2_plus_eq - //^ - // [cfe] This expression has type 'void' and can't be used. // ^^ // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT // [cfe] The operator '+' isn't defined for the class 'void'. b.x.toString(); // instance2_toString -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT //^ // [cfe] This expression has type 'void' and can't be used. b.x?.toString(); // instance2_null_dot -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT //^ // [cfe] This expression has type 'void' and can't be used. b.x..toString(); // instance2_cascade -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT //^ // [cfe] This expression has type 'void' and can't be used. @@ -1862,8 +1859,8 @@ // [cfe] This expression has type 'void' and can't be used. c.x is Object?; // instance3_is -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT //^ // [cfe] This expression has type 'void' and can't be used. @@ -1900,8 +1897,8 @@ // [cfe] This expression has type 'void' and can't be used. c.x ?? 499; // instance3_null_equals1 -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT //^ // [cfe] This expression has type 'void' and can't be used. @@ -1935,27 +1932,25 @@ c.forInTest(); c.x += 1; // instance3_plus_eq - //^ - // [cfe] This expression has type 'void' and can't be used. // ^^ // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT // [cfe] The operator '+' isn't defined for the class 'void'. c.x.toString(); // instance3_toString -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT //^ // [cfe] This expression has type 'void' and can't be used. c.x?.toString(); // instance3_null_dot -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT //^ // [cfe] This expression has type 'void' and can't be used. c.x..toString(); // instance3_cascade -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT //^ // [cfe] This expression has type 'void' and can't be used. } @@ -2003,18 +1998,18 @@ // [cfe] This expression has type 'void' and can't be used. (x) is Object?; // paren_is -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 4] + // [cfe] This expression has type 'void' and can't be used. throw (x); // paren_throw // ^^^ // [analyzer] COMPILE_TIME_ERROR.THROW_OF_INVALID_TYPE // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT // ^ - // [cfe] This expression has type 'void' and can't be used. // [cfe] Can't throw a value of 'void' since it is neither dynamic nor non-nullable. + // [cfe] This expression has type 'void' and can't be used. <void>[(x)]; // paren_literal_void_list_init: ok @@ -2041,10 +2036,10 @@ // [cfe] This expression has type 'void' and can't be used. (x) ?? 499; // paren_null_equals1 -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 4] + // [cfe] This expression has type 'void' and can't be used. null ?? (x); // paren_null_equals2: ok @@ -2077,22 +2072,22 @@ // [cfe] This expression has type 'void' and can't be used. (x).toString(); // paren_toString -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 4] + // [cfe] This expression has type 'void' and can't be used. (x)?.toString(); // paren_null_dot -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 4] + // [cfe] This expression has type 'void' and can't be used. (x)..toString(); // paren_cascade -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 4] + // [cfe] This expression has type 'void' and can't be used. if ((x)) {} // paren_conditional_stmt // ^^^ @@ -2101,16 +2096,16 @@ // [cfe] This expression has type 'void' and can't be used. !(x); // paren_boolean_negation -// ^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 4, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT //^ // [cfe] This expression has type 'void' and can't be used. (x) && true; // paren_boolean_and_left -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 4] + // [cfe] This expression has type 'void' and can't be used. true && (x); // paren_boolean_and_right // ^^^ @@ -2119,10 +2114,10 @@ // [cfe] This expression has type 'void' and can't be used. (x) || true; // paren_boolean_or_left -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 4] + // [cfe] This expression has type 'void' and can't be used. true || (x); // paren_boolean_or_right // ^^^ @@ -2131,10 +2126,10 @@ // [cfe] This expression has type 'void' and can't be used. (x) == 3; // paren_equals_left -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 4] + // [cfe] This expression has type 'void' and can't be used. 3 == (x); // paren_equals_right // ^^^ @@ -2161,19 +2156,19 @@ // [cfe] This expression has type 'void' and can't be used. -(x); // paren_negation -//^ -// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe] The operator 'unary-' isn't defined for the class 'void'. -// ^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] The operator 'unary-' isn't defined for the class 'void'. + // [error column 4, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + //^ + // [cfe] This expression has type 'void' and can't be used. (x)(3); // paren_use_as_function -//^^^ -// [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT -// ^ -// [cfe] This expression has type 'void' and can't be used. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.USE_OF_VOID_RESULT + // [error column 4] + // [cfe] This expression has type 'void' and can't be used. // ^ // [cfe] The method 'call' isn't defined for the class 'void'.
diff --git a/tests/language/why_not_promoted/argument_type_not_assignable_nullability_error_test.dart b/tests/language/why_not_promoted/argument_type_not_assignable_nullability_error_test.dart index a4c7116..1119f19 100644 --- a/tests/language/why_not_promoted/argument_type_not_assignable_nullability_error_test.dart +++ b/tests/language/why_not_promoted/argument_type_not_assignable_nullability_error_test.dart
@@ -246,13 +246,11 @@ // ^^^ // [context 14] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field // [context 63] 'bad' refers to a public property so it couldn't be promoted. - C14.assertInitializerCondition(C14 c) - : bad = c.bad!, - assert(c.bad); - // ^^^^^ - // [analyzer 14] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE - // ^ - // [cfe 63] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. + C14.assertInitializerCondition(C14 c) : bad = c.bad!, assert(c.bad); + // ^^^^^ + // [analyzer 14] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // ^ + // [cfe 63] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. } class C15 { @@ -434,13 +432,11 @@ // [context 78] 'bad' refers to a public property so it couldn't be promoted. final int x; final int y; - C23.constructorInitializer(C23 c) - : x = c.bad!, - y = c.bad; - // ^^^^^ - // [analyzer 29] COMPILE_TIME_ERROR.FIELD_INITIALIZER_NOT_ASSIGNABLE - // ^ - // [cfe 78] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't. + C23.constructorInitializer(C23 c) : x = c.bad!, y = c.bad; + // ^^^^^ + // [analyzer 29] COMPILE_TIME_ERROR.FIELD_INITIALIZER_NOT_ASSIGNABLE + // ^ + // [cfe 78] A value of type 'int?' can't be assigned to a variable of type 'int' because 'int?' is nullable and 'int' isn't. } class C24 { @@ -674,13 +670,11 @@ class D34 extends C34 { int other; - D34(C34 c) - : other = c.bad!, - super(c.bad); - // ^^^^^ - // [analyzer 48] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE - // ^ - // [cfe 97] The argument type 'int?' can't be assigned to the parameter type 'int' because 'int?' is nullable and 'int' isn't. + D34(C34 c) : other = c.bad!, super(c.bad); + // ^^^^^ + // [analyzer 48] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // ^ + // [cfe 97] The argument type 'int?' can't be assigned to the parameter type 'int' because 'int?' is nullable and 'int' isn't. } class C35 {
diff --git a/tests/language/why_not_promoted/assignment_error_test.dart b/tests/language/why_not_promoted/assignment_error_test.dart index 9c1c3a4..8dfe0a1 100644 --- a/tests/language/why_not_promoted/assignment_error_test.dart +++ b/tests/language/why_not_promoted/assignment_error_test.dart
@@ -10,62 +10,62 @@ direct_assignment(int? i, int? j) { if (i == null) return; i = j; -//^^^^^ -// [context 6] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write -// [context 10] Variable 'i' could not be promoted due to an assignment. + // [error column 3, length 5] + // [context 1] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write + // [context 10] Variable 'i' could not be promoted due to an assignment. i.isEven; -// ^^^^^^ -// [analyzer 6] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 10] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + //^^^^^^ + // [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 10] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } compound_assignment(C? c, int i) { if (c == null) return; c += i; -//^^^^^^ -// [context 7] Variable 'c' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write -// [context 11] Variable 'c' could not be promoted due to an assignment. + // [error column 3, length 6] + // [context 2] Variable 'c' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write + // [context 11] Variable 'c' could not be promoted due to an assignment. c.cProperty; -// ^^^^^^^^^ -// [analyzer 7] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 11] Property 'cProperty' cannot be accessed on 'C?' because it is potentially null. + //^^^^^^^^^ + // [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 11] Property 'cProperty' cannot be accessed on 'C?' because it is potentially null. } via_postfix_op(C? c) { if (c == null) return; c++; -//^^^ -// [context 4] Variable 'c' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write -// [context 12] Variable 'c' could not be promoted due to an assignment. + // [error column 3, length 3] + // [context 3] Variable 'c' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write + // [context 12] Variable 'c' could not be promoted due to an assignment. c.cProperty; -// ^^^^^^^^^ -// [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 12] Property 'cProperty' cannot be accessed on 'C?' because it is potentially null. + //^^^^^^^^^ + // [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 12] Property 'cProperty' cannot be accessed on 'C?' because it is potentially null. } via_prefix_op(C? c) { if (c == null) return; ++c; -//^^^ -// [context 9] Variable 'c' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write + // [error column 3, length 3] + // [context 4] Variable 'c' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write //^ // [context 13] Variable 'c' could not be promoted due to an assignment. c.cProperty; -// ^^^^^^^^^ -// [analyzer 9] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 13] Property 'cProperty' cannot be accessed on 'C?' because it is potentially null. + //^^^^^^^^^ + // [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 13] Property 'cProperty' cannot be accessed on 'C?' because it is potentially null. } via_for_each_statement(int? i, List<int?> list) { if (i == null) return; for (i in list) { // ^ - // [context 3] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write + // [context 5] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write // [context 14] Variable 'i' could not be promoted due to an assignment. i.isEven; -// ^^^^^^ -// [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 14] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + //^^^^^^ + // [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 14] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } } @@ -73,10 +73,10 @@ if (i == null) return; [for (i in list) i.isEven]; // ^ - // [context 8] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write + // [context 6] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write // [context 15] Variable 'i' could not be promoted due to an assignment. // ^^^^^^ - // [analyzer 8] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 6] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // [cfe 15] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } @@ -84,10 +84,10 @@ if (i == null) return; ({for (i in list) i.isEven}); // ^ - // [context 1] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write + // [context 7] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write // [context 16] Variable 'i' could not be promoted due to an assignment. // ^^^^^^ - // [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 7] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // [cfe 16] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } @@ -95,10 +95,10 @@ if (i == null) return; ({for (i in list) i.isEven: null}); // ^ - // [context 2] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write + // [context 8] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write // [context 17] Variable 'i' could not be promoted due to an assignment. // ^^^^^^ - // [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 8] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // [cfe 17] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } @@ -106,9 +106,9 @@ if (i == null) return; ({for (i in list) null: i.isEven}); // ^ - // [context 5] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write + // [context 9] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write // [context 18] Variable 'i' could not be promoted due to an assignment. // ^^^^^^ - // [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 9] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // [cfe 18] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. }
diff --git a/tests/language/why_not_promoted/extension_property_error_test.dart b/tests/language/why_not_promoted/extension_property_error_test.dart index 26e84bf..a1c545b 100644 --- a/tests/language/why_not_promoted/extension_property_error_test.dart +++ b/tests/language/why_not_promoted/extension_property_error_test.dart
@@ -6,25 +6,25 @@ get_property_via_explicit_this() { if (this.i == null) return; this.i.isEven; -// ^^^^^^ -// [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 6] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // ^^^^^^ + // [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 6] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } get_property_via_explicit_this_parenthesized() { if ((this).i == null) return; (this).i.isEven; -// ^^^^^^ -// [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 7] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // ^^^^^^ + // [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 7] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } get_property_by_implicit_this() { if (i == null) return; i.isEven; -// ^^^^^^ -// [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 8] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + //^^^^^^ + // [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 8] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } } @@ -48,18 +48,18 @@ get_property_by_implicit_super() { if (i == null) return; i.isEven; -// ^^^^^^ -// [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 9] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + //^^^^^^ + // [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 9] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } } get_property_via_prefixed_identifier(C c) { if (c.i == null) return; c.i.isEven; -// ^^^^^^ -// [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 10] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // ^^^^^^ + // [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 10] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } get_property_via_prefixed_identifier_mismatched_target(C c1, C c2) { @@ -67,9 +67,9 @@ // to promote is on c1, but the property the user is accessing is on c2. if (c1.i == null) return; c2.i.isEven; -// ^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // ^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } get_property_via_prefixed_identifier_mismatched_property(C c) { @@ -77,7 +77,7 @@ // to promote is C.i, but the property the user is accessing is C.j. if (c.i == null) return; c.j.isEven; -// ^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // ^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. }
diff --git a/tests/language/why_not_promoted/field_error_test.dart b/tests/language/why_not_promoted/field_error_test.dart index dc4fb1c..bff3464 100644 --- a/tests/language/why_not_promoted/field_error_test.dart +++ b/tests/language/why_not_promoted/field_error_test.dart
@@ -22,25 +22,25 @@ get_field_via_explicit_this() { if (this.i == null) return; this.i.isEven; -// ^^^^^^ -// [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 7] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // ^^^^^^ + // [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 7] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } get_field_via_explicit_this_parenthesized() { if ((this).i == null) return; (this).i.isEven; -// ^^^^^^ -// [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 8] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // ^^^^^^ + // [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 8] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } get_field_by_implicit_this() { if (i == null) return; i.isEven; -// ^^^^^^ -// [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 9] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + //^^^^^^ + // [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 9] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } } @@ -48,26 +48,26 @@ get_field_via_explicit_super() { if (super.i == null) return; super.i.isEven; -// ^^^^^^ -// [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 10] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // ^^^^^^ + // [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 10] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } get_field_by_implicit_super() { if (i == null) return; i.isEven; -// ^^^^^^ -// [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 11] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + //^^^^^^ + // [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 11] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } } get_field_via_prefixed_identifier(C c) { if (c.i == null) return; c.i.isEven; -// ^^^^^^ -// [analyzer 6] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 12] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // ^^^^^^ + // [analyzer 6] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 12] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } get_field_via_prefixed_identifier_mismatched_target(C c1, C c2) { @@ -75,9 +75,9 @@ // to promote is on c1, but the property the user is accessing is on c2. if (c1.i == null) return; c2.i.isEven; -// ^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // ^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } get_field_via_prefixed_identifier_mismatched_property(C c) { @@ -85,7 +85,7 @@ // to promote is C.i, but the property the user is accessing is C.j. if (c.i == null) return; c.j.isEven; -// ^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // ^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. }
diff --git a/tests/language/why_not_promoted/nullable_expression_call_error_test.dart b/tests/language/why_not_promoted/nullable_expression_call_error_test.dart index eec92a4..012ecff 100644 --- a/tests/language/why_not_promoted/nullable_expression_call_error_test.dart +++ b/tests/language/why_not_promoted/nullable_expression_call_error_test.dart
@@ -20,10 +20,10 @@ instance_method_invocation(C1 c) { if (c.bad == null) return; c.bad(); -//^^^^^ -// [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// ^ -// [cfe 7] Can't use an expression of type 'C2?' as a function because it's potentially null. + // [error column 3, length 5] + // [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // ^ + // [cfe 7] Can't use an expression of type 'C2?' as a function because it's potentially null. } class C3 { @@ -51,10 +51,10 @@ c.ok(); if (c.bad == null) return; c.bad(); -//^^^^^ -// [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// ^ -// [cfe 8] Can't use an expression of type 'C5?' as a function because it's potentially null. + // [error column 3, length 5] + // [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // ^ + // [cfe 8] Can't use an expression of type 'C5?' as a function because it's potentially null. } class C6 { @@ -71,11 +71,11 @@ instance_getter_invocation(C6 c) { if (c.bad == null) return; c.bad(); -//^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVOCATION_OF_NON_FUNCTION_EXPRESSION -// [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// ^ -// [cfe 9] Can't use an expression of type 'C7?' as a function because it's potentially null. + // [error column 3, length 5] + // [analyzer] COMPILE_TIME_ERROR.INVOCATION_OF_NON_FUNCTION_EXPRESSION + // [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // ^ + // [cfe 9] Can't use an expression of type 'C7?' as a function because it's potentially null. } class C8 { @@ -94,10 +94,10 @@ extension_invocation_getter(C8 c) { if (c.bad == null) return; c.bad(); -//^^^^^ -// [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// ^ -// [cfe 10] Can't use an expression of type 'C10?' as a function because it's potentially null. + // [error column 3, length 5] + // [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // ^ + // [cfe 10] Can't use an expression of type 'C10?' as a function because it's potentially null. } class C11 { @@ -110,10 +110,10 @@ function_invocation(C11 c) { if (c.bad == null) return; c.bad(); -//^^^^^ -// [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// ^ -// [cfe 11] Can't use an expression of type 'void Function()?' as a function because it's potentially null. + // [error column 3, length 5] + // [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // ^ + // [cfe 11] Can't use an expression of type 'void Function()?' as a function because it's potentially null. } class C12 { @@ -133,7 +133,7 @@ // Note: the CFE error message is misleading here. See // https://github.com/dart-lang/sdk/issues/45552 c.bad.foo(); -// ^^^ -// [analyzer 6] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 12] Can't use an expression of type 'C13?' as a function because it's potentially null. + // ^^^ + // [analyzer 6] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 12] Can't use an expression of type 'C13?' as a function because it's potentially null. }
diff --git a/tests/language/why_not_promoted/nullable_method_call_error_test.dart b/tests/language/why_not_promoted/nullable_method_call_error_test.dart index 0c22880..4ebb54e 100644 --- a/tests/language/why_not_promoted/nullable_method_call_error_test.dart +++ b/tests/language/why_not_promoted/nullable_method_call_error_test.dart
@@ -36,66 +36,66 @@ property_get_of_variable(int? i, int? j) { if (i == null) return; i = j; -//^^^^^ -// [context 1] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write -// [context 8] Variable 'i' could not be promoted due to an assignment. + // [error column 3, length 5] + // [context 1] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write + // [context 8] Variable 'i' could not be promoted due to an assignment. i.isEven; -// ^^^^^^ -// [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 8] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + //^^^^^^ + // [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 8] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } extension_property_get_of_variable(int? i, int? j) { if (i == null) return; i = j; -//^^^^^ -// [context 2] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write -// [context 9] Variable 'i' could not be promoted due to an assignment. + // [error column 3, length 5] + // [context 2] Variable 'i' could not be promoted due to an assignment. See http://dart.dev/go/non-promo-write + // [context 9] Variable 'i' could not be promoted due to an assignment. i.propertyOnNullableInt; i.propertyOnNonNullInt; -// ^^^^^^^^^^^^^^^^^^^^ -// [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 9] Property 'propertyOnNonNullInt' cannot be accessed on 'int?' because it is potentially null. + //^^^^^^^^^^^^^^^^^^^^ + // [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 9] Property 'propertyOnNonNullInt' cannot be accessed on 'int?' because it is potentially null. } property_get_of_expression(C c) { if (c.i == null) return; c.i.isEven; -// ^^^^^^ -// [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 10] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // ^^^^^^ + // [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 10] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } extension_property_get_of_expression(C c) { if (c.i == null) return; c.i.propertyOnNullableInt; c.i.propertyOnNonNullInt; -// ^^^^^^^^^^^^^^^^^^^^ -// [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 11] Property 'propertyOnNonNullInt' cannot be accessed on 'int?' because it is potentially null. + // ^^^^^^^^^^^^^^^^^^^^ + // [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 11] Property 'propertyOnNonNullInt' cannot be accessed on 'int?' because it is potentially null. } method_invocation(C c) { if (c.i == null) return; c.i.abs(); -// ^^^ -// [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 12] Method 'abs' cannot be called on 'int?' because it is potentially null. + // ^^^ + // [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 12] Method 'abs' cannot be called on 'int?' because it is potentially null. } extension_method_invocation(C c) { if (c.i == null) return; c.i.methodOnNullableInt(); c.i.methodOnNonNullInt(); -// ^^^^^^^^^^^^^^^^^^ -// [analyzer 6] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 13] Method 'methodOnNonNullInt' cannot be called on 'int?' because it is potentially null. + // ^^^^^^^^^^^^^^^^^^ + // [analyzer 6] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 13] Method 'methodOnNonNullInt' cannot be called on 'int?' because it is potentially null. } call_invocation(C c) { if (c.f == null) return; c.f.call(); -// ^^^^ -// [analyzer 7] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 14] Method 'call' cannot be called on 'void Function()?' because it is potentially null. + // ^^^^ + // [analyzer 7] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 14] Method 'call' cannot be called on 'void Function()?' because it is potentially null. }
diff --git a/tests/language/why_not_promoted/nullable_operator_call_error_test.dart b/tests/language/why_not_promoted/nullable_operator_call_error_test.dart index 808f858..391e1ad 100644 --- a/tests/language/why_not_promoted/nullable_operator_call_error_test.dart +++ b/tests/language/why_not_promoted/nullable_operator_call_error_test.dart
@@ -31,7 +31,7 @@ userDefinableUnaryOp(C2 c) { if (c.bad == null) return; -c.bad; -//^ -// [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 4] Operator 'unary-' cannot be called on 'int?' because it is potentially null. + // [error column 3, length 1] + // [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 4] Operator 'unary-' cannot be called on 'int?' because it is potentially null. }
diff --git a/tests/language/why_not_promoted/property_error_test.dart b/tests/language/why_not_promoted/property_error_test.dart index 1bf987c..7b852cd 100644 --- a/tests/language/why_not_promoted/property_error_test.dart +++ b/tests/language/why_not_promoted/property_error_test.dart
@@ -22,25 +22,25 @@ get_property_via_explicit_this() { if (this.i == null) return; this.i.isEven; -// ^^^^^^ -// [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 7] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // ^^^^^^ + // [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 7] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } get_property_via_explicit_this_parenthesized() { if ((this).i == null) return; (this).i.isEven; -// ^^^^^^ -// [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 8] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // ^^^^^^ + // [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 8] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } get_property_by_implicit_this() { if (i == null) return; i.isEven; -// ^^^^^^ -// [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 9] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + //^^^^^^ + // [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 9] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } } @@ -48,26 +48,26 @@ get_property_via_explicit_super() { if (super.i == null) return; super.i.isEven; -// ^^^^^^ -// [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 10] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // ^^^^^^ + // [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 10] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } get_property_by_implicit_super() { if (i == null) return; i.isEven; -// ^^^^^^ -// [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 11] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + //^^^^^^ + // [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 11] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } } get_property_via_prefixed_identifier(C c) { if (c.i == null) return; c.i.isEven; -// ^^^^^^ -// [analyzer 6] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe 12] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // ^^^^^^ + // [analyzer 6] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe 12] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } get_property_via_prefixed_identifier_mismatched_target(C c1, C c2) { @@ -75,9 +75,9 @@ // to promote is on c1, but the property the user is accessing is on c2. if (c1.i == null) return; c2.i.isEven; -// ^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // ^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } get_property_via_prefixed_identifier_mismatched_property(C c) { @@ -85,7 +85,7 @@ // to promote is C.i, but the property the user is accessing is C.j. if (c.i == null) return; c.j.isEven; -// ^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // ^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. }
diff --git a/tests/language/why_not_promoted/this_error_test.dart b/tests/language/why_not_promoted/this_error_test.dart index 87d98c9..c4f1587 100644 --- a/tests/language/why_not_promoted/this_error_test.dart +++ b/tests/language/why_not_promoted/this_error_test.dart
@@ -13,20 +13,20 @@ extension_explicit_this() { if (this == null) return; this.isEven; -// ^^^^^^ -// [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [context 1] 'this' can't be promoted. See http://dart.dev/go/non-promo-this -// [cfe 3] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. -// [context 3] 'this' can't be promoted. + // ^^^^^^ + // [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [context 1] 'this' can't be promoted. See http://dart.dev/go/non-promo-this + // [cfe 3] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // [context 3] 'this' can't be promoted. } extension_implicit_this() { if (this == null) return; isEven; -// ^^^^^^ -// [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE -// [context 2] 'this' can't be promoted. See http://dart.dev/go/non-promo-this -// [cfe 4] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. -// [context 4] 'this' can't be promoted. + // [error column 5, length 6] + // [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [context 2] 'this' can't be promoted. See http://dart.dev/go/non-promo-this + // [cfe 4] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // [context 4] 'this' can't be promoted. } }
diff --git a/tests/language/wildcard_variables/declarations/local_function_error_test.dart b/tests/language/wildcard_variables/declarations/local_function_error_test.dart index 04035ed..dc65880 100644 --- a/tests/language/wildcard_variables/declarations/local_function_error_test.dart +++ b/tests/language/wildcard_variables/declarations/local_function_error_test.dart
@@ -7,8 +7,8 @@ void main() { void _() {} - /*indent*/ _(); - // ^ + _(); + // [error column 3, length 1] // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_FUNCTION // [cfe] Method not found: '_'. }
diff --git a/tests/language/wildcard_variables/feature_enabled_error_test.dart b/tests/language/wildcard_variables/feature_enabled_error_test.dart index f796260..fb2a5d1 100644 --- a/tests/language/wildcard_variables/feature_enabled_error_test.dart +++ b/tests/language/wildcard_variables/feature_enabled_error_test.dart
@@ -7,7 +7,7 @@ main() { int _ = 1; _ = 2; -//^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Setter not found: '_'. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Setter not found: '_'. }
diff --git a/tests/language/wildcard_variables/import/import_error_test.dart b/tests/language/wildcard_variables/import/import_error_test.dart index 108d9ec..fcaff74 100644 --- a/tests/language/wildcard_variables/import/import_error_test.dart +++ b/tests/language/wildcard_variables/import/import_error_test.dart
@@ -11,23 +11,23 @@ var value = 'str'; _.topLevel; -//^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Undefined name '_'. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Undefined name '_'. _.C(value); -//^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Undefined name '_'. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Undefined name '_'. // Private extensions can't be used. value.bar; -// ^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER -// [cfe] The getter 'bar' isn't defined for the class 'String'. + // ^^^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'bar' isn't defined for the class 'String'. value.fn; -// ^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER -// [cfe] The getter 'fn' isn't defined for the class 'String'. + // ^^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'fn' isn't defined for the class 'String'. }
diff --git a/tests/language/wildcard_variables/import/import_lib.dart b/tests/language/wildcard_variables/import/import_lib.dart index 8261192..ebd2c6f 100644 --- a/tests/language/wildcard_variables/import/import_lib.dart +++ b/tests/language/wildcard_variables/import/import_lib.dart
@@ -8,9 +8,7 @@ final bool bar; final bool fn; - C(String str) - : bar = str.bar, - fn = str.fn; + C(String str) : bar = str.bar, fn = str.fn; } extension StringExtension on String {
diff --git a/tests/language/wildcard_variables/initializing_formal_parameters/this_initializer_access_error_test.dart b/tests/language/wildcard_variables/initializing_formal_parameters/this_initializer_access_error_test.dart index 87dade9..4e6b6b7 100644 --- a/tests/language/wildcard_variables/initializing_formal_parameters/this_initializer_access_error_test.dart +++ b/tests/language/wildcard_variables/initializing_formal_parameters/this_initializer_access_error_test.dart
@@ -9,9 +9,9 @@ var other; C(this._) : other = _; -// ^ -// [analyzer] COMPILE_TIME_ERROR.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER -// [cfe] Can't access 'this' in a field initializer to read '_'. + // ^ + // [analyzer] COMPILE_TIME_ERROR.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER + // [cfe] Can't access 'this' in a field initializer to read '_'. } class CWithTypeParameter<_> { @@ -19,7 +19,7 @@ var other; CWithTypeParameter(this._) : other = _; -// ^ -// [analyzer] COMPILE_TIME_ERROR.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER -// [cfe] Can't access 'this' in a field initializer to read '_'. + // ^ + // [analyzer] COMPILE_TIME_ERROR.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER + // [cfe] Can't access 'this' in a field initializer to read '_'. }
diff --git a/tests/language/wildcard_variables/initializing_formal_parameters/this_initializer_multiple_error_test.dart b/tests/language/wildcard_variables/initializing_formal_parameters/this_initializer_multiple_error_test.dart index 0f06295..bc540bd4 100644 --- a/tests/language/wildcard_variables/initializing_formal_parameters/this_initializer_multiple_error_test.dart +++ b/tests/language/wildcard_variables/initializing_formal_parameters/this_initializer_multiple_error_test.dart
@@ -8,12 +8,12 @@ var _; C(this._, this._); -// ^ -// [analyzer] COMPILE_TIME_ERROR.DUPLICATE_FIELD_FORMAL_PARAMETER -// [cfe] '_' was already initialized by this constructor. + // ^ + // [analyzer] COMPILE_TIME_ERROR.DUPLICATE_FIELD_FORMAL_PARAMETER + // [cfe] '_' was already initialized by this constructor. C.named(this._, this._); -// ^ -// [analyzer] COMPILE_TIME_ERROR.DUPLICATE_FIELD_FORMAL_PARAMETER -// [cfe] '_' was already initialized by this constructor. + // ^ + // [analyzer] COMPILE_TIME_ERROR.DUPLICATE_FIELD_FORMAL_PARAMETER + // [cfe] '_' was already initialized by this constructor. }
diff --git a/tests/language/wildcard_variables/multiple/local_declaration_for_loop_test.dart b/tests/language/wildcard_variables/multiple/local_declaration_for_loop_test.dart index 7b25fd0..09832c7 100644 --- a/tests/language/wildcard_variables/multiple/local_declaration_for_loop_test.dart +++ b/tests/language/wildcard_variables/multiple/local_declaration_for_loop_test.dart
@@ -8,7 +8,7 @@ void main() async { // Multiple for-loop wildcard declarations. - for (int _ = 0, _ = 2;;) { + for (int _ = 0, _ = 2; ;) { break; }
diff --git a/tests/language/wildcard_variables/multiple/local_declaration_function_parameter_test.dart b/tests/language/wildcard_variables/multiple/local_declaration_function_parameter_test.dart index 8de9c41..5b11425 100644 --- a/tests/language/wildcard_variables/multiple/local_declaration_function_parameter_test.dart +++ b/tests/language/wildcard_variables/multiple/local_declaration_function_parameter_test.dart
@@ -59,22 +59,23 @@ static int staticMethod2(_, _) => 2; static int staticMethod_functionType(void _(), void _()) => 2; static int staticMethod_functionTypeNested( - void _(_, _), void _(int _, int _)) => - 2; + void _(_, _), + void _(int _, int _), + ) => 2; static int staticMethod_functionTypeNew( - void Function(int _, int _) _, void Function(int _, int _) _) => - 2; + void Function(int _, int _) _, + void Function(int _, int _) _, + ) => 2; static int staticMethod_functionTypeGeneric( - void Function<_, _>(int _, int _) _, void _<_>(_, _)) => - 2; + void Function<_, _>(int _, int _) _, + void _<_>(_, _), + ) => 2; } void main() { // Function expression var list = [true]; - list.where( - (_, [_]) => true, - ); + list.where((_, [_]) => true); // Abstract methods var abstractMethod = AbstractMethodSubclass();
diff --git a/tests/lib/async/async_await_sync_completer_test.dart b/tests/lib/async/async_await_sync_completer_test.dart index 31738be..941ca80 100644 --- a/tests/lib/async/async_await_sync_completer_test.dart +++ b/tests/lib/async/async_await_sync_completer_test.dart
@@ -17,9 +17,9 @@ // install handlers. When the function finishes, it can then synchronously // propagate the values. await null; - new Future.microtask(() => 'in microtask') - .then(events.add) - .then(delayedValue.complete); + new Future.microtask( + () => 'in microtask', + ).then(events.add).then(delayedValue.complete); return 'in async function'; } @@ -28,9 +28,9 @@ // install handlers. When the function finishes, it can then synchronously // propagate the values. await null; - new Future<void>.microtask(() => throw 'in microtask error') - .catchError(events.add) - .then(delayedError.complete); + new Future<void>.microtask( + () => throw 'in microtask error', + ).catchError(events.add).then(delayedError.complete); throw 'in async function error'; } @@ -42,7 +42,7 @@ asyncValueFuture, delayedValue.future, asyncErrorFuture, - delayedError.future + delayedError.future, ]).then((_) { // The body completed before nested microtask. So they should appear // before the delayed functions. In other words, the async function should @@ -51,7 +51,7 @@ "in async function", "in async function error", "in microtask", - "in microtask error" + "in microtask error", ], events); asyncEnd(); });
diff --git a/tests/lib/async/async_await_zones_test.dart b/tests/lib/async/async_await_zones_test.dart index f2d1864..42ce70f 100644 --- a/tests/lib/async/async_await_zones_test.dart +++ b/tests/lib/async/async_await_zones_test.dart
@@ -95,7 +95,11 @@ } ZoneCallback<R> registerCallback<R>( - Zone self, ZoneDelegate parent, Zone zone, R f()) { + Zone self, + ZoneDelegate parent, + Zone zone, + R f(), +) { var oldDepth = depth; increaseDepth(); return parent.registerCallback(zone, () { @@ -105,7 +109,11 @@ } ZoneUnaryCallback<R, T> registerUnaryCallback<R, T>( - Zone self, ZoneDelegate parent, Zone zone, R f(T arg)) { + Zone self, + ZoneDelegate parent, + Zone zone, + R f(T arg), +) { var oldDepth = depth; increaseDepth(); return parent.registerUnaryCallback(zone, (x) { @@ -115,7 +123,11 @@ } ZoneBinaryCallback<R, T1, T2> registerBinaryCallback<R, T1, T2>( - Zone self, ZoneDelegate parent, Zone zone, R f(T1 arg1, T2 arg2)) { + Zone self, + ZoneDelegate parent, + Zone zone, + R f(T1 arg1, T2 arg2), +) { var oldDepth = depth; increaseDepth(); return parent.registerBinaryCallback(zone, (x, y) { @@ -136,10 +148,11 @@ main() { asyncStart(); var desc = new ZoneSpecification( - registerCallback: registerCallback, - registerUnaryCallback: registerUnaryCallback, - registerBinaryCallback: registerBinaryCallback, - scheduleMicrotask: sm); + registerCallback: registerCallback, + registerUnaryCallback: registerUnaryCallback, + registerBinaryCallback: registerBinaryCallback, + scheduleMicrotask: sm, + ); var future = runZoned(runTests, zoneSpecification: desc); future.then((_) => asyncEnd()); }
diff --git a/tests/lib/async/async_no_await_zones_test.dart b/tests/lib/async/async_no_await_zones_test.dart index 4391752..ee4d89a 100644 --- a/tests/lib/async/async_no_await_zones_test.dart +++ b/tests/lib/async/async_no_await_zones_test.dart
@@ -11,15 +11,18 @@ main() { asyncStart(); - runZoned(() { - dynamic d = new AsyncDoEvent(); - return d.doEvent(); - }, zoneSpecification: new ZoneSpecification( - scheduleMicrotask: (self, parent, zone, fn) { - log.add('scheduleMicrotask()'); - return parent.scheduleMicrotask(zone, fn); + runZoned( + () { + dynamic d = new AsyncDoEvent(); + return d.doEvent(); }, - )).then((_) { + zoneSpecification: new ZoneSpecification( + scheduleMicrotask: (self, parent, zone, fn) { + log.add('scheduleMicrotask()'); + return parent.scheduleMicrotask(zone, fn); + }, + ), + ).then((_) { Expect.listEquals(log, ['doEvent()', 'scheduleMicrotask()']); asyncEnd(); });
diff --git a/tests/lib/async/catch_errors.dart b/tests/lib/async/catch_errors.dart index f2a5bc4..ebe58b3 100644 --- a/tests/lib/async/catch_errors.dart +++ b/tests/lib/async/catch_errors.dart
@@ -22,25 +22,37 @@ return controller.stream; } -runZonedScheduleMicrotask(body(), - {void onScheduleMicrotask(void callback())?, Function? onError}) { +runZonedScheduleMicrotask( + body(), { + void onScheduleMicrotask(void callback())?, + Function? onError, +}) { if (onScheduleMicrotask == null) { return runZonedGuarded(body, onError as void Function(Object, StackTrace)); } HandleUncaughtErrorHandler? errorHandler; if (onError != null) { - errorHandler = (Zone self, ZoneDelegate parent, Zone zone, error, - StackTrace stackTrace) { - try { - return self.parent!.runUnary(onError as void Function(Object), error); - } catch (e, s) { - if (identical(e, error)) { - return parent.handleUncaughtError(zone, error, stackTrace); - } else { - return parent.handleUncaughtError(zone, e, s); - } - } - }; + errorHandler = + ( + Zone self, + ZoneDelegate parent, + Zone zone, + error, + StackTrace stackTrace, + ) { + try { + return self.parent!.runUnary( + onError as void Function(Object), + error, + ); + } catch (e, s) { + if (identical(e, error)) { + return parent.handleUncaughtError(zone, error, stackTrace); + } else { + return parent.handleUncaughtError(zone, e, s); + } + } + }; } ScheduleMicrotaskHandler? asyncHandler; if (onScheduleMicrotask != null) { @@ -49,7 +61,9 @@ }; } ZoneSpecification specification = new ZoneSpecification( - handleUncaughtError: errorHandler, scheduleMicrotask: asyncHandler); + handleUncaughtError: errorHandler, + scheduleMicrotask: asyncHandler, + ); Zone zone = Zone.current.fork(specification: specification); if (onError != null) { return zone.runGuarded(body);
diff --git a/tests/lib/async/catch_errors11_test.dart b/tests/lib/async/catch_errors11_test.dart index 80abb51..99ac9fe 100644 --- a/tests/lib/async/catch_errors11_test.dart +++ b/tests/lib/async/catch_errors11_test.dart
@@ -22,11 +22,14 @@ done.complete(true); throw "timer error"; }); - }).listen((x) { - events.add(x); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + events.add(x); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.future.whenComplete(() { // Give the handler time to execute.
diff --git a/tests/lib/async/catch_errors12_test.dart b/tests/lib/async/catch_errors12_test.dart index fd679f6..3d2828d 100644 --- a/tests/lib/async/catch_errors12_test.dart +++ b/tests/lib/async/catch_errors12_test.dart
@@ -31,11 +31,14 @@ }); }); throw "catch error"; - }).listen((x) { - events.add(x); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + events.add(x); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.future.whenComplete(() { // Give time to execute the callbacks. Timer.run(() {
diff --git a/tests/lib/async/catch_errors13_test.dart b/tests/lib/async/catch_errors13_test.dart index 31ea21e..20de8fd 100644 --- a/tests/lib/async/catch_errors13_test.dart +++ b/tests/lib/async/catch_errors13_test.dart
@@ -66,12 +66,15 @@ throw "timer outer"; }); throw "inner throw"; - }).listen((x) { - events.add(x); - if (x == "inner done throw") done.complete(true); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + events.add(x); + if (x == "inner done throw") done.complete(true); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.future.whenComplete(() { // Give callbacks time to run. @@ -86,7 +89,7 @@ "timer outer", "delayed error", "scheduleMicrotask", - "inner done throw" + "inner done throw", ], events); asyncEnd(); });
diff --git a/tests/lib/async/catch_errors14_test.dart b/tests/lib/async/catch_errors14_test.dart index ac54322..d0f7389 100644 --- a/tests/lib/async/catch_errors14_test.dart +++ b/tests/lib/async/catch_errors14_test.dart
@@ -24,11 +24,14 @@ } throw "error $counter"; }); - }).listen((x) { - events.add(x); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + events.add(x); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.future.whenComplete(() { // Give time to complete the handlers.
diff --git a/tests/lib/async/catch_errors15_test.dart b/tests/lib/async/catch_errors15_test.dart index 35e1677..da6d2e9 100644 --- a/tests/lib/async/catch_errors15_test.dart +++ b/tests/lib/async/catch_errors15_test.dart
@@ -25,19 +25,25 @@ throw "delayed error"; }); throw "catch error"; - }).listen((x) { - events.add("i $x"); - if (x == "delayed error") done.complete(true); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + events.add("i $x"); + if (x == "delayed error") done.complete(true); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); events.add("after inner"); throw "inner throw"; - }).listen((x) { - events.add("o $x"); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + events.add("o $x"); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.future.whenComplete(() { // Give some time to run the handlers. Timer.run(() {
diff --git a/tests/lib/async/catch_errors16_test.dart b/tests/lib/async/catch_errors16_test.dart index 4b958df..1ac6368 100644 --- a/tests/lib/async/catch_errors16_test.dart +++ b/tests/lib/async/catch_errors16_test.dart
@@ -23,17 +23,22 @@ events.add(x); }); stream - .transform(new StreamTransformer.fromHandlers(handleError: (e, st, sink) { - sink.add("error $e"); - })).listen((x) { - events.add("stream $x"); - }, onDone: () { - Expect.listEquals([ - "stream 101", - "stream error 2", - ], events); - asyncEnd(); - }); + .transform( + new StreamTransformer.fromHandlers( + handleError: (e, st, sink) { + sink.add("error $e"); + }, + ), + ) + .listen( + (x) { + events.add("stream $x"); + }, + onDone: () { + Expect.listEquals(["stream 101", "stream error 2"], events); + asyncEnd(); + }, + ); controller.add(1); controller.addError(2); controller.close();
diff --git a/tests/lib/async/catch_errors17_test.dart b/tests/lib/async/catch_errors17_test.dart index f944575..d32c60b 100644 --- a/tests/lib/async/catch_errors17_test.dart +++ b/tests/lib/async/catch_errors17_test.dart
@@ -19,15 +19,21 @@ catchErrors(() { catchErrors(() { controller = new StreamController(); - controller.stream.map((x) { - events.add("map $x"); - return x + 100; - }).transform( - new StreamTransformer.fromHandlers(handleError: (e, st, sink) { - sink.add("error $e"); - })).listen((x) { - events.add("stream $x"); - }); + controller.stream + .map((x) { + events.add("map $x"); + return x + 100; + }) + .transform( + new StreamTransformer.fromHandlers( + handleError: (e, st, sink) { + sink.add("error $e"); + }, + ), + ) + .listen((x) { + events.add("stream $x"); + }); }).listen((x) { events.add(x); }); @@ -35,12 +41,15 @@ controller.addError(2); new Future.error("outer error"); controller.close(); - }).listen((x) { - events.add("outer: $x"); - if (x == "outer error") done.complete(true); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + events.add("outer: $x"); + if (x == "outer error") done.complete(true); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.future.whenComplete(() { Timer.run(() {
diff --git a/tests/lib/async/catch_errors18_test.dart b/tests/lib/async/catch_errors18_test.dart index 7c18d930..e32a56e 100644 --- a/tests/lib/async/catch_errors18_test.dart +++ b/tests/lib/async/catch_errors18_test.dart
@@ -14,8 +14,10 @@ Completer done = new Completer(); var events = []; - Stream stream = - new Stream.periodic(const Duration(milliseconds: 20), (x) => x); + Stream stream = new Stream.periodic( + const Duration(milliseconds: 20), + (x) => x, + ); // Test that errors of periodic streams are caught. catchErrors(() { var subscription; @@ -28,11 +30,14 @@ } events.add(x); }); - }).listen((x) { - events.add("outer: $x"); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + events.add("outer: $x"); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.future.whenComplete(() { // Give handlers time to run.
diff --git a/tests/lib/async/catch_errors19_test.dart b/tests/lib/async/catch_errors19_test.dart index ba77ede..1282c73 100644 --- a/tests/lib/async/catch_errors19_test.dart +++ b/tests/lib/async/catch_errors19_test.dart
@@ -14,25 +14,35 @@ Completer done = new Completer(); var events = []; - Stream stream = - new Stream.periodic(const Duration(milliseconds: 20), (x) => x); + Stream stream = new Stream.periodic( + const Duration(milliseconds: 20), + (x) => x, + ); // Test that asynchronous callbacks in the done-handler of streams (here // the `catchErrors`-stream) keep a zone alive. catchErrors(() { var subscription; - subscription = stream.take(5).listen((x) { - events.add(x); - }, onDone: () { - new Future.delayed(const Duration(milliseconds: 30), () { - events.add(499); - done.complete(true); - }); - }); - }).listen((x) { - events.add("outer: $x"); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + subscription = stream + .take(5) + .listen( + (x) { + events.add(x); + }, + onDone: () { + new Future.delayed(const Duration(milliseconds: 30), () { + events.add(499); + done.complete(true); + }); + }, + ); + }).listen( + (x) { + events.add("outer: $x"); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.future.whenComplete(() { // Give handlers time to run.
diff --git a/tests/lib/async/catch_errors20_test.dart b/tests/lib/async/catch_errors20_test.dart index 841fb56..2299408 100644 --- a/tests/lib/async/catch_errors20_test.dart +++ b/tests/lib/async/catch_errors20_test.dart
@@ -23,24 +23,26 @@ events.add(42); done.complete(true); }); - }).listen(events.add, onDone: () { - events.add("done"); - }); + }).listen( + events.add, + onDone: () { + events.add("done"); + }, + ); throw "foo"; - }).listen((x) { - events.add("outer: $x"); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + events.add("outer: $x"); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.future.whenComplete(() { // Give handlers time to run. Timer.run(() { - Expect.listEquals([ - "outer: foo", - 499, - 42, - ], events); + Expect.listEquals(["outer: foo", 499, 42], events); asyncEnd(); }); });
diff --git a/tests/lib/async/catch_errors21_test.dart b/tests/lib/async/catch_errors21_test.dart index f1a1714..ef80d90 100644 --- a/tests/lib/async/catch_errors21_test.dart +++ b/tests/lib/async/catch_errors21_test.dart
@@ -21,23 +21,31 @@ // `catchErrors` it is caught there. catchErrors(() { catchErrors(() { - controller.stream.map((x) { - throw x; - }).listen((x) { - // Should not happen. - events.add("bad: $x"); - }); - }).listen((x) { - events.add("caught: $x"); - if (x == 4) done.complete(true); - }, onDone: () { + controller.stream + .map((x) { + throw x; + }) + .listen((x) { + // Should not happen. + events.add("bad: $x"); + }); + }).listen( + (x) { + events.add("caught: $x"); + if (x == 4) done.complete(true); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); + }).listen( + (x) { + events.add("outer: $x"); + }, + onDone: () { Expect.fail("Unexpected callback"); - }); - }).listen((x) { - events.add("outer: $x"); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }, + ); done.future.whenComplete(() { // Give handlers time to run.
diff --git a/tests/lib/async/catch_errors22_test.dart b/tests/lib/async/catch_errors22_test.dart index 1217101..e21c0d6 100644 --- a/tests/lib/async/catch_errors22_test.dart +++ b/tests/lib/async/catch_errors22_test.dart
@@ -18,22 +18,30 @@ // Test that streams that are never closed keep the `catchError` alive. catchErrors(() { catchErrors(() { - controller.stream.map((x) { - throw x; - }).listen((x) { - // Should not happen. - events.add("bad: $x"); - }); - }).listen((x) { - events.add("caught: $x"); - }, onDone: () { - events.add("done"); - }); - }).listen((x) { - events.add("outer: $x"); - }, onDone: () { - onDoneWasCalled = true; - }); + controller.stream + .map((x) { + throw x; + }) + .listen((x) { + // Should not happen. + events.add("bad: $x"); + }); + }).listen( + (x) { + events.add("caught: $x"); + }, + onDone: () { + events.add("done"); + }, + ); + }).listen( + (x) { + events.add("outer: $x"); + }, + onDone: () { + onDoneWasCalled = true; + }, + ); [1, 2, 3, 4].forEach(controller.add);
diff --git a/tests/lib/async/catch_errors23_test.dart b/tests/lib/async/catch_errors23_test.dart index 738d42b..38342ab 100644 --- a/tests/lib/async/catch_errors23_test.dart +++ b/tests/lib/async/catch_errors23_test.dart
@@ -21,22 +21,28 @@ // zone the subscription lives. catchErrors(() { catchErrors(() { - controller = new StreamController(); + controller = new StreamController(); - // Assign to "global" `stream`. - stream = controller.stream.map((x) { - events.add("map $x"); - return x + 100; - }).transform( - new StreamTransformer.fromHandlers(handleError: (e, st, sink) { - sink.add("error $e"); - })).asBroadcastStream(); + // Assign to "global" `stream`. + stream = controller.stream + .map((x) { + events.add("map $x"); + return x + 100; + }) + .transform( + new StreamTransformer.fromHandlers( + handleError: (e, st, sink) { + sink.add("error $e"); + }, + ), + ) + .asBroadcastStream(); - // Listen to `stream` in the inner zone. - stream.listen((x) { - events.add("stream $x"); - }); - }) + // Listen to `stream` in the inner zone. + stream.listen((x) { + events.add("stream $x"); + }); + }) .listen((x) { events.add(x); }) @@ -57,12 +63,15 @@ controller.addError("inner error"); new Future.error("caught by outer"); controller.close(); - }).listen((x) { - events.add("outer: $x"); - if (x == "caught by outer") done.complete(true); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + events.add("outer: $x"); + if (x == "caught by outer") done.complete(true); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.future.whenComplete(() { // Give handlers time to run.
diff --git a/tests/lib/async/catch_errors24_test.dart b/tests/lib/async/catch_errors24_test.dart index 8bc1fef..10fd7b9 100644 --- a/tests/lib/async/catch_errors24_test.dart +++ b/tests/lib/async/catch_errors24_test.dart
@@ -21,25 +21,31 @@ // and the error reaches `handleError`. catchErrors(() { catchErrors(() { - controller = new StreamController(); + controller = new StreamController(); - // Assign to the "global" `stream`. - stream = controller.stream.map((x) { - events.add("map $x"); - return x + 100; - }).transform( - new StreamTransformer.fromHandlers(handleError: (e, st, sink) { - sink.add("error $e"); - })).asBroadcastStream(); + // Assign to the "global" `stream`. + stream = controller.stream + .map((x) { + events.add("map $x"); + return x + 100; + }) + .transform( + new StreamTransformer.fromHandlers( + handleError: (e, st, sink) { + sink.add("error $e"); + }, + ), + ) + .asBroadcastStream(); - // Listen to the `stream` in the inner zone (but wait in a microtask). - scheduleMicrotask(() { - stream.listen((x) { - events.add("stream $x"); - if (x == "error 2") done.complete(true); - }); - }); - }) + // Listen to the `stream` in the inner zone (but wait in a microtask). + scheduleMicrotask(() { + stream.listen((x) { + events.add("stream $x"); + if (x == "error 2") done.complete(true); + }); + }); + }) .listen((x) { events.add(x); }) @@ -59,11 +65,14 @@ controller.addError(2); controller.close(); }); - }).listen((x) { - events.add("outer: $x"); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + events.add("outer: $x"); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.future.whenComplete(() { // Give handlers time to complete.
diff --git a/tests/lib/async/catch_errors25_test.dart b/tests/lib/async/catch_errors25_test.dart index ca0b7cf..c784fe5 100644 --- a/tests/lib/async/catch_errors25_test.dart +++ b/tests/lib/async/catch_errors25_test.dart
@@ -22,11 +22,14 @@ stream.listen(events.add); stream.listen(events.add); done.complete(stream.listen(null).asFuture()); - }).listen((x) { - events.add("outer: $x"); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + events.add("outer: $x"); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.future.whenComplete(() { // Give handlers time to run.
diff --git a/tests/lib/async/catch_errors26_test.dart b/tests/lib/async/catch_errors26_test.dart index 9f159ba0..5f31fb9 100644 --- a/tests/lib/async/catch_errors26_test.dart +++ b/tests/lib/async/catch_errors26_test.dart
@@ -19,19 +19,25 @@ // Test `StreamController.broadcast` streams. catchErrors(() { catchErrors(() { - controller = new StreamController.broadcast(); + controller = new StreamController.broadcast(); - // Listen to the stream from the inner zone. - controller.stream.map((x) { - events.add("map $x"); - return x + 100; - }).transform( - new StreamTransformer.fromHandlers(handleError: (e, st, sink) { - sink.add("error $e"); - })).listen((x) { - events.add("stream $x"); - }); - }) + // Listen to the stream from the inner zone. + controller.stream + .map((x) { + events.add("map $x"); + return x + 100; + }) + .transform( + new StreamTransformer.fromHandlers( + handleError: (e, st, sink) { + sink.add("error $e"); + }, + ), + ) + .listen((x) { + events.add("stream $x"); + }); + }) .listen((x) { events.add(x); }) @@ -41,23 +47,29 @@ }); // Listen to the stream from the outer zone. - controller.stream.listen((x) { - events.add("stream2 $x"); - }, onError: (x) { - events.add("stream2 error $x"); - }); + controller.stream.listen( + (x) { + events.add("stream2 $x"); + }, + onError: (x) { + events.add("stream2 error $x"); + }, + ); // Feed the controller. controller.add(1); controller.addError("inner stream"); new Future.error("outer error"); controller.close(); - }).listen((x) { - events.add("outer: $x"); - if (x == "outer error") done.complete(true); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + events.add("outer: $x"); + if (x == "outer error") done.complete(true); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.future.whenComplete(() { // Give handlers time to run.
diff --git a/tests/lib/async/catch_errors27_test.dart b/tests/lib/async/catch_errors27_test.dart index 88614b1..6bf6f3f2 100644 --- a/tests/lib/async/catch_errors27_test.dart +++ b/tests/lib/async/catch_errors27_test.dart
@@ -21,30 +21,35 @@ // counts is the zone where `listen` was invoked. catchErrors(() { catchErrors(() { - controller = new StreamController(); + controller = new StreamController(); - // Assignment to "global" `stream`. - stream = controller.stream.map((x) { - events.add("map $x"); - return x + 100; - }).asBroadcastStream(); + // Assignment to "global" `stream`. + stream = controller.stream.map((x) { + events.add("map $x"); + return x + 100; + }).asBroadcastStream(); - // Consume stream in the nested zone. - stream.transform( - new StreamTransformer.fromHandlers(handleError: (e, st, sink) { - sink.add("error $e"); - })).listen((x) { - events.add("stream $x"); - }); + // Consume stream in the nested zone. + stream + .transform( + new StreamTransformer.fromHandlers( + handleError: (e, st, sink) { + sink.add("error $e"); + }, + ), + ) + .listen((x) { + events.add("stream $x"); + }); - // Feed the controller in the nested zone. - scheduleMicrotask(() { - controller.add(1); - controller.addError(2); - controller.close(); - new Future.error("done"); - }); - }) + // Feed the controller in the nested zone. + scheduleMicrotask(() { + controller.add(1); + controller.addError(2); + controller.close(); + new Future.error("done"); + }); + }) .listen((x) { events.add("listen: $x"); if (x == "done") done.complete(true); @@ -58,11 +63,14 @@ stream.listen((x) { events.add("stream2 $x"); }); - }).listen((x) { - events.add("outer: $x"); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + events.add("outer: $x"); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.future.whenComplete(() { // Give handlers time to run.
diff --git a/tests/lib/async/catch_errors28_test.dart b/tests/lib/async/catch_errors28_test.dart index 896de85..394e0ba 100644 --- a/tests/lib/async/catch_errors28_test.dart +++ b/tests/lib/async/catch_errors28_test.dart
@@ -25,24 +25,19 @@ counter++; events.add(counter); }); - }).listen((x) { - events.add(x); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + events.add(x); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.future.whenComplete(() { // Give handlers time to run. Timer.run(() { - Expect.listEquals([ - "main exit", - 1, - 2, - 3, - 4, - 5, - 6, - ], events); + Expect.listEquals(["main exit", 1, 2, 3, 4, 5, 6], events); asyncEnd(); }); });
diff --git a/tests/lib/async/catch_errors2_test.dart b/tests/lib/async/catch_errors2_test.dart index 50f023d..8418d9f 100644 --- a/tests/lib/async/catch_errors2_test.dart +++ b/tests/lib/async/catch_errors2_test.dart
@@ -20,11 +20,14 @@ futureWasExecuted = true; }); return 'allDone'; - }).listen((x) { - Expect.fail("Unexpected callback"); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + Expect.fail("Unexpected callback"); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.whenComplete(asyncEnd); }
diff --git a/tests/lib/async/catch_errors3_test.dart b/tests/lib/async/catch_errors3_test.dart index b3c90a7..6d81fca 100644 --- a/tests/lib/async/catch_errors3_test.dart +++ b/tests/lib/async/catch_errors3_test.dart
@@ -28,10 +28,13 @@ }); }); return 'allDone'; - }).listen((x) { - Expect.fail("Unexpected callback"); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + Expect.fail("Unexpected callback"); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.future.whenComplete(asyncEnd); }
diff --git a/tests/lib/async/catch_errors4_test.dart b/tests/lib/async/catch_errors4_test.dart index 42f9159..8b6e19d 100644 --- a/tests/lib/async/catch_errors4_test.dart +++ b/tests/lib/async/catch_errors4_test.dart
@@ -18,12 +18,15 @@ catchErrors(() { events.add("catch error entry"); throw "catch error"; - }).listen((x) { - events.add(x); - done.complete(true); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + events.add(x); + done.complete(true); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.future.whenComplete(() { Expect.listEquals([
diff --git a/tests/lib/async/catch_errors5_test.dart b/tests/lib/async/catch_errors5_test.dart index cb0c78d..0306762 100644 --- a/tests/lib/async/catch_errors5_test.dart +++ b/tests/lib/async/catch_errors5_test.dart
@@ -21,11 +21,14 @@ Future errorFuture = new Future.error("future error"); errorFuture.whenComplete(() => done.complete(true)); throw "catch error"; - }).listen((x) { - events.add(x); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + events.add(x); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.future.whenComplete(() { // Give some time for the event listener to execute.
diff --git a/tests/lib/async/catch_errors6_test.dart b/tests/lib/async/catch_errors6_test.dart index 8eabef5..2ebd6cc 100644 --- a/tests/lib/async/catch_errors6_test.dart +++ b/tests/lib/async/catch_errors6_test.dart
@@ -18,13 +18,16 @@ completer.future.then((x) { Expect.fail("should not be executed"); }); - }).listen((x) { - errorHandlerOrDoneHasBeenExecuted = true; - Expect.fail("should not be executed (listen)"); - }, onDone: () { - errorHandlerOrDoneHasBeenExecuted = true; - Expect.fail("should not be executed (onDone)"); - }); + }).listen( + (x) { + errorHandlerOrDoneHasBeenExecuted = true; + Expect.fail("should not be executed (listen)"); + }, + onDone: () { + errorHandlerOrDoneHasBeenExecuted = true; + Expect.fail("should not be executed (onDone)"); + }, + ); Timer.run(() { Expect.isFalse(errorHandlerOrDoneHasBeenExecuted); asyncEnd();
diff --git a/tests/lib/async/catch_errors7_test.dart b/tests/lib/async/catch_errors7_test.dart index 7081892..c1a2745 100644 --- a/tests/lib/async/catch_errors7_test.dart +++ b/tests/lib/async/catch_errors7_test.dart
@@ -30,11 +30,14 @@ }); } throw "catch error"; - }).listen((x) { - events.add(x); - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + events.add(x); + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.future.whenComplete(() { // Give handlers time to execute.
diff --git a/tests/lib/async/catch_errors8_test.dart b/tests/lib/async/catch_errors8_test.dart index 475483f..81e4d34 100644 --- a/tests/lib/async/catch_errors8_test.dart +++ b/tests/lib/async/catch_errors8_test.dart
@@ -37,14 +37,17 @@ }); events.add("after inner"); throw "inner throw"; - }).listen((x) { - events.add(x); - if (x == "inner done throw") { - done.complete(true); - } - }, onDone: () { - Expect.fail("Unexpected callback"); - }); + }).listen( + (x) { + events.add(x); + if (x == "inner done throw") { + done.complete(true); + } + }, + onDone: () { + Expect.fail("Unexpected callback"); + }, + ); done.future.whenComplete(() { Expect.listEquals([ @@ -58,7 +61,7 @@ "future error2", 499, "delayed error", - "inner done throw" + "inner done throw", ], events); asyncEnd(); });
diff --git a/tests/lib/async/error_stack_test.dart b/tests/lib/async/error_stack_test.dart index a44eca1..323aa90 100644 --- a/tests/lib/async/error_stack_test.dart +++ b/tests/lib/async/error_stack_test.dart
@@ -13,61 +13,73 @@ main() async { asyncStart(); - for ((String, Object, StackTrace, Object, String, AsyncError?) - Function() setUp in [ - () { - // Without error callback. Inject and expect same fresh error. - var error = StateError("Quo!"); - var stack = StackTrace.fromString("Secret stack"); - return ("", error, stack, error, stack.toString(), null); - }, - () { - // With error callback, same error, new stack. - var error = StateError("Quo"); - var stack = StackTrace.fromString("Secret stack"); - var stack2 = StackTrace.fromString("Other stack"); - var errorCallback = AsyncError(error, stack2); - return ( - "errorCallback: fresh both", - error, - stack, - error, - stack2.toString(), - errorCallback - ); - }, - () { - // With error callback, new error, stack. - var error = StateError("Quo"); - var stack = StackTrace.fromString("Secret stack"); - var error2 = StateError("Quid"); - var stack2 = StackTrace.fromString("Other stack"); - var errorCallback = AsyncError(error2, stack2); - return ( - "errorCallback: fresh stack", - error, - stack, - error2, - stack2.toString(), - errorCallback - ); - }, - ]) { - Future<void> test(String name, - Future<(Object, StackTrace)> Function(Object, StackTrace) body) { + for ((String, Object, StackTrace, Object, String, AsyncError?) Function() + setUp + in [ + () { + // Without error callback. Inject and expect same fresh error. + var error = StateError("Quo!"); + var stack = StackTrace.fromString("Secret stack"); + return ("", error, stack, error, stack.toString(), null); + }, + () { + // With error callback, same error, new stack. + var error = StateError("Quo"); + var stack = StackTrace.fromString("Secret stack"); + var stack2 = StackTrace.fromString("Other stack"); + var errorCallback = AsyncError(error, stack2); + return ( + "errorCallback: fresh both", + error, + stack, + error, + stack2.toString(), + errorCallback, + ); + }, + () { + // With error callback, new error, stack. + var error = StateError("Quo"); + var stack = StackTrace.fromString("Secret stack"); + var error2 = StateError("Quid"); + var stack2 = StackTrace.fromString("Other stack"); + var errorCallback = AsyncError(error2, stack2); + return ( + "errorCallback: fresh stack", + error, + stack, + error2, + stack2.toString(), + errorCallback, + ); + }, + ]) { + Future<void> test( + String name, + Future<(Object, StackTrace)> Function(Object, StackTrace) body, + ) { var (msg, error, stack, expectError, expectStackString, errorCallback) = setUp(); print("Test: $name${msg.isNotEmpty ? ", $msg" : msg}"); - return asyncTest(() => runZoned(() => body(error, stack), + return asyncTest( + () => + runZoned( + () => body(error, stack), zoneSpecification: ZoneSpecification( - errorCallback: (s, p, z, e, st) => errorCallback)).then((es) { - var (e, s) = es; - Expect.identical(expectError, e, name); - Expect.equals(expectStackString, s.toString(), name); - Expect.equals( - expectStackString, (e as Error).stackTrace.toString(), name); - })); + errorCallback: (s, p, z, e, st) => errorCallback, + ), + ).then((es) { + var (e, s) = es; + Expect.identical(expectError, e, name); + Expect.equals(expectStackString, s.toString(), name); + Expect.equals( + expectStackString, + (e as Error).stackTrace.toString(), + name, + ); + }), + ); } // Sanity check: Plain throws. @@ -78,16 +90,21 @@ } catch (e, s) { Expect.identical(error, e, "Error.throw"); Expect.equals(stack.toString(), s.toString(), "Error.throw"); - Expect.equals(stack.toString(), (e as Error).stackTrace.toString(), - "Error.throw"); + Expect.equals( + stack.toString(), + (e as Error).stackTrace.toString(), + "Error.throw", + ); } }(); // Futures. // Immediate error. - await test("Future.error", - (error, stack) => futureError(Future.error(error, stack))); + await test( + "Future.error", + (error, stack) => futureError(Future.error(error, stack)), + ); // Through controller, async. await test("Completer().completeError", (error, stack) { @@ -107,22 +124,25 @@ // Streams. // Singleton error. - await test("Stream.error", - (error, stack) => streamError(Stream.error(error, stack))); + await test( + "Stream.error", + (error, stack) => streamError(Stream.error(error, stack)), + ); // Controller errors. for (var broadcast in [false, true]) { for (var sync in [false, true]) { await test( - "Stream${broadcast ? ".broadcast" : ""}${sync ? "(sync)" : ""}", - (error, stack) { - var controller = broadcast - ? StreamController<void>.broadcast(sync: sync) - : StreamController<void>(sync: sync); - var future = streamError(controller.stream)..ignore(); - controller.addError(error, stack); - return future; - }); + "Stream${broadcast ? ".broadcast" : ""}${sync ? "(sync)" : ""}", + (error, stack) { + var controller = broadcast + ? StreamController<void>.broadcast(sync: sync) + : StreamController<void>(sync: sync); + var future = streamError(controller.stream)..ignore(); + controller.addError(error, stack); + return future; + }, + ); } } } @@ -146,12 +166,17 @@ /// Captures first error of stream. Future<(Object, StackTrace)> streamError(Stream<void> stream) { var c = Completer<(Object, StackTrace)>(); - var sub = stream.listen((_) { - // No values expected. - }, onError: (Object e, StackTrace s) { - c.complete((e, s)); - }, onDone: () { - Expect.fail("No error from stream"); - }, cancelOnError: true); + var sub = stream.listen( + (_) { + // No values expected. + }, + onError: (Object e, StackTrace s) { + c.complete((e, s)); + }, + onDone: () { + Expect.fail("No error from stream"); + }, + cancelOnError: true, + ); return c.future; }
diff --git a/tests/lib/async/event_helper.dart b/tests/lib/async/event_helper.dart index 58cf057..4d4bb3f 100644 --- a/tests/lib/async/event_helper.dart +++ b/tests/lib/async/event_helper.dart
@@ -156,8 +156,12 @@ CaptureEvents(Stream stream, {bool cancelOnError = false}) { this.cancelOnError = cancelOnError; - subscription = stream.listen(add, - onError: addError, onDone: close, cancelOnError: cancelOnError); + subscription = stream.listen( + add, + onError: addError, + onDone: close, + cancelOnError: cancelOnError, + ); } void addError(error, [StackTrace? stackTrace]) {
diff --git a/tests/lib/async/first_regression_test.dart b/tests/lib/async/first_regression_test.dart index 590251b..e4fc068 100644 --- a/tests/lib/async/first_regression_test.dart +++ b/tests/lib/async/first_regression_test.dart
@@ -11,10 +11,11 @@ class DoubleTransformer<T> extends StreamTransformerBase<T, T> { Stream<T> bind(Stream<T> stream) { var transformer = new StreamTransformer<T, T>.fromHandlers( - handleData: (T data, EventSink<T> sink) { - sink.add(data); - sink.add(data); - }); + handleData: (T data, EventSink<T> sink) { + sink.add(data); + sink.add(data); + }, + ); return transformer.bind(stream); } } @@ -22,6 +23,8 @@ main() async { // This should not crash. Did crash by trying to complete future more // than once. - await (new Stream.fromIterable([1, 2]).transform(new DoubleTransformer())) - .first; + await (new Stream.fromIterable([ + 1, + 2, + ]).transform(new DoubleTransformer())).first; }
diff --git a/tests/lib/async/future_constructor2_test.dart b/tests/lib/async/future_constructor2_test.dart index 0ed6fdc..ff0fab9 100644 --- a/tests/lib/async/future_constructor2_test.dart +++ b/tests/lib/async/future_constructor2_test.dart
@@ -23,8 +23,10 @@ delayed() { asyncStart(); - new Future<int>.delayed(const Duration(milliseconds: 2), createIntFuture) - .then((x) { + new Future<int>.delayed( + const Duration(milliseconds: 2), + createIntFuture, + ).then((x) { Expect.equals(499, x); asyncEnd(); });
diff --git a/tests/lib/async/future_constructor_test.dart b/tests/lib/async/future_constructor_test.dart index 34b2d31..bfcd850 100644 --- a/tests/lib/async/future_constructor_test.dart +++ b/tests/lib/async/future_constructor_test.dart
@@ -13,17 +13,23 @@ Future f1 = new Future(func); Future f2 = new Future.value().then((_) => func()); f2.catchError((_) {}); // I'll get the error later. - f1.then((v1) { - f2.then((v2) { - Expect.equals(v1, v2); - }); - }, onError: (e1) { - f2.then((_) { - Expect.fail("Expected error"); - }, onError: (e2) { - Expect.equals(e1, e2); - }); - }); + f1.then( + (v1) { + f2.then((v2) { + Expect.equals(v1, v2); + }); + }, + onError: (e1) { + f2.then( + (_) { + Expect.fail("Expected error"); + }, + onError: (e2) { + Expect.equals(e1, e2); + }, + ); + }, + ); } Future val = new Future.value(42);
diff --git a/tests/lib/async/future_extension_test.dart b/tests/lib/async/future_extension_test.dart index f562006..1173818 100644 --- a/tests/lib/async/future_extension_test.dart +++ b/tests/lib/async/future_extension_test.dart
@@ -36,15 +36,18 @@ { asyncStart(); bool threw = false; - runZonedGuarded(() { - var c = Completer<int>.sync(); - var f = c.future; - f.ignore(); - c.completeError("ERROR2"); - }, (e, s) { - threw = true; - Expect.fail("Should not happen: $e"); - }); + runZonedGuarded( + () { + var c = Completer<int>.sync(); + var f = c.future; + f.ignore(); + c.completeError("ERROR2"); + }, + (e, s) { + threw = true; + Expect.fail("Should not happen: $e"); + }, + ); Future.delayed(Duration.zero, () { if (threw) Expect.fail("Future not ignored."); asyncEnd();
diff --git a/tests/lib/async/future_foreach_test.dart b/tests/lib/async/future_foreach_test.dart index 8186ea7..94f48a4 100644 --- a/tests/lib/async/future_foreach_test.dart +++ b/tests/lib/async/future_foreach_test.dart
@@ -17,9 +17,10 @@ testForeach(<int>[0, 1, 2, 3]); testForeachIterableThrows( - new Iterable<int>.generate(5, (i) => i < 4 ? i : throw "ERROR"), - 4, - "ERROR"); + new Iterable<int>.generate(5, (i) => i < 4 ? i : throw "ERROR"), + 4, + "ERROR", + ); testForeachFunctionThrows(new Iterable<int>.generate(5, (x) => x), 4); @@ -33,25 +34,27 @@ int count = 0; int nesting = 0; Future.forEach<int>(elements, (int value) { - Expect.isTrue(nesting == 0, "overlapping calls detected"); - if (delay == 0) return "something-$delay"; - nesting++; - var future; - if (delay == 1) { - future = new Future(() => null); - } else { - future = new Future.microtask(() => null); - } - return future.then<String>((_) { - Expect.equals(1, nesting); - nesting--; - return "something-$delay"; - }); - }).then((_) { - asyncEnd(); - }).catchError((e) { - Expect.fail("Throws: $e"); - }); + Expect.isTrue(nesting == 0, "overlapping calls detected"); + if (delay == 0) return "something-$delay"; + nesting++; + var future; + if (delay == 1) { + future = new Future(() => null); + } else { + future = new Future.microtask(() => null); + } + return future.then<String>((_) { + Expect.equals(1, nesting); + nesting--; + return "something-$delay"; + }); + }) + .then((_) { + asyncEnd(); + }) + .catchError((e) { + Expect.fail("Throws: $e"); + }); } } @@ -69,13 +72,16 @@ return new Future.microtask(() {}); } return new Future.value(); - }).then((_) { - Expect.fail("Did not throw"); - }, onError: (e) { - Expect.equals(n, count); - Expect.equals(error, e); - asyncEnd(); - }); + }).then( + (_) { + Expect.fail("Did not throw"); + }, + onError: (e) { + Expect.equals(n, count); + Expect.equals(error, e); + asyncEnd(); + }, + ); } } @@ -104,11 +110,14 @@ return new Future.microtask(() {}); } return new Future.value(); - }).then((_) { - Expect.fail("Did not throw"); - }, onError: (e) { - Expect.equals("ERROR", e); - asyncEnd(); - }); + }).then( + (_) { + Expect.fail("Did not throw"); + }, + onError: (e) { + Expect.equals("ERROR", e); + asyncEnd(); + }, + ); } }
diff --git a/tests/lib/async/future_future_test.dart b/tests/lib/async/future_future_test.dart index 037c20e..a192331 100644 --- a/tests/lib/async/future_future_test.dart +++ b/tests/lib/async/future_future_test.dart
@@ -50,20 +50,26 @@ // Check `Future.then`'s `onError`. asyncTest(() { - Future<int> future = - errorFuture.then<int>((_) => -1, onError: (_) => fi(4)); + Future<int> future = errorFuture.then<int>( + (_) => -1, + onError: (_) => fi(4), + ); return expectFutureInt(future, 4); }); asyncTest(() { - Future<Future<int>> future = - errorFuture.then<Future<int>>((_) => fi(-1), onError: (_) => fi(5)); + Future<Future<int>> future = errorFuture.then<Future<int>>( + (_) => fi(-1), + onError: (_) => fi(5), + ); return expectFutureFutureInt(future, 5); }); asyncTest(() { - Future<Future<int>> future = - errorFuture.then<Future<int>>((_) => fi(-1), onError: (_) => ffi(6)); + Future<Future<int>> future = errorFuture.then<Future<int>>( + (_) => fi(-1), + onError: (_) => ffi(6), + ); return expectFutureFutureInt(future, 6); }); @@ -124,8 +130,10 @@ }); asyncTest(() { - Future<Object> future = - errorFuture.then<Object>((_) => -1, onError: (_) => fi(15)); + Future<Object> future = errorFuture.then<Object>( + (_) => -1, + onError: (_) => fi(15), + ); Expect.type<Future<Object>>(future); Expect.notType<Future<int>>(future); return future.then<void>((o) { @@ -134,8 +142,10 @@ }); asyncTest(() { - Future<Object> future = - errorFuture.then<Object>((_) => -1, onError: (_) => ffi(16)); + Future<Object> future = errorFuture.then<Object>( + (_) => -1, + onError: (_) => ffi(16), + ); Expect.type<Future<Object>>(future); Expect.notType<Future<int>>(future); Expect.notType<Future<Future<int>>>(future);
diff --git a/tests/lib/async/future_iterable_extension_test.dart b/tests/lib/async/future_iterable_extension_test.dart index f89d646..a1de6b8 100644 --- a/tests/lib/async/future_iterable_extension_test.dart +++ b/tests/lib/async/future_iterable_extension_test.dart
@@ -12,7 +12,8 @@ var futures = [for (var i = 0; i < 5; i++) Future<int>.value(i)]; var errors = [ for (var i = 0; i < 5; i++) - Future<int>.error("error $i", StackTrace.fromString("stack $i"))..ignore() + Future<int>.error("error $i", StackTrace.fromString("stack $i")) + ..ignore(), ]; // Empty list. @@ -89,31 +90,56 @@ var toString = e.toString(); Expect.contains("ParallelWaitError(5 errors):", toString); - Expect.containsAny( - ["error 0", "error 1", "error 2", "error 3", "error 4"], toString); - Expect.containsAny(["stack 0", "stack 1", "stack 2", "stack 3", "stack 4"], - e.stackTrace.toString()); + Expect.containsAny([ + "error 0", + "error 1", + "error 2", + "error 3", + "error 4", + ], toString); + Expect.containsAny([ + "stack 0", + "stack 1", + "stack 2", + "stack 3", + "stack 4", + ], e.stackTrace.toString()); } // Direct tests of `ParallelWaitError`. - Expect.equals("ParallelWaitError", - ParallelWaitError<Null, Null>(null, null, errorCount: null).toString()); - Expect.equals("ParallelWaitError", - ParallelWaitError<Null, Null>(null, null, errorCount: 0).toString()); - Expect.equals("ParallelWaitError", - ParallelWaitError<Null, Null>(null, null, errorCount: 1).toString()); - Expect.equals("ParallelWaitError(2 errors)", - ParallelWaitError<Null, Null>(null, null, errorCount: 2).toString()); - Expect.equals("ParallelWaitError(9999 errors)", - ParallelWaitError<Null, Null>(null, null, errorCount: 9999).toString()); + Expect.equals( + "ParallelWaitError", + ParallelWaitError<Null, Null>(null, null, errorCount: null).toString(), + ); + Expect.equals( + "ParallelWaitError", + ParallelWaitError<Null, Null>(null, null, errorCount: 0).toString(), + ); + Expect.equals( + "ParallelWaitError", + ParallelWaitError<Null, Null>(null, null, errorCount: 1).toString(), + ); + Expect.equals( + "ParallelWaitError(2 errors)", + ParallelWaitError<Null, Null>(null, null, errorCount: 2).toString(), + ); + Expect.equals( + "ParallelWaitError(9999 errors)", + ParallelWaitError<Null, Null>(null, null, errorCount: 9999).toString(), + ); var defaultError = AsyncError( - StateError("default error"), StackTrace.fromString("default stack")); + StateError("default error"), + StackTrace.fromString("default stack"), + ); final ParallelWaitError unthrownWithoutDefault = ParallelWaitError<Null, Null>(null, null); - final ParallelWaitError unthrownWithDefault = - ParallelWaitError<Null, Null>(null, null, defaultError: defaultError); + final ParallelWaitError unthrownWithDefault = ParallelWaitError<Null, Null>( + null, + null, + defaultError: defaultError, + ); final ParallelWaitError thrownWithoutDefault; final StackTrace thrownWithoutDefaultStack; try { @@ -132,21 +158,31 @@ Expect.equals("ParallelWaitError", thrownWithoutDefault.toString()); Expect.equals("ParallelWaitError", unthrownWithoutDefault.toString()); Expect.equals( - "ParallelWaitError: ${defaultError.error}", thrownWithDefault.toString()); - Expect.equals("ParallelWaitError: ${defaultError.error}", - unthrownWithDefault.toString()); + "ParallelWaitError: ${defaultError.error}", + thrownWithDefault.toString(), + ); + Expect.equals( + "ParallelWaitError: ${defaultError.error}", + unthrownWithDefault.toString(), + ); Expect.identical(unthrownWithDefault.stackTrace, defaultError.stackTrace); Expect.identical(thrownWithDefault.stackTrace, defaultError.stackTrace); - Expect.equals(thrownWithoutDefault.stackTrace.toString(), - thrownWithoutDefaultStack.toString()); + Expect.equals( + thrownWithoutDefault.stackTrace.toString(), + thrownWithoutDefaultStack.toString(), + ); Expect.isNull(unthrownWithoutDefault.stackTrace); // Both default and count. Expect.equals( - "ParallelWaitError(25 errors): ${defaultError.error}", - ParallelWaitError<Null, Null>(null, null, - errorCount: 25, defaultError: defaultError) - .toString()); + "ParallelWaitError(25 errors): ${defaultError.error}", + ParallelWaitError<Null, Null>( + null, + null, + errorCount: 25, + defaultError: defaultError, + ).toString(), + ); asyncEnd(); }
diff --git a/tests/lib/async/future_onerror_test.dart b/tests/lib/async/future_onerror_test.dart index 6457534..8c58bf2 100644 --- a/tests/lib/async/future_onerror_test.dart +++ b/tests/lib/async/future_onerror_test.dart
@@ -40,24 +40,30 @@ var resultFuture = future.onError(onError, test: test); if (result is AsyncError) { - resultFuture.then((value) { - Expect.fail("$testName: Did not throw, value: $value"); - }, onError: (Object error, StackTrace stackTrace) { - Expect.identical(result.error, error, testName); - if (result.stackTrace != StackTrace.empty) { - Expect.identical(result.stackTrace, stackTrace, testName); - } else { - Expect.notEquals(stack, stackTrace, testName); - } - asyncEnd(); - }); + resultFuture.then( + (value) { + Expect.fail("$testName: Did not throw, value: $value"); + }, + onError: (Object error, StackTrace stackTrace) { + Expect.identical(result.error, error, testName); + if (result.stackTrace != StackTrace.empty) { + Expect.identical(result.stackTrace, stackTrace, testName); + } else { + Expect.notEquals(stack, stackTrace, testName); + } + asyncEnd(); + }, + ); } else { - resultFuture.then((value) { - Expect.equals(result, value); - asyncEnd(); - }, onError: (error, stackTrace) { - Expect.fail("$testName: Threw $error"); - }); + resultFuture.then( + (value) { + Expect.equals(result, value); + asyncEnd(); + }, + onError: (error, stackTrace) { + Expect.fail("$testName: Threw $error"); + }, + ); } } @@ -169,8 +175,13 @@ var originalOnError = onError; onError = (E e, StackTrace s) async => originalOnError(e, s); } - test<E, T>(testName, future as Future<T>, onError, - test: testFunction, result: expectation); + test<E, T>( + testName, + future as Future<T>, + onError, + test: testFunction, + result: expectation, + ); } // Find the types to use. @@ -200,7 +211,7 @@ Future<T> _original; NonNativeFuture.value(T value) : _original = Future<T>.value(value); NonNativeFuture.error(Object error, [StackTrace? stack]) - : _original = Future<T>.error(error, stack)..ignore(); + : _original = Future<T>.error(error, stack)..ignore(); NonNativeFuture._(this._original); Future<R> then<R>(FutureOr<R> Function(T) handleValue, {Function? onError}) => NonNativeFuture<R>._(_original.then(handleValue, onError: onError));
diff --git a/tests/lib/async/future_or_strong_test.dart b/tests/lib/async/future_or_strong_test.dart index 765a8a6..6645aa4 100644 --- a/tests/lib/async/future_or_strong_test.dart +++ b/tests/lib/async/future_or_strong_test.dart
@@ -130,4 +130,4 @@ Expect.isTrue(bar3 is FunReturns<FutureOr<FutureOr<Object?>>>); Expect.isTrue(bar3 is FunReturns<FutureOr<FutureOr<int>>>); Expect.isFalse(bar3 is FunReturns<FutureOr<FutureOr<String>>>); -} \ No newline at end of file +}
diff --git a/tests/lib/async/future_record_extension_test.dart b/tests/lib/async/future_record_extension_test.dart index 52f4bfb..cd65cbd 100644 --- a/tests/lib/async/future_record_extension_test.dart +++ b/tests/lib/async/future_record_extension_test.dart
@@ -36,8 +36,10 @@ try { await (fi, fbe).wait; Expect.fail("Did not throw"); - } on ParallelWaitError<(int?, bool?), - (AsyncError?, AsyncError?)> catch (e, s) { + } on ParallelWaitError<(int?, bool?), (AsyncError?, AsyncError?)> catch ( + e, + s + ) { Expect.equals((2, null), e.values); Expect.isNull(e.errors.$1); Expect.equals(be, e.errors.$2?.error); @@ -50,8 +52,10 @@ try { await (fie, fbe).wait; Expect.fail("Did not throw"); - } on ParallelWaitError<(int?, bool?), - (AsyncError?, AsyncError?)> catch (e, s) { + } on ParallelWaitError<(int?, bool?), (AsyncError?, AsyncError?)> catch ( + e, + s + ) { Expect.equals((null, null), e.values); Expect.equals(ie, e.errors.$1?.error); Expect.equals(be, e.errors.$2?.error); @@ -72,8 +76,10 @@ try { await (fb, fse, fi).wait; Expect.fail("Did not throw"); - } on ParallelWaitError<(bool?, String?, int?), - (AsyncError?, AsyncError?, AsyncError?)> catch (e, s) { + } on ParallelWaitError< + (bool?, String?, int?), + (AsyncError?, AsyncError?, AsyncError?) + > catch (e, s) { Expect.equals((true, null, 2), e.values); Expect.isNull(e.errors.$1); Expect.equals(se, e.errors.$2?.error); @@ -87,8 +93,10 @@ try { await (fbe, fse, fie).wait; Expect.fail("Did not throw"); - } on ParallelWaitError<(bool?, String?, int?), - (AsyncError?, AsyncError?, AsyncError?)> catch (e, s) { + } on ParallelWaitError< + (bool?, String?, int?), + (AsyncError?, AsyncError?, AsyncError?) + > catch (e, s) { Expect.equals((null, null, null), e.values); Expect.equals(be, e.errors.$1?.error); Expect.equals(se, e.errors.$2?.error); @@ -110,8 +118,10 @@ try { await (fs, fie, fb, fse).wait; Expect.fail("Did not throw"); - } on ParallelWaitError<(String?, int?, bool?, String?), - (AsyncError?, AsyncError?, AsyncError?, AsyncError?)> catch (e, s) { + } on ParallelWaitError< + (String?, int?, bool?, String?), + (AsyncError?, AsyncError?, AsyncError?, AsyncError?) + > catch (e, s) { Expect.equals(("s", null, true, null), e.values); Expect.isNull(e.errors.$1); Expect.equals(ie, e.errors.$2?.error); @@ -126,8 +136,10 @@ try { await (fse, fie, fbe, fse).wait; Expect.fail("Did not throw"); - } on ParallelWaitError<(String?, int?, bool?, String?), - (AsyncError?, AsyncError?, AsyncError?, AsyncError?)> catch (e, s) { + } on ParallelWaitError< + (String?, int?, bool?, String?), + (AsyncError?, AsyncError?, AsyncError?, AsyncError?) + > catch (e, s) { Expect.equals((null, null, null, null), e.values); Expect.equals(se, e.errors.$1?.error); Expect.equals(ie, e.errors.$2?.error); @@ -151,14 +163,9 @@ await (fi, fbe, fs, fie, fb).wait; Expect.fail("Did not throw"); } on ParallelWaitError< - (int?, bool?, String?, int?, bool?), - ( - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError? - )> catch (e, s) { + (int?, bool?, String?, int?, bool?), + (AsyncError?, AsyncError?, AsyncError?, AsyncError?, AsyncError?) + > catch (e, s) { Expect.equals((2, null, "s", null, true), e.values); Expect.isNull(e.errors.$1); Expect.equals(be, e.errors.$2?.error); @@ -175,14 +182,9 @@ await (fie, fbe, fse, fie, fbe).wait; Expect.fail("Did not throw"); } on ParallelWaitError< - (int?, bool?, String?, int?, bool?), - ( - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError? - )> catch (e, s) { + (int?, bool?, String?, int?, bool?), + (AsyncError?, AsyncError?, AsyncError?, AsyncError?, AsyncError?) + > catch (e, s) { Expect.equals((null, null, null, null, null), e.values); Expect.equals(ie, e.errors.$1?.error); Expect.equals(be, e.errors.$2?.error); @@ -207,15 +209,16 @@ await (fb, fse, fi, fbe, fs, fie).wait; Expect.fail("Did not throw"); } on ParallelWaitError< - (bool?, String?, int?, bool?, String?, int?), - ( - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError? - )> catch (e, s) { + (bool?, String?, int?, bool?, String?, int?), + ( + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + ) + > catch (e, s) { Expect.equals((true, null, 2, null, "s", null), e.values); Expect.isNull(e.errors.$1); Expect.equals(se, e.errors.$2?.error); @@ -233,15 +236,16 @@ await (fbe, fse, fie, fbe, fse, fie).wait; Expect.fail("Did not throw"); } on ParallelWaitError< - (bool?, String?, int?, bool?, String?, int?), - ( - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError? - )> catch (e, s) { + (bool?, String?, int?, bool?, String?, int?), + ( + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + ) + > catch (e, s) { Expect.equals((null, null, null, null, null, null), e.values); Expect.equals(be, e.errors.$1?.error); Expect.equals(se, e.errors.$2?.error); @@ -267,16 +271,17 @@ await (fs, fie, fb, fse, fi, fbe, fs).wait; Expect.fail("Did not throw"); } on ParallelWaitError< - (String?, int?, bool?, String?, int?, bool?, String?), - ( - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError? - )> catch (e, s) { + (String?, int?, bool?, String?, int?, bool?, String?), + ( + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + ) + > catch (e, s) { Expect.equals(("s", null, true, null, 2, null, "s"), e.values); Expect.isNull(e.errors.$1); Expect.equals(ie, e.errors.$2?.error); @@ -295,16 +300,17 @@ await (fse, fie, fbe, fse, fie, fbe, fse).wait; Expect.fail("Did not throw"); } on ParallelWaitError< - (String?, int?, bool?, String?, int?, bool?, String?), - ( - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError? - )> catch (e, s) { + (String?, int?, bool?, String?, int?, bool?, String?), + ( + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + ) + > catch (e, s) { Expect.equals((null, null, null, null, null, null, null), e.values); Expect.equals(se, e.errors.$1?.error); Expect.equals(ie, e.errors.$2?.error); @@ -331,17 +337,18 @@ await (fi, fbe, fs, fie, fb, fse, fi, fbe).wait; Expect.fail("Did not throw"); } on ParallelWaitError< - (int?, bool?, String?, int?, bool?, String?, int?, bool?), - ( - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError? - )> catch (e, s) { + (int?, bool?, String?, int?, bool?, String?, int?, bool?), + ( + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + ) + > catch (e, s) { Expect.equals((2, null, "s", null, true, null, 2, null), e.values); Expect.isNull(e.errors.$1); Expect.equals(be, e.errors.$2?.error); @@ -361,17 +368,18 @@ await (fie, fbe, fse, fie, fbe, fse, fie, fbe).wait; Expect.fail("Did not throw"); } on ParallelWaitError< - (int?, bool?, String?, int?, bool?, String?, int?, bool?), - ( - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError? - )> catch (e, s) { + (int?, bool?, String?, int?, bool?, String?, int?, bool?), + ( + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + ) + > catch (e, s) { Expect.equals((null, null, null, null, null, null, null, null), e.values); Expect.equals(ie, e.errors.$1?.error); Expect.equals(be, e.errors.$2?.error); @@ -399,18 +407,19 @@ await (fb, fse, fi, fbe, fs, fie, fb, fse, fi).wait; Expect.fail("Did not throw"); } on ParallelWaitError< - (bool?, String?, int?, bool?, String?, int?, bool?, String?, int?), - ( - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError? - )> catch (e, s) { + (bool?, String?, int?, bool?, String?, int?, bool?, String?, int?), + ( + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + ) + > catch (e, s) { Expect.equals((true, null, 2, null, "s", null, true, null, 2), e.values); Expect.isNull(e.errors.$1); Expect.equals(se, e.errors.$2?.error); @@ -431,20 +440,30 @@ await (fbe, fse, fie, fbe, fse, fie, fbe, fse, fie).wait; Expect.fail("Did not throw"); } on ParallelWaitError< - (bool?, String?, int?, bool?, String?, int?, bool?, String?, int?), - ( - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError?, - AsyncError? - )> catch (e, s) { - Expect.equals( - (null, null, null, null, null, null, null, null, null), e.values); + (bool?, String?, int?, bool?, String?, int?, bool?, String?, int?), + ( + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + AsyncError?, + ) + > catch (e, s) { + Expect.equals(( + null, + null, + null, + null, + null, + null, + null, + null, + null, + ), e.values); Expect.equals(be, e.errors.$1?.error); Expect.equals(se, e.errors.$2?.error); Expect.equals(ie, e.errors.$3?.error); @@ -464,7 +483,10 @@ } void checkDefaultError( - ParallelWaitError error, int errorCount, List<Object> expectedErrors) { + ParallelWaitError error, + int errorCount, + List<Object> expectedErrors, +) { var toString = error.toString(); if (errorCount > 1) { Expect.contains("ParallelWaitError($errorCount errors):", toString);
diff --git a/tests/lib/async/future_test.dart b/tests/lib/async/future_test.dart index 79b3813..116fafe 100644 --- a/tests/lib/async/future_test.dart +++ b/tests/lib/async/future_test.dart
@@ -26,17 +26,23 @@ Future f1 = new Future.sync(func); Future f2 = new Future.value().then((_) => func()); f2.catchError((_) {}); // I'll get the error later. - f1.then((v1) { - f2.then((v2) { - Expect.equals(v1, v2); - }); - }, onError: (e1) { - f2.then((_) { - Expect.fail("Expected error"); - }, onError: (e2) { - Expect.equals(e1, e2); - }); - }); + f1.then( + (v1) { + f2.then((v2) { + Expect.equals(v1, v2); + }); + }, + onError: (e1) { + f2.then( + (_) { + Expect.fail("Expected error"); + }, + onError: (e2) { + Expect.equals(e1, e2); + }, + ); + }, + ); } Future val = new Future.value(42); @@ -87,12 +93,14 @@ int? after; asyncStart(); - future.then((int v) { - after = v; - }).then((_) { - Expect.equals(3, after); - asyncEnd(); - }); + future + .then((int v) { + after = v; + }) + .then((_) { + Expect.equals(3, after); + asyncEnd(); + }); completer.complete(3); Expect.isNull(after); @@ -107,12 +115,14 @@ Expect.isNull(after); asyncStart(); - future.then((int v) { - after = v; - }).then((_) { - Expect.equals(3, after); - asyncEnd(); - }); + future + .then((int v) { + after = v; + }) + .then((_) { + Expect.equals(3, after); + asyncEnd(); + }); } void testCompleteManySuccessHandlers() { @@ -123,19 +133,25 @@ late int after2; var futures = <Future<int>>[]; - futures.add(future.then((int v) { - before = v; - return v; - })); + futures.add( + future.then((int v) { + before = v; + return v; + }), + ); completer.complete(3); - futures.add(future.then((int v) { - after1 = v; - return v; - })); - futures.add(future.then((int v) { - after2 = v; - return v; - })); + futures.add( + future.then((int v) { + after1 = v; + return v; + }), + ); + futures.add( + future.then((int v) { + after2 = v; + return v; + }), + ); asyncStart(); Future.wait(futures).then((_) { @@ -165,13 +181,15 @@ final ex = new Exception(); asyncStart(); - future.then((v) { - throw "Value not expected"; - return null; - }).catchError((error) { - Expect.equals(error, ex); - asyncEnd(); - }, test: (e) => e == ex); + future + .then((v) { + throw "Value not expected"; + return null; + }) + .catchError((error) { + Expect.equals(error, ex); + asyncEnd(); + }, test: (e) => e == ex); completer.completeError(ex); } @@ -203,9 +221,11 @@ bool reached = false; future.catchError((e) {}); - future.catchError((e) { - reached = true; - }, test: (e) => false).catchError((e) {}); + future + .catchError((e) { + reached = true; + }, test: (e) => false) + .catchError((e) {}); Expect.isFalse(completer.isCompleted); completer.completeError(ex); Expect.isTrue(completer.isCompleted); @@ -239,9 +259,11 @@ future.catchError((e) {}); - future.catchError((e) { - reached = true; - }, test: (e) => false).catchError((e) {}); + future + .catchError((e) { + reached = true; + }, test: (e) => false) + .catchError((e) {}); completer.completeError(ex); @@ -252,14 +274,17 @@ var completer = new Completer(); bool gotValue = false; asyncStart(); - completer.future.asStream().listen((data) { - Expect.isFalse(gotValue); - gotValue = true; - Expect.equals("value", data); - }, onDone: () { - Expect.isTrue(gotValue); - asyncEnd(); - }); + completer.future.asStream().listen( + (data) { + Expect.isFalse(gotValue); + gotValue = true; + Expect.equals("value", data); + }, + onDone: () { + Expect.isTrue(gotValue); + asyncEnd(); + }, + ); completer.complete("value"); } @@ -268,43 +293,53 @@ bool gotValue = false; asyncStart(); completer.complete("value"); - completer.future.asStream().listen((data) { - Expect.isFalse(gotValue); - gotValue = true; - Expect.equals("value", data); - }, onDone: () { - Expect.isTrue(gotValue); - asyncEnd(); - }); + completer.future.asStream().listen( + (data) { + Expect.isFalse(gotValue); + gotValue = true; + Expect.equals("value", data); + }, + onDone: () { + Expect.isTrue(gotValue); + asyncEnd(); + }, + ); } void testFutureAsStreamCompleteImmediate() { bool gotValue = false; asyncStart(); - new Future.value("value").asStream().listen((data) { - Expect.isFalse(gotValue); - gotValue = true; - Expect.equals("value", data); - }, onDone: () { - Expect.isTrue(gotValue); - asyncEnd(); - }); + new Future.value("value").asStream().listen( + (data) { + Expect.isFalse(gotValue); + gotValue = true; + Expect.equals("value", data); + }, + onDone: () { + Expect.isTrue(gotValue); + asyncEnd(); + }, + ); } void testFutureAsStreamCompleteErrorAfter() { var completer = new Completer(); bool gotError = false; asyncStart(); - completer.future.asStream().listen((data) { - Expect.fail("Unexpected data"); - }, onError: (error) { - Expect.isFalse(gotError); - gotError = true; - Expect.equals("error", error); - }, onDone: () { - Expect.isTrue(gotError); - asyncEnd(); - }); + completer.future.asStream().listen( + (data) { + Expect.fail("Unexpected data"); + }, + onError: (error) { + Expect.isFalse(gotError); + gotError = true; + Expect.equals("error", error); + }, + onDone: () { + Expect.isTrue(gotError); + asyncEnd(); + }, + ); completer.completeError("error"); } @@ -318,14 +353,17 @@ throw "not possible"; }) // Returns a future wrapper. .asStream() - .listen((data) { - Expect.isFalse(gotValue); - gotValue = true; - Expect.equals("value", data); - }, onDone: () { - Expect.isTrue(gotValue); - asyncEnd(); - }); + .listen( + (data) { + Expect.isFalse(gotValue); + gotValue = true; + Expect.equals("value", data); + }, + onDone: () { + Expect.isTrue(gotValue); + asyncEnd(); + }, + ); } void testFutureWhenCompleteValue() { @@ -430,18 +468,20 @@ } var completer = new Completer(); - completer.future.whenComplete(() { - countDown(3); - var completer2 = new Completer(); - new Timer(MS * 10, () { - countDown(2); - completer2.complete(37); - }); - return completer2.future; - }).then((v) { - Expect.equals(42, v); - countDown(1); - }); + completer.future + .whenComplete(() { + countDown(3); + var completer2 = new Completer(); + new Timer(MS * 10, () { + countDown(2); + completer2.complete(37); + }); + return completer2.future; + }) + .then((v) { + Expect.equals(42, v); + countDown(1); + }); completer.complete(42); } @@ -455,20 +495,25 @@ } var completer = new Completer(); - completer.future.whenComplete(() { - countDown(3); - var completer2 = new Completer(); - new Timer(MS * 10, () { - countDown(2); - completer2.completeError("Fail"); - }); - return completer2.future; - }).then((v) { - Expect.fail("should fail async"); - }, onError: (error) { - Expect.equals("Fail", error); - countDown(1); - }); + completer.future + .whenComplete(() { + countDown(3); + var completer2 = new Completer(); + new Timer(MS * 10, () { + countDown(2); + completer2.completeError("Fail"); + }); + return completer2.future; + }) + .then( + (v) { + Expect.fail("should fail async"); + }, + onError: (error) { + Expect.equals("Fail", error); + countDown(1); + }, + ); completer.complete(42); } @@ -482,20 +527,25 @@ } var completer = new Completer(); - completer.future.whenComplete(() { - countDown(3); - var completer2 = new Completer(); - new Timer(MS * 10, () { - countDown(2); - completer2.complete(37); - }); - return completer2.future; - }).then((v) { - Expect.fail("should fail async"); - }, onError: (error) { - Expect.equals("Error", error); - countDown(1); - }); + completer.future + .whenComplete(() { + countDown(3); + var completer2 = new Completer(); + new Timer(MS * 10, () { + countDown(2); + completer2.complete(37); + }); + return completer2.future; + }) + .then( + (v) { + Expect.fail("should fail async"); + }, + onError: (error) { + Expect.equals("Error", error); + countDown(1); + }, + ); completer.completeError("Error"); } @@ -509,20 +559,25 @@ } var completer = new Completer(); - completer.future.whenComplete(() { - countDown(3); - var completer2 = new Completer(); - new Timer(MS * 10, () { - countDown(2); - completer2.completeError("Fail"); - }); - return completer2.future; - }).then((v) { - Expect.fail("should fail async"); - }, onError: (error) { - Expect.equals("Fail", error); - countDown(1); - }); + completer.future + .whenComplete(() { + countDown(3); + var completer2 = new Completer(); + new Timer(MS * 10, () { + countDown(2); + completer2.completeError("Fail"); + }); + return completer2.future; + }) + .then( + (v) { + Expect.fail("should fail async"); + }, + onError: (error) { + Expect.equals("Fail", error); + countDown(1); + }, + ); completer.completeError("Error"); } @@ -533,13 +588,15 @@ int error = 42; asyncStart(); - future.then((v) { - throw error; - return null; - }).catchError((e) { - Expect.identical(error, e); - asyncEnd(); - }); + future + .then((v) { + throw error; + return null; + }) + .catchError((e) { + Expect.identical(error, e); + asyncEnd(); + }); completer.complete(0); } @@ -549,12 +606,14 @@ int error = 42; asyncStart(); - future.catchError((e) { - throw error; - }).catchError((e) { - Expect.identical(error, e); - asyncEnd(); - }); + future + .catchError((e) { + throw error; + }) + .catchError((e) { + Expect.identical(error, e); + asyncEnd(); + }); completer.completeError(0); } @@ -564,13 +623,15 @@ var error; asyncStart(); - future.catchError((e) { - error = e; - throw e; - }).catchError((e) { - Expect.identical(error, e); - asyncEnd(); - }); + future + .catchError((e) { + error = e; + throw e; + }) + .catchError((e) { + Expect.identical(error, e); + asyncEnd(); + }); completer.completeError(0); } @@ -580,12 +641,14 @@ var error = 42; asyncStart(); - future.whenComplete(() { - throw error; - }).catchError((e) { - Expect.identical(error, e); - asyncEnd(); - }); + future + .whenComplete(() { + throw error; + }) + .catchError((e) { + Expect.identical(error, e); + asyncEnd(); + }); completer.complete(0); } @@ -631,13 +694,16 @@ final completer = new Completer<int>(); final completer2 = new Completer<int>(); completer.complete(completer2.future); - completer.future.then((v) { - Expect.fail("Should not happen"); - asyncEnd(); - }, onError: (e) { - Expect.equals("ERROR-tcwfe", e); - asyncEnd(); - }); + completer.future.then( + (v) { + Expect.fail("Should not happen"); + asyncEnd(); + }, + onError: (e) { + Expect.equals("ERROR-tcwfe", e); + asyncEnd(); + }, + ); completer2.completeError("ERROR-tcwfe"); } @@ -646,28 +712,34 @@ final completer = new Completer<int>(); var result = new Future<int>.error("ERROR-tcwfe2"); completer.complete(result); - completer.future.then((v) { - Expect.fail("Should not happen"); - asyncEnd(); - }, onError: (e) { - Expect.equals("ERROR-tcwfe2", e); - asyncEnd(); - }); + completer.future.then( + (v) { + Expect.fail("Should not happen"); + asyncEnd(); + }, + onError: (e) { + Expect.equals("ERROR-tcwfe2", e); + asyncEnd(); + }, + ); } void testCompleteErrorWithFuture() { asyncStart(); final completer = new Completer<int>(); completer.completeError(new Future.value(42)); - completer.future.then((_) { - Expect.fail("Shouldn't happen"); - }, onError: (e, s) { - Future f = e; - f.then((v) { - Expect.equals(42, v); - asyncEnd(); - }); - }); + completer.future.then( + (_) { + Expect.fail("Shouldn't happen"); + }, + onError: (e, s) { + Future f = e; + f.then((v) { + Expect.equals(42, v); + asyncEnd(); + }); + }, + ); } void testCompleteWithCustomFutureSuccess() { @@ -687,13 +759,16 @@ final completer = new Completer<int>(); final completer2 = new Completer<int>(); completer.complete(new CustomFuture<int>(completer2.future)); - completer.future.then((v) { - Expect.fail("Should not happen"); - asyncEnd(); - }, onError: (e) { - Expect.equals("ERROR-tcwcfe", e); - asyncEnd(); - }); + completer.future.then( + (v) { + Expect.fail("Should not happen"); + asyncEnd(); + }, + onError: (e) { + Expect.equals("ERROR-tcwcfe", e); + asyncEnd(); + }, + ); completer2.completeError("ERROR-tcwcfe"); } @@ -702,15 +777,18 @@ final completer = new Completer<int>(); var future = new CustomFuture<int>(new Future.value(42)); completer.completeError(future); - completer.future.then((_) { - Expect.fail("Shouldn't happen"); - }, onError: (e) { - Future f = e; - f.then((v) { - Expect.equals(42, v); - asyncEnd(); - }); - }); + completer.future.then( + (_) { + Expect.fail("Shouldn't happen"); + }, + onError: (e) { + Future f = e; + f.then((v) { + Expect.equals(42, v); + asyncEnd(); + }); + }, + ); } void testChainedFutureValue() { @@ -731,12 +809,14 @@ asyncStart(); future - .then((v) => - new Future.delayed(const Duration(milliseconds: 10), () => v * 2)) + .then( + (v) => + new Future.delayed(const Duration(milliseconds: 10), () => v * 2), + ) .then((v) { - Expect.equals(42, v); - asyncEnd(); - }); + Expect.equals(42, v); + asyncEnd(); + }); completer.complete(21); } @@ -754,12 +834,17 @@ final future = completer.future; asyncStart(); - future.then((v) => new Future.error("Fehler")).then((v) { - Expect.fail("unreachable!"); - }, onError: (error) { - Expect.equals("Fehler", error); - asyncEnd(); - }); + future + .then((v) => new Future.error("Fehler")) + .then( + (v) { + Expect.fail("unreachable!"); + }, + onError: (error) { + Expect.equals("Fehler", error); + asyncEnd(); + }, + ); completer.complete(21); } @@ -789,8 +874,10 @@ int permuteTmp = permute; for (int i = 0; i < 3; i++) { bool throws = (mask & (1 << i)) != 0; - var future = new Future.delayed(new Duration(milliseconds: 100 * (i + 1)), - () => (throws ? throw "Error $i($mask-$permute)" : i)); + var future = new Future.delayed( + new Duration(milliseconds: 100 * (i + 1)), + () => (throws ? throw "Error $i($mask-$permute)" : i), + ); int mod = 3 - i; int position = permuteTmp % mod; permuteTmp = permuteTmp ~/ mod; @@ -803,12 +890,15 @@ cleanup[index] = true; } - Future.wait(futures.map((future) => future!), cleanUp: cleanUp).then((_) { - Expect.fail("No error: $stringId"); - }, onError: (e, s) { - Expect.listEquals([true, true, true], cleanup); - asyncEnd(); - }); + Future.wait(futures.map((future) => future!), cleanUp: cleanUp).then( + (_) { + Expect.fail("No error: $stringId"); + }, + onError: (e, s) { + Expect.listEquals([true, true, true], cleanup); + asyncEnd(); + }, + ); } for (int i = 1; i < 8; i++) { @@ -834,8 +924,10 @@ int permuteTmp = permute; for (int i = 0; i < 3; i++) { bool throws = (mask & (1 << i)) != 0; - var future = new Future.delayed(new Duration(milliseconds: 100 * (i + 1)), - () => (throws ? throw "Error $i($mask-$permute)" : i)); + var future = new Future.delayed( + new Duration(milliseconds: 100 * (i + 1)), + () => (throws ? throw "Error $i($mask-$permute)" : i), + ); int mod = 3 - i; int position = permuteTmp % mod; permuteTmp = permuteTmp ~/ mod; @@ -858,14 +950,19 @@ checkDone(); } - Future.wait(futures.map((future) => future!), - eagerError: true, cleanUp: cleanUp) - .then((_) { - Expect.fail("No error: $stringId"); - }, onError: (e, s) { - asyncEnd(); - checkDone(); - }); + Future.wait( + futures.map((future) => future!), + eagerError: true, + cleanUp: cleanUp, + ).then( + (_) { + Expect.fail("No error: $stringId"); + }, + onError: (e, s) { + asyncEnd(); + checkDone(); + }, + ); } for (int i = 1; i < 8; i++) { @@ -883,27 +980,35 @@ asyncStart(); asyncStart(); asyncStart(); - runZonedGuarded(() { - Future<List<int>?>.value(Future.wait([ - new Future.delayed(cms, () => 0), - new Future.delayed(cms * 2, () => throw 1), - new Future.delayed(cms * 3, () => 2) - ], cleanUp: (index) { + runZonedGuarded( + () { + Future<List<int>?>.value( + Future.wait( + [ + new Future.delayed(cms, () => 0), + new Future.delayed(cms * 2, () => throw 1), + new Future.delayed(cms * 3, () => 2), + ], + cleanUp: (index) { + Expect.isTrue(index == 0 || index == 2, "$index"); + Expect.isFalse(cleanups[index]); + cleanups[index] = true; + throw index; + }, + ), + ).catchError((e) { + Expect.equals(e, 1); + asyncEnd(); + }); + }, + (e, s) { + int index = e as int; Expect.isTrue(index == 0 || index == 2, "$index"); - Expect.isFalse(cleanups[index]); - cleanups[index] = true; - throw index; - })).catchError((e) { - Expect.equals(e, 1); + Expect.isFalse(uncaughts[index]); + uncaughts[index] = true; asyncEnd(); - }); - }, (e, s) { - int index = e as int; - Expect.isTrue(index == 0 || index == 2, "$index"); - Expect.isFalse(uncaughts[index]); - uncaughts[index] = true; - asyncEnd(); - }); + }, + ); } void testWaitSyncError() { @@ -911,19 +1016,24 @@ var cleanups = new List.filled(3, false); asyncStart(); asyncStart(); - runZonedGuarded(() { - Future.wait( + runZonedGuarded( + () { + Future.wait( new Iterable.generate(5, (i) { if (i != 3) return new Future.delayed(cms * (i + 1), () => i); throw "throwing synchronously in iterable"; - }), cleanUp: (dynamic index) { - Expect.isFalse(cleanups[index]); - cleanups[index] = true; - if (cleanups.every((x) => x)) asyncEnd(); - }); - }, (e, s) { - asyncEnd(); - }); + }), + cleanUp: (dynamic index) { + Expect.isFalse(cleanups[index]); + cleanups[index] = true; + if (cleanups.every((x) => x)) asyncEnd(); + }, + ); + }, + (e, s) { + asyncEnd(); + }, + ); } // Creates an Iterable that throws when iterated. Used to validate how @@ -950,8 +1060,13 @@ var caughtError; var count = 0; - AsyncError? errorCallback(Zone self, ZoneDelegate parent, Zone zone, - Object error, StackTrace? stackTrace) { + AsyncError? errorCallback( + Zone self, + ZoneDelegate parent, + Zone zone, + Object error, + StackTrace? stackTrace, + ) { Expect.equals(0, count); count++; caughtError = error; @@ -974,20 +1089,26 @@ asyncStart(); Completer completer = new Completer(); completer.complete(bad); - completer.future.then((_) { - Expect.fail("unreachable"); - }, onError: (e, s) { - Expect.isTrue(completer.isCompleted); - asyncEnd(); - }); + completer.future.then( + (_) { + Expect.fail("unreachable"); + }, + onError: (e, s) { + Expect.isTrue(completer.isCompleted); + asyncEnd(); + }, + ); asyncStart(); var f = new Future.value().then((_) => bad); - f.then((_) { - Expect.fail("unreachable"); - }, onError: (e, s) { - asyncEnd(); - }); + f.then( + (_) { + Expect.fail("unreachable"); + }, + onError: (e, s) { + asyncEnd(); + }, + ); } void testTypes() { @@ -999,7 +1120,9 @@ var stream = future.asStream(); Expect.isTrue(stream is Stream<int>, "$desc.asStream() is Stream<int>"); Expect.isFalse( - stream is Stream<String>, "$desc.asStream() is! Stream<String>"); + stream is Stream<String>, + "$desc.asStream() is! Stream<String>", + ); if (depth > 0) { testType(name, future.whenComplete(() {}), depth - 1); } @@ -1007,16 +1130,24 @@ for (var value in [42]) { testType("Future($value)", new Future<int>(() => value)); - testType("Future.delayed($value)", - new Future<int>.delayed(Duration.zero, () => value)); testType( - "Future.microtask($value)", new Future<int>.microtask(() => value)); + "Future.delayed($value)", + new Future<int>.delayed(Duration.zero, () => value), + ); + testType( + "Future.microtask($value)", + new Future<int>.microtask(() => value), + ); testType("Future.sync($value)", new Future<int>.sync(() => value)); - testType("Future.sync(future($value))", - new Future<int>.sync(() => new Future<int>.value(value))); + testType( + "Future.sync(future($value))", + new Future<int>.sync(() => new Future<int>.value(value)), + ); testType("Future.value($value)", new Future<int>.value(value)); testType( - "Future.error", new Future<int>.error("ERR")..catchError((_) => value)); + "Future.error", + new Future<int>.error("ERR")..catchError((_) => value), + ); } testType("Completer.future", new Completer<int>().future); } @@ -1026,12 +1157,15 @@ var cs = new List.generate(3, (_) => new Completer()); var result = Future.any(cs.map((x) => x.future)); - result.then((v) { - Expect.equals(42, v); - asyncEnd(); - }, onError: (e, s) { - Expect.fail("Unexpected error: $e"); - }); + result.then( + (v) { + Expect.equals(42, v); + asyncEnd(); + }, + onError: (e, s) { + Expect.fail("Unexpected error: $e"); + }, + ); cs[1].complete(42); cs[2].complete(10); @@ -1043,12 +1177,15 @@ var cs = new List.generate(3, (_) => new Completer()); var result = Future.any(cs.map((x) => x.future)); - result.then((v) { - Expect.fail("Unexpected value: $v"); - }, onError: (e, s) { - Expect.equals(42, e); - asyncEnd(); - }); + result.then( + (v) { + Expect.fail("Unexpected value: $v"); + }, + onError: (e, s) { + Expect.equals(42, e); + asyncEnd(); + }, + ); cs[1].completeError(42); cs[2].complete(10); @@ -1060,12 +1197,15 @@ var cs = new List.generate(3, (_) => new Completer()); var result = Future.any(cs.map((x) => x.future)); - result.then((v) { - Expect.equals(42, v); - asyncEnd(); - }, onError: (e, s) { - Expect.fail("Unexpected error: $e"); - }); + result.then( + (v) { + Expect.equals(42, v); + asyncEnd(); + }, + onError: (e, s) { + Expect.fail("Unexpected error: $e"); + }, + ); cs[1].complete(42); // The other two futures never complete. @@ -1076,12 +1216,15 @@ var cs = new List.generate(3, (_) => new Completer()); var result = Future.any(cs.map((x) => x.future)); - result.then((v) { - Expect.equals(42, v); - asyncEnd(); - }, onError: (e, s) { - Expect.fail("Unexpected error: $e"); - }); + result.then( + (v) { + Expect.equals(42, v); + asyncEnd(); + }, + onError: (e, s) { + Expect.fail("Unexpected error: $e"); + }, + ); cs[1].complete(42); // The errors are ignored, not uncaught. @@ -1271,8 +1414,8 @@ final _result; final int _badness; UglyFuture(int badness) - : _badness = badness, - _result = (badness == 0) ? 42 : new UglyFuture(badness - 1); + : _badness = badness, + _result = (badness == 0) ? 42 : new UglyFuture(badness - 1); Future<S> then<S>(action(value), {Function? onError}) { var c = new Completer<S>(); c.complete(new Future<S>.microtask(() => action(_result)));
diff --git a/tests/lib/async/future_timeout_test.dart b/tests/lib/async/future_timeout_test.dart index a03d486..1176d70 100644 --- a/tests/lib/async/future_timeout_test.dart +++ b/tests/lib/async/future_timeout_test.dart
@@ -12,8 +12,10 @@ Future timeoutNoComplete() async { asyncStart(); Completer completer = new Completer(); - Future timedOut = completer.future - .timeout(const Duration(milliseconds: 5), onTimeout: () => 42); + Future timedOut = completer.future.timeout( + const Duration(milliseconds: 5), + onTimeout: () => 42, + ); timedOut.then((v) { Expect.isTrue(v == 42); asyncEnd(); @@ -23,8 +25,10 @@ Future timeoutCompleteAfterTimeout() async { asyncStart(); Completer completer = new Completer(); - Future timedOut = completer.future - .timeout(const Duration(milliseconds: 5), onTimeout: () => 42); + Future timedOut = completer.future.timeout( + const Duration(milliseconds: 5), + onTimeout: () => 42, + ); Timer timer = new Timer(const Duration(seconds: 1), () { asyncStart(); completer.complete(-1); @@ -42,8 +46,10 @@ asyncStart(); completer.complete(42); }); - Future timedOut = completer.future - .timeout(const Duration(seconds: 1), onTimeout: () => -1); + Future timedOut = completer.future.timeout( + const Duration(seconds: 1), + onTimeout: () => -1, + ); timedOut.then((v) { Expect.isTrue(v == 42); asyncEnd(); @@ -54,8 +60,10 @@ asyncStart(); Completer completer = new Completer.sync(); completer.complete(42); - Future timedOut = completer.future - .timeout(const Duration(milliseconds: 5), onTimeout: () => -1); + Future timedOut = completer.future.timeout( + const Duration(milliseconds: 5), + onTimeout: () => -1, + ); timedOut.then((v) { Expect.isTrue(v == 42); asyncEnd(); @@ -65,10 +73,12 @@ Future timeoutThrows() async { asyncStart(); Completer completer = new Completer(); - Future timedOut = completer.future.timeout(const Duration(milliseconds: 5), - onTimeout: () { - throw "EXN1"; - }); + Future timedOut = completer.future.timeout( + const Duration(milliseconds: 5), + onTimeout: () { + throw "EXN1"; + }, + ); timedOut.catchError((e, s) { Expect.isTrue(e == "EXN1"); }); @@ -77,8 +87,10 @@ Future timeoutThrowAfterTimeout() async { asyncStart(); Completer completer = new Completer(); - Future timedOut = completer.future - .timeout(const Duration(milliseconds: 5), onTimeout: () => 42); + Future timedOut = completer.future.timeout( + const Duration(milliseconds: 5), + onTimeout: () => 42, + ); Timer timer = new Timer(const Duration(seconds: 1), () { asyncStart(); completer.completeError("EXN2"); @@ -96,8 +108,10 @@ asyncStart(); completer.completeError("EXN3"); }); - Future timedOut = completer.future - .timeout(const Duration(seconds: 1), onTimeout: () => -1); + Future timedOut = completer.future.timeout( + const Duration(seconds: 1), + onTimeout: () => -1, + ); timedOut.catchError((e, s) { Expect.isTrue(e == "EXN3"); }); @@ -108,8 +122,10 @@ // Prevent uncaught error when we create the error. Completer completer = new Completer.sync()..future.catchError((e) {}); completer.completeError("EXN4"); - Future timedOut = completer.future - .timeout(const Duration(milliseconds: 5), onTimeout: () => -1); + Future timedOut = completer.future.timeout( + const Duration(milliseconds: 5), + onTimeout: () => -1, + ); timedOut.catchError((e, s) { Expect.isTrue(e == "EXN4"); }); @@ -119,8 +135,10 @@ asyncStart(); Future result = new Future.value(42); Completer completer = new Completer(); - Future timedOut = completer.future - .timeout(const Duration(milliseconds: 5), onTimeout: () => result); + Future timedOut = completer.future.timeout( + const Duration(milliseconds: 5), + onTimeout: () => result, + ); timedOut.then((v) { Expect.isTrue(v == 42); asyncEnd(); @@ -131,8 +149,10 @@ asyncStart(); Future result = new Future.error("EXN5")..catchError((e) {}); Completer completer = new Completer(); - Future timedOut = completer.future - .timeout(const Duration(milliseconds: 5), onTimeout: () => result); + Future timedOut = completer.future.timeout( + const Duration(milliseconds: 5), + onTimeout: () => result, + ); timedOut.catchError((e, s) { Expect.isTrue(e == "EXN5"); }); @@ -142,11 +162,13 @@ asyncStart(); Completer result = new Completer(); Completer completer = new Completer(); - Future timedOut = completer.future.timeout(const Duration(milliseconds: 5), - onTimeout: () { - result.complete(42); - return result.future; - }); + Future timedOut = completer.future.timeout( + const Duration(milliseconds: 5), + onTimeout: () { + result.complete(42); + return result.future; + }, + ); timedOut.then((v) { Expect.isTrue(v == 42); asyncEnd(); @@ -157,11 +179,13 @@ asyncStart(); Completer result = new Completer(); Completer completer = new Completer(); - Future timedOut = completer.future.timeout(const Duration(milliseconds: 5), - onTimeout: () { - result.completeError("EXN6"); - return result.future; - }); + Future timedOut = completer.future.timeout( + const Duration(milliseconds: 5), + onTimeout: () { + result.completeError("EXN6"); + return result.future; + }, + ); timedOut.catchError((e, s) { Expect.isTrue(e == "EXN6"); }); @@ -181,28 +205,33 @@ } ; - forked = Zone.current.fork(specification: new ZoneSpecification( + forked = Zone.current.fork( + specification: new ZoneSpecification( registerCallback: <R>(Zone self, ZoneDelegate parent, Zone origin, R f()) { - R Function() result; - if (!identical(f, callback)) { - result = f; - } else { - registerCallDelta++; // Increment calls to register. - Expect.isTrue(origin == forked); - Expect.isTrue(self == forked); - result = () { - registerCallDelta--; - return f(); - }; - } - return f; - })); + R Function() result; + if (!identical(f, callback)) { + result = f; + } else { + registerCallDelta++; // Increment calls to register. + Expect.isTrue(origin == forked); + Expect.isTrue(self == forked); + result = () { + registerCallDelta--; + return f(); + }; + } + return f; + }, + ), + ); Completer completer = new Completer(); late Future timedOut; forked.run(() { - timedOut = completer.future - .timeout(const Duration(milliseconds: 5), onTimeout: callback); + timedOut = completer.future.timeout( + const Duration(milliseconds: 5), + onTimeout: callback, + ); }); timedOut.then((v) { Expect.isTrue(callbackCalled);
diff --git a/tests/lib/async/futures_test.dart b/tests/lib/async/futures_test.dart index d32febf..24836d8 100644 --- a/tests/lib/async/futures_test.dart +++ b/tests/lib/async/futures_test.dart
@@ -53,12 +53,14 @@ c1.complete(); c2.completeError('correct error'); - return Future.wait(futures).then<void>((_) { - throw 'incorrect error'; - }).catchError((error, stackTrace) { - Expect.equals('correct error', error); - Expect.isNotNull(stackTrace); - }); + return Future.wait(futures) + .then<void>((_) { + throw 'incorrect error'; + }) + .catchError((error, stackTrace) { + Expect.equals('correct error', error); + Expect.isNotNull(stackTrace); + }); } Future testWaitWithMultipleErrors() { @@ -70,12 +72,14 @@ c1.completeError('correct error'); c2.completeError('incorrect error 1'); - return Future.wait(futures).then<void>((_) { - throw 'incorrect error 2'; - }).catchError((error, stackTrace) { - Expect.equals('correct error', error); - Expect.isNotNull(stackTrace); - }); + return Future.wait(futures) + .then<void>((_) { + throw 'incorrect error 2'; + }) + .catchError((error, stackTrace) { + Expect.equals('correct error', error); + Expect.isNotNull(stackTrace); + }); } // Regression test for https://github.com/dart-lang/sdk/issues/41656 @@ -96,12 +100,14 @@ c1.completeError('correct error'); c2.completeError('incorrect error 1'); - return Future.wait(futures, eagerError: true).then<void>((_) { - throw 'incorrect error 2'; - }).catchError((error, stackTrace) { - Expect.equals('correct error', error); - Expect.isNotNull(stackTrace); - }); + return Future.wait(futures, eagerError: true) + .then<void>((_) { + throw 'incorrect error 2'; + }) + .catchError((error, stackTrace) { + Expect.equals('correct error', error); + Expect.isNotNull(stackTrace); + }); } StackTrace get currentStackTrace { @@ -121,12 +127,14 @@ c1.complete(); c2.completeError('correct error', currentStackTrace); - return Future.wait(futures).then<void>((_) { - throw 'incorrect error'; - }).catchError((error, stackTrace) { - Expect.equals('correct error', error); - Expect.isNotNull(stackTrace); - }); + return Future.wait(futures) + .then<void>((_) { + throw 'incorrect error'; + }) + .catchError((error, stackTrace) { + Expect.equals('correct error', error); + Expect.isNotNull(stackTrace); + }); } Future testWaitWithMultipleErrorsWithStackTrace() { @@ -138,12 +146,14 @@ c1.completeError('correct error', currentStackTrace); c2.completeError('incorrect error 1'); - return Future.wait(futures).then<void>((_) { - throw 'incorrect error 2'; - }).catchError((error, stackTrace) { - Expect.equals('correct error', error); - Expect.isNotNull(stackTrace); - }); + return Future.wait(futures) + .then<void>((_) { + throw 'incorrect error 2'; + }) + .catchError((error, stackTrace) { + Expect.equals('correct error', error); + Expect.isNotNull(stackTrace); + }); } Future testWaitWithMultipleErrorsWithStackTraceEager() { @@ -155,12 +165,14 @@ c1.completeError('correct error', currentStackTrace); c2.completeError('incorrect error 1'); - return Future.wait(futures, eagerError: true).then<void>((_) { - throw 'incorrect error 2'; - }).catchError((error, stackTrace) { - Expect.equals('correct error', error); - Expect.isNotNull(stackTrace); - }); + return Future.wait(futures, eagerError: true) + .then<void>((_) { + throw 'incorrect error 2'; + }) + .catchError((error, stackTrace) { + Expect.equals('correct error', error); + Expect.isNotNull(stackTrace); + }); } Future testEagerWait() { @@ -174,14 +186,19 @@ final c2 = new Completer(); final futures = <Future>[c1.future, c2.future]; final waited = Future.wait(futures, eagerError: true); - final result = waited.then<void>((v) { - throw "should not be called"; - }, onError: (e, s) { - Expect.equals(e, 42); - Expect.identical(st, s); - }).whenComplete(() { - return new Future(() => true); - }); + final result = waited + .then<void>( + (v) { + throw "should not be called"; + }, + onError: (e, s) { + Expect.equals(e, 42); + Expect.identical(st, s); + }, + ) + .whenComplete(() { + return new Future(() => true); + }); c1.completeError(42, st); return result; } @@ -202,21 +219,28 @@ Future testForEachSync() { final seen = <int>[]; - return Future.forEach([1, 2, 3, 4, 5], seen.add) - .then((_) => Expect.listEquals([1, 2, 3, 4, 5], seen)); + return Future.forEach([ + 1, + 2, + 3, + 4, + 5, + ], seen.add).then((_) => Expect.listEquals([1, 2, 3, 4, 5], seen)); } Future testForEachWithException() { final seen = <int>[]; return Future.forEach([1, 2, 3, 4, 5], (dynamic n) { - if (n == 4) throw 'correct exception'; - seen.add(n); - return new Future.value(); - }).then<void>((_) { - throw 'incorrect exception'; - }).catchError((error) { - Expect.equals('correct exception', error); - }); + if (n == 4) throw 'correct exception'; + seen.add(n); + return new Future.value(); + }) + .then<void>((_) { + throw 'incorrect exception'; + }) + .catchError((error) { + Expect.equals('correct exception', error); + }); } Future testDoWhile() { @@ -238,16 +262,19 @@ Future testDoWhileWithException() { var count = 0; return Future.doWhile(() { - count++; - if (count == 4) throw 'correct exception'; - return new Future(() => true); - }).then<void>((_) { - throw 'incorrect exception'; - }).catchError((error) { - Expect.equals('correct exception', error); - }).whenComplete(() { - return new Future(() => false); - }); + count++; + if (count == 4) throw 'correct exception'; + return new Future(() => true); + }) + .then<void>((_) { + throw 'incorrect exception'; + }) + .catchError((error) { + Expect.equals('correct exception', error); + }) + .whenComplete(() { + return new Future(() => false); + }); } main() {
diff --git a/tests/lib/async/ignore_regress_56806_test.dart b/tests/lib/async/ignore_regress_56806_test.dart index 7275a5c..524cbfc 100644 --- a/tests/lib/async/ignore_regress_56806_test.dart +++ b/tests/lib/async/ignore_regress_56806_test.dart
@@ -17,10 +17,14 @@ await testNoThrow(); asyncStart(); - await runZoned(testDoThrow, zoneSpecification: ZoneSpecification( + await runZoned( + testDoThrow, + zoneSpecification: ZoneSpecification( handleUncaughtError: (s, p, z, Object error, StackTrace stack) { - asyncEnd(); - })); + asyncEnd(); + }, + ), + ); asyncEnd(); } @@ -28,7 +32,9 @@ Future<void> testNoThrow() async { var completer = Completer<void>(); final future = Future<void>.delayed( - Duration.zero, () => throw StateError("Should be ignored")); + Duration.zero, + () => throw StateError("Should be ignored"), + ); var future2 = future.whenComplete(() async { await Future.delayed(Duration.zero); completer.complete(); @@ -40,7 +46,9 @@ Future<void> testDoThrow() async { var completer = Completer<void>(); final future = Future<void>.delayed( - Duration.zero, () => throw StateError("Should not be ignored")); + Duration.zero, + () => throw StateError("Should not be ignored"), + ); future.ignore(); // Ignores error only on `future`. future.whenComplete(() async { await Future.delayed(Duration.zero);
diff --git a/tests/lib/async/intercept_print1_test.dart b/tests/lib/async/intercept_print1_test.dart index 36b2fba..77a9d1d 100644 --- a/tests/lib/async/intercept_print1_test.dart +++ b/tests/lib/async/intercept_print1_test.dart
@@ -32,7 +32,7 @@ print("1"); print(2); print({ - 3: [4] + 3: [4], }); }); zone2.run(() { @@ -40,7 +40,11 @@ shouldIntercept = false; print(6); }); - Expect.listEquals( - ["print: 1", "print: 2", "print: {3: [4]}", "print **: 5", "print: 6"], - events); + Expect.listEquals([ + "print: 1", + "print: 2", + "print: {3: [4]}", + "print **: 5", + "print: 6", + ], events); }
diff --git a/tests/lib/async/intercept_schedule_microtask1_test.dart b/tests/lib/async/intercept_schedule_microtask1_test.dart index d4b3897..1bd5199 100644 --- a/tests/lib/async/intercept_schedule_microtask1_test.dart +++ b/tests/lib/async/intercept_schedule_microtask1_test.dart
@@ -8,8 +8,11 @@ main() { // Test that runZoned returns the result of executing the body. - var result = runZonedScheduleMicrotask(() => 499, onScheduleMicrotask: (f) { - Expect.fail("Unexpected invocation."); - }); + var result = runZonedScheduleMicrotask( + () => 499, + onScheduleMicrotask: (f) { + Expect.fail("Unexpected invocation."); + }, + ); Expect.equals(499, result); }
diff --git a/tests/lib/async/intercept_schedule_microtask2_test.dart b/tests/lib/async/intercept_schedule_microtask2_test.dart index 123f69d..a738ba6 100644 --- a/tests/lib/async/intercept_schedule_microtask2_test.dart +++ b/tests/lib/async/intercept_schedule_microtask2_test.dart
@@ -27,6 +27,10 @@ var result = runZonedScheduleMicrotask(body, onScheduleMicrotask: handler); // No need for a ReceivePort: If the runZonedScheduleMicrotask misbehaved we // would have an [events] list that is different from what we expect. - Expect.listEquals( - ["body entry", "handler", "run async body", "handler done"], events); + Expect.listEquals([ + "body entry", + "handler", + "run async body", + "handler done", + ], events); }
diff --git a/tests/lib/async/intercept_schedule_microtask3_test.dart b/tests/lib/async/intercept_schedule_microtask3_test.dart index 9d5693e..7972a0c 100644 --- a/tests/lib/async/intercept_schedule_microtask3_test.dart +++ b/tests/lib/async/intercept_schedule_microtask3_test.dart
@@ -33,9 +33,13 @@ var result = runZonedScheduleMicrotask(body, onScheduleMicrotask: handler); events.add("after"); scheduleMicrotask(() { - Expect.listEquals( - ["body entry", "handler", "handler done", "after", "run async body"], - events); + Expect.listEquals([ + "body entry", + "handler", + "handler done", + "after", + "run async body", + ], events); asyncEnd(); }); }
diff --git a/tests/lib/async/intercept_schedule_microtask4_test.dart b/tests/lib/async/intercept_schedule_microtask4_test.dart index 09525de..4b8f4b6 100644 --- a/tests/lib/async/intercept_schedule_microtask4_test.dart +++ b/tests/lib/async/intercept_schedule_microtask4_test.dart
@@ -44,7 +44,7 @@ "run async body", "handler", "handler done", - "run nested body" + "run nested body", ], events); asyncEnd(); });
diff --git a/tests/lib/async/intercept_schedule_microtask5_test.dart b/tests/lib/async/intercept_schedule_microtask5_test.dart index dde63a2..c8d0d21 100644 --- a/tests/lib/async/intercept_schedule_microtask5_test.dart +++ b/tests/lib/async/intercept_schedule_microtask5_test.dart
@@ -39,8 +39,9 @@ // Test that nested runZonedScheduleMicrotask go to the next outer zone. var result = runZonedScheduleMicrotask( - () => runZonedScheduleMicrotask(body, onScheduleMicrotask: handler2), - onScheduleMicrotask: handler); + () => runZonedScheduleMicrotask(body, onScheduleMicrotask: handler2), + onScheduleMicrotask: handler, + ); events.add("after"); Timer.run(() { Expect.listEquals([ @@ -55,7 +56,7 @@ "handler", "handler done", "handler2 done", - "run nested body" + "run nested body", ], events); asyncEnd(); });
diff --git a/tests/lib/async/intercept_schedule_microtask6_test.dart b/tests/lib/async/intercept_schedule_microtask6_test.dart index ced3317..06f069c 100644 --- a/tests/lib/async/intercept_schedule_microtask6_test.dart +++ b/tests/lib/async/intercept_schedule_microtask6_test.dart
@@ -39,8 +39,11 @@ // Test that runZonedScheduleMicrotask works when async, error and done // are used. - var result = runZonedScheduleMicrotask(body, - onScheduleMicrotask: onAsyncHandler, onError: onErrorHandler); + var result = runZonedScheduleMicrotask( + body, + onScheduleMicrotask: onAsyncHandler, + onError: onErrorHandler, + ); events.add("after"); Timer.run(() { Expect.listEquals([ @@ -49,7 +52,7 @@ "async handler done", "after", "run async body", - "error: foo" + "error: foo", ], events); asyncEnd(); });
diff --git a/tests/lib/async/multiple_timer_test.dart b/tests/lib/async/multiple_timer_test.dart index 6d06430..1009cf0 100644 --- a/tests/lib/async/multiple_timer_test.dart +++ b/tests/lib/async/multiple_timer_test.dart
@@ -28,32 +28,40 @@ late int _message; void timeoutHandler1() { - Expect.isTrue((_stopwatch1.elapsedMilliseconds + safetyMargin) >= - TIMEOUT1.inMilliseconds); + Expect.isTrue( + (_stopwatch1.elapsedMilliseconds + safetyMargin) >= + TIMEOUT1.inMilliseconds, + ); Expect.equals(_order[_message], 0); _message++; asyncEnd(); } void timeoutHandler2() { - Expect.isTrue((_stopwatch2.elapsedMilliseconds + safetyMargin) >= - TIMEOUT2.inMilliseconds); + Expect.isTrue( + (_stopwatch2.elapsedMilliseconds + safetyMargin) >= + TIMEOUT2.inMilliseconds, + ); Expect.equals(_order[_message], 1); _message++; asyncEnd(); } void timeoutHandler3() { - Expect.isTrue((_stopwatch3.elapsedMilliseconds + safetyMargin) >= - TIMEOUT3.inMilliseconds); + Expect.isTrue( + (_stopwatch3.elapsedMilliseconds + safetyMargin) >= + TIMEOUT3.inMilliseconds, + ); Expect.equals(_order[_message], 2); _message++; asyncEnd(); } void timeoutHandler4() { - Expect.isTrue((_stopwatch4.elapsedMilliseconds + safetyMargin) >= - TIMEOUT4.inMilliseconds); + Expect.isTrue( + (_stopwatch4.elapsedMilliseconds + safetyMargin) >= + TIMEOUT4.inMilliseconds, + ); Expect.equals(_order[_message], 3); _message++; asyncEnd();
diff --git a/tests/lib/async/null_future_zone_test.dart b/tests/lib/async/null_future_zone_test.dart index 5b73b10..6763747 100644 --- a/tests/lib/async/null_future_zone_test.dart +++ b/tests/lib/async/null_future_zone_test.dart
@@ -15,13 +15,19 @@ late Future nullFuture; late Future falseFuture; - runZoned(() { - nullFuture = (new StreamController()..stream.listen(null).cancel()).done; - falseFuture = it.moveNext(); - }, zoneSpecification: new ZoneSpecification(scheduleMicrotask: - (Zone self, ZoneDelegate parent, Zone zone, void f()) { - Expect.fail("Should not be called"); - })); + runZoned( + () { + nullFuture = + (new StreamController()..stream.listen(null).cancel()).done; + falseFuture = it.moveNext(); + }, + zoneSpecification: new ZoneSpecification( + scheduleMicrotask: + (Zone self, ZoneDelegate parent, Zone zone, void f()) { + Expect.fail("Should not be called"); + }, + ), + ); nullFuture.then((value) { Expect.isNull(value);
diff --git a/tests/lib/async/run_zoned4_test.dart b/tests/lib/async/run_zoned4_test.dart index fb5166a..8abd28a 100644 --- a/tests/lib/async/run_zoned4_test.dart +++ b/tests/lib/async/run_zoned4_test.dart
@@ -9,8 +9,9 @@ // Make sure `runZoned` returns the result of a synchronous call when an // error handler is defined. Expect.equals( - 499, - runZonedGuarded(() => 499, (e, s) { - throw "Unexpected"; - })); + 499, + runZonedGuarded(() => 499, (e, s) { + throw "Unexpected"; + }), + ); }
diff --git a/tests/lib/async/run_zoned5_test.dart b/tests/lib/async/run_zoned5_test.dart index 1bb9c08..523e13d 100644 --- a/tests/lib/async/run_zoned5_test.dart +++ b/tests/lib/async/run_zoned5_test.dart
@@ -10,10 +10,13 @@ main() { asyncStart(); // Ensure that `runZoned`'s onError handles synchronous errors. - runZonedGuarded(() { - throw 0; - }, (e, s) { - Expect.equals(0, e); - asyncEnd(); - }); + runZonedGuarded( + () { + throw 0; + }, + (e, s) { + Expect.equals(0, e); + asyncEnd(); + }, + ); }
diff --git a/tests/lib/async/run_zoned7_test.dart b/tests/lib/async/run_zoned7_test.dart index 9c8eb90..e3bfe02 100644 --- a/tests/lib/async/run_zoned7_test.dart +++ b/tests/lib/async/run_zoned7_test.dart
@@ -28,15 +28,7 @@ }); done.future.whenComplete(() { - Expect.listEquals([ - "main exit", - 1, - 2, - 3, - 4, - 5, - 6, - ], events); + Expect.listEquals(["main exit", 1, 2, 3, 4, 5, 6], events); asyncEnd(); }); events.add("main exit");
diff --git a/tests/lib/async/run_zoned8_test.dart b/tests/lib/async/run_zoned8_test.dart index 8091e5d..4156e87 100644 --- a/tests/lib/async/run_zoned8_test.dart +++ b/tests/lib/async/run_zoned8_test.dart
@@ -15,30 +15,27 @@ var events = []; // Test runZoned with periodic Timers. - runZonedGuarded(() { - int counter = 0; - new Timer.periodic(const Duration(milliseconds: 50), (timer) { - if (counter == 1) { - timer.cancel(); - done.complete(true); - } - counter++; - events.add(counter); - throw counter; - }); - }, (e, [StackTrace? s]) { - events.add("error: $e"); - Expect.isNotNull(s); // Regression test for http://dartbug.com/33589 - }); + runZonedGuarded( + () { + int counter = 0; + new Timer.periodic(const Duration(milliseconds: 50), (timer) { + if (counter == 1) { + timer.cancel(); + done.complete(true); + } + counter++; + events.add(counter); + throw counter; + }); + }, + (e, [StackTrace? s]) { + events.add("error: $e"); + Expect.isNotNull(s); // Regression test for http://dartbug.com/33589 + }, + ); done.future.whenComplete(() { - Expect.listEquals([ - "main exit", - 1, - "error: 1", - 2, - "error: 2", - ], events); + Expect.listEquals(["main exit", 1, "error: 1", 2, "error: 2"], events); asyncEnd(); }); events.add("main exit");
diff --git a/tests/lib/async/slow_consumer2_test.dart b/tests/lib/async/slow_consumer2_test.dart index 1232935..90f501c 100644 --- a/tests/lib/async/slow_consumer2_test.dart +++ b/tests/lib/async/slow_consumer2_test.dart
@@ -32,28 +32,31 @@ Future addStream(Stream stream) { Completer result = new Completer(); var subscription; - subscription = stream.listen((dynamic _data) { - List<int> data = _data; - receivedCount += data.length; - usedBufferSize += data.length; - bufferedData.add(data); - int currentBufferedDataLength = bufferedData.length; - if (usedBufferSize > bufferSize) { - subscription.pause(); - usedBufferSize = 0; - int ms = data.length * 1000 ~/ bytesPerSecond; - Duration duration = new Duration(milliseconds: ms); - new Timer(duration, () { - for (int i = 0; i < currentBufferedDataLength; i++) { - bufferedData[i] = null; - } - subscription.resume(); - }); - } - }, onDone: () { - finalCount = receivedCount; - result.complete(receivedCount); - }); + subscription = stream.listen( + (dynamic _data) { + List<int> data = _data; + receivedCount += data.length; + usedBufferSize += data.length; + bufferedData.add(data); + int currentBufferedDataLength = bufferedData.length; + if (usedBufferSize > bufferSize) { + subscription.pause(); + usedBufferSize = 0; + int ms = data.length * 1000 ~/ bytesPerSecond; + Duration duration = new Duration(milliseconds: ms); + new Timer(duration, () { + for (int i = 0; i < currentBufferedDataLength; i++) { + bufferedData[i] = null; + } + subscription.resume(); + }); + } + }, + onDone: () { + finalCount = receivedCount; + result.complete(receivedCount); + }, + ); return result.future; } @@ -71,7 +74,10 @@ DataProvider(int this.bytesPerSecond, int this.targetCount, this.chunkSize) { controller = new StreamController( - sync: true, onPause: onPauseStateChange, onResume: onPauseStateChange); + sync: true, + onPause: onPauseStateChange, + onResume: onPauseStateChange, + ); Timer.run(send); } @@ -113,10 +119,11 @@ // file). If the consumer doesn't pause the data-provider it will run out of // heap-space. - new DataProvider(800 * MB, 100 * MB, 1 * MB) - .stream - .pipe(new SlowConsumer(200 * MB, 5 * MB)) - .then((count) { + new DataProvider( + 800 * MB, + 100 * MB, + 1 * MB, + ).stream.pipe(new SlowConsumer(200 * MB, 5 * MB)).then((count) { Expect.equals(100 * MB, count); asyncEnd(); });
diff --git a/tests/lib/async/slow_consumer3_test.dart b/tests/lib/async/slow_consumer3_test.dart index 7ddc51f..6dcd0933 100644 --- a/tests/lib/async/slow_consumer3_test.dart +++ b/tests/lib/async/slow_consumer3_test.dart
@@ -32,28 +32,31 @@ Future addStream(Stream stream) { Completer result = new Completer(); var subscription; - subscription = stream.listen((dynamic _data) { - List<int> data = _data; - receivedCount += data.length; - usedBufferSize += data.length; - bufferedData.add(data); - int currentBufferedDataLength = bufferedData.length; - if (usedBufferSize > bufferSize) { - subscription.pause(); - usedBufferSize = 0; - int ms = data.length * 1000 ~/ bytesPerSecond; - Duration duration = new Duration(milliseconds: ms); - new Timer(duration, () { - for (int i = 0; i < currentBufferedDataLength; i++) { - bufferedData[i] = null; - } - subscription.resume(); - }); - } - }, onDone: () { - finalCount = receivedCount; - result.complete(receivedCount); - }); + subscription = stream.listen( + (dynamic _data) { + List<int> data = _data; + receivedCount += data.length; + usedBufferSize += data.length; + bufferedData.add(data); + int currentBufferedDataLength = bufferedData.length; + if (usedBufferSize > bufferSize) { + subscription.pause(); + usedBufferSize = 0; + int ms = data.length * 1000 ~/ bytesPerSecond; + Duration duration = new Duration(milliseconds: ms); + new Timer(duration, () { + for (int i = 0; i < currentBufferedDataLength; i++) { + bufferedData[i] = null; + } + subscription.resume(); + }); + } + }, + onDone: () { + finalCount = receivedCount; + result.complete(receivedCount); + }, + ); return result.future; } @@ -64,10 +67,12 @@ Stream<List<int>> dataGenerator(int bytesTotal, int chunkSize) { int chunks = bytesTotal ~/ chunkSize; - return new Stream.fromIterable(new Iterable.generate(chunks, (_) { - // This assumes one byte per entry. In practice it will be more. - return new List<int>.filled(chunkSize, -1); - })); + return new Stream.fromIterable( + new Iterable.generate(chunks, (_) { + // This assumes one byte per entry. In practice it will be more. + return new List<int>.filled(chunkSize, -1); + }), + ); } main() { @@ -85,9 +90,10 @@ // file). If the consumer doesn't pause the data-provider it will run out of // heap-space. - dataGenerator(100 * MB, 512 * KB) - .pipe(new SlowConsumer(200 * MB, 3 * MB)) - .then((count) { + dataGenerator( + 100 * MB, + 512 * KB, + ).pipe(new SlowConsumer(200 * MB, 3 * MB)).then((count) { Expect.equals(100 * MB, count); asyncEnd(); });
diff --git a/tests/lib/async/slow_consumer_test.dart b/tests/lib/async/slow_consumer_test.dart index 1008a8b..5997759 100644 --- a/tests/lib/async/slow_consumer_test.dart +++ b/tests/lib/async/slow_consumer_test.dart
@@ -30,26 +30,29 @@ bool done = false; Completer completer = new Completer(); var subscription; - subscription = stream.listen((dynamic _data) { - List data = _data; - current = current.then((count) { - // Simulated amount of time it takes to handle the data. - int ms = data.length * 1000 ~/ bytesPerSecond; - Duration duration = new Duration(milliseconds: ms); - if (!done) subscription.pause(); - return new Future.delayed(duration, () { - if (!done) subscription.resume(); - // Make sure we use data here to keep tracking it. - return count + data.length; + subscription = stream.listen( + (dynamic _data) { + List data = _data; + current = current.then((count) { + // Simulated amount of time it takes to handle the data. + int ms = data.length * 1000 ~/ bytesPerSecond; + Duration duration = new Duration(milliseconds: ms); + if (!done) subscription.pause(); + return new Future.delayed(duration, () { + if (!done) subscription.resume(); + // Make sure we use data here to keep tracking it. + return count + data.length; + }); }); - }); - }, onDone: () { - done = true; - current.then((count) { - finalCount = count; - completer.complete(count); - }); - }); + }, + onDone: () { + done = true; + current.then((count) { + finalCount = count; + completer.complete(count); + }); + }, + ); return completer.future; } @@ -68,7 +71,10 @@ DataProvider(int this.bytesPerSecond, int this.targetCount, this.chunkSize) { controller = new StreamController( - sync: true, onPause: onPauseStateChange, onResume: onPauseStateChange); + sync: true, + onPause: onPauseStateChange, + onResume: onPauseStateChange, + ); Timer.run(send); } @@ -115,10 +121,11 @@ // file). If the consumer doesn't pause the data-provider it will run out of // heap-space. - new DataProvider(800 * MB, 100 * MB, 1 * MB) - .stream - .pipe(new SlowConsumer(200 * MB)) - .then((count) { + new DataProvider( + 800 * MB, + 100 * MB, + 1 * MB, + ).stream.pipe(new SlowConsumer(200 * MB)).then((count) { Expect.equals(100 * MB, count); asyncEnd(); });
diff --git a/tests/lib/async/stack_trace05_test.dart b/tests/lib/async/stack_trace05_test.dart index 23f55cc..ffacc24 100644 --- a/tests/lib/async/stack_trace05_test.dart +++ b/tests/lib/async/stack_trace05_test.dart
@@ -22,10 +22,11 @@ .then((_) => new Future.error("e", trace)) .whenComplete(() => 499) .then<Null>((_) { - throw "should never be reached"; - }).catchError((e, st) { - Expect.equals("e", e); - Expect.identical(trace, st); - asyncEnd(); - }); + throw "should never be reached"; + }) + .catchError((e, st) { + Expect.equals("e", e); + Expect.identical(trace, st); + asyncEnd(); + }); }
diff --git a/tests/lib/async/stack_trace06_test.dart b/tests/lib/async/stack_trace06_test.dart index 0695164..d5091dd 100644 --- a/tests/lib/async/stack_trace06_test.dart +++ b/tests/lib/async/stack_trace06_test.dart
@@ -18,12 +18,15 @@ Completer completer = new Completer(); StackTrace trace = captureStackTrace(); asyncStart(); - completer.future.whenComplete(() => 499).then<Null>((_) { - throw "should never be reached"; - }).catchError((e, st) { - Expect.equals("c-error", e); - Expect.identical(trace, st); - asyncEnd(); - }); + completer.future + .whenComplete(() => 499) + .then<Null>((_) { + throw "should never be reached"; + }) + .catchError((e, st) { + Expect.equals("c-error", e); + Expect.identical(trace, st); + asyncEnd(); + }); completer.completeError("c-error", trace); }
diff --git a/tests/lib/async/stack_trace07_test.dart b/tests/lib/async/stack_trace07_test.dart index c02de9a..5bd277c 100644 --- a/tests/lib/async/stack_trace07_test.dart +++ b/tests/lib/async/stack_trace07_test.dart
@@ -18,12 +18,15 @@ Completer completer = new Completer(); StackTrace trace = captureStackTrace(); asyncStart(); - completer.future.whenComplete(() => 499).then<Null>((_) { - throw "bad things happen"; - }).catchError((e, st) { - Expect.equals("bad things happen", e); - Expect.isNotNull(st); - asyncEnd(); - }); + completer.future + .whenComplete(() => 499) + .then<Null>((_) { + throw "bad things happen"; + }) + .catchError((e, st) { + Expect.equals("bad things happen", e); + Expect.isNotNull(st); + asyncEnd(); + }); completer.complete(499); }
diff --git a/tests/lib/async/stack_trace08_test.dart b/tests/lib/async/stack_trace08_test.dart index 7a4e507..5a6c565 100644 --- a/tests/lib/async/stack_trace08_test.dart +++ b/tests/lib/async/stack_trace08_test.dart
@@ -18,17 +18,21 @@ Completer completer = new Completer(); StackTrace trace = captureStackTrace(); asyncStart(); - completer.future.whenComplete(() => 499).then<Null>((_) { - throw "should never be reached"; - }).catchError((e, st) { - Expect.equals("c-error", e); - Expect.identical(trace, st); - // Test the rethrowing the same error keeps the stack trace. - throw e; - }).catchError((e, st) { - Expect.equals("c-error", e); - Expect.identical(trace, st); - asyncEnd(); - }); + completer.future + .whenComplete(() => 499) + .then<Null>((_) { + throw "should never be reached"; + }) + .catchError((e, st) { + Expect.equals("c-error", e); + Expect.identical(trace, st); + // Test the rethrowing the same error keeps the stack trace. + throw e; + }) + .catchError((e, st) { + Expect.equals("c-error", e); + Expect.identical(trace, st); + asyncEnd(); + }); completer.completeError("c-error", trace); }
diff --git a/tests/lib/async/stack_trace09_test.dart b/tests/lib/async/stack_trace09_test.dart index 9bb1e44..02d622f 100644 --- a/tests/lib/async/stack_trace09_test.dart +++ b/tests/lib/async/stack_trace09_test.dart
@@ -17,15 +17,19 @@ main() { StackTrace trace = captureStackTrace(); var controller; - controller = new StreamController(onListen: () { - controller.addError("error", trace); - controller.close(); - }); + controller = new StreamController( + onListen: () { + controller.addError("error", trace); + controller.close(); + }, + ); asyncStart(); - controller.stream.handleError((e, st) { - Expect.equals("error", e); - Expect.identical(trace, st); - }).listen((x) { - throw "should never be reached"; - }, onDone: asyncEnd); + controller.stream + .handleError((e, st) { + Expect.equals("error", e); + Expect.identical(trace, st); + }) + .listen((x) { + throw "should never be reached"; + }, onDone: asyncEnd); }
diff --git a/tests/lib/async/stack_trace10_test.dart b/tests/lib/async/stack_trace10_test.dart index af29897..a063f51 100644 --- a/tests/lib/async/stack_trace10_test.dart +++ b/tests/lib/async/stack_trace10_test.dart
@@ -17,16 +17,24 @@ main() { StackTrace trace = captureStackTrace(); var controller; - controller = new StreamController(onListen: () { - controller.addError("error", trace); - controller.close(); - }); + controller = new StreamController( + onListen: () { + controller.addError("error", trace); + controller.close(); + }, + ); asyncStart(); - controller.stream.listen(null).asFuture().then((_) { - throw "should never be reached"; - }, onError: (e, st) { - Expect.equals("error", e); - Expect.identical(trace, st); - asyncEnd(); - }); + controller.stream + .listen(null) + .asFuture() + .then( + (_) { + throw "should never be reached"; + }, + onError: (e, st) { + Expect.equals("error", e); + Expect.identical(trace, st); + asyncEnd(); + }, + ); }
diff --git a/tests/lib/async/stack_trace11_test.dart b/tests/lib/async/stack_trace11_test.dart index 239411c..003f191 100644 --- a/tests/lib/async/stack_trace11_test.dart +++ b/tests/lib/async/stack_trace11_test.dart
@@ -18,10 +18,13 @@ StackTrace trace = captureStackTrace(); asyncStart(); var f = new Future.error(499, trace); - f.then<Null>((_) { - throw "Unreachable"; - }, onError: (e, st) { - Expect.identical(trace, st); - asyncEnd(); - }); + f.then<Null>( + (_) { + throw "Unreachable"; + }, + onError: (e, st) { + Expect.identical(trace, st); + asyncEnd(); + }, + ); }
diff --git a/tests/lib/async/stack_trace12_test.dart b/tests/lib/async/stack_trace12_test.dart index 2ccd4c4e..257034b 100644 --- a/tests/lib/async/stack_trace12_test.dart +++ b/tests/lib/async/stack_trace12_test.dart
@@ -12,11 +12,14 @@ var f = new Future(() { throw "foo"; }); - f.then<Null>((_) { - throw "Unreachable"; - }, onError: (e, st) { - Expect.equals("foo", e); - Expect.isNotNull(st); - asyncEnd(); - }); + f.then<Null>( + (_) { + throw "Unreachable"; + }, + onError: (e, st) { + Expect.equals("foo", e); + Expect.isNotNull(st); + asyncEnd(); + }, + ); }
diff --git a/tests/lib/async/stack_trace13_test.dart b/tests/lib/async/stack_trace13_test.dart index 6f17050..9930262 100644 --- a/tests/lib/async/stack_trace13_test.dart +++ b/tests/lib/async/stack_trace13_test.dart
@@ -12,11 +12,16 @@ var f = new Future(() { throw "foo"; }); - f.then((_) => 499).then<Null>((_) { - throw "Unreachable"; - }, onError: (e, st) { - Expect.equals("foo", e); - Expect.isNotNull(st); - asyncEnd(); - }); + f + .then((_) => 499) + .then<Null>( + (_) { + throw "Unreachable"; + }, + onError: (e, st) { + Expect.equals("foo", e); + Expect.isNotNull(st); + asyncEnd(); + }, + ); }
diff --git a/tests/lib/async/stack_trace14_test.dart b/tests/lib/async/stack_trace14_test.dart index 8c2d962..a1801a3 100644 --- a/tests/lib/async/stack_trace14_test.dart +++ b/tests/lib/async/stack_trace14_test.dart
@@ -18,11 +18,16 @@ StackTrace trace = captureStackTrace(); asyncStart(); var f = new Future(() => 499); - f.then((_) => new Future.error("e", trace)).then<Null>((_) { - throw "Unreachable"; - }, onError: (e, st) { - Expect.equals("e", e); - Expect.identical(trace, st); - asyncEnd(); - }); + f + .then((_) => new Future.error("e", trace)) + .then<Null>( + (_) { + throw "Unreachable"; + }, + onError: (e, st) { + Expect.equals("e", e); + Expect.identical(trace, st); + asyncEnd(); + }, + ); }
diff --git a/tests/lib/async/stack_trace15_test.dart b/tests/lib/async/stack_trace15_test.dart index f3a7390..1315506 100644 --- a/tests/lib/async/stack_trace15_test.dart +++ b/tests/lib/async/stack_trace15_test.dart
@@ -22,12 +22,16 @@ .then((_) => new Future.error("e", trace)) .whenComplete(() => 499) .then<Null>((_) { - throw "should never be reached"; - }).then<Null>((_) { - throw "Unreachable"; - }, onError: (e, st) { - Expect.equals("e", e); - Expect.identical(trace, st); - asyncEnd(); - }); + throw "should never be reached"; + }) + .then<Null>( + (_) { + throw "Unreachable"; + }, + onError: (e, st) { + Expect.equals("e", e); + Expect.identical(trace, st); + asyncEnd(); + }, + ); }
diff --git a/tests/lib/async/stack_trace16_test.dart b/tests/lib/async/stack_trace16_test.dart index 2c619f8..ca8d3bb 100644 --- a/tests/lib/async/stack_trace16_test.dart +++ b/tests/lib/async/stack_trace16_test.dart
@@ -18,14 +18,20 @@ Completer completer = new Completer(); StackTrace trace = captureStackTrace(); asyncStart(); - completer.future.whenComplete(() => 499).then<Null>((_) { - throw "should never be reached"; - }).then<Null>((_) { - throw "Unreachable"; - }, onError: (e, st) { - Expect.equals("c-error", e); - Expect.identical(trace, st); - asyncEnd(); - }); + completer.future + .whenComplete(() => 499) + .then<Null>((_) { + throw "should never be reached"; + }) + .then<Null>( + (_) { + throw "Unreachable"; + }, + onError: (e, st) { + Expect.equals("c-error", e); + Expect.identical(trace, st); + asyncEnd(); + }, + ); completer.completeError("c-error", trace); }
diff --git a/tests/lib/async/stack_trace17_test.dart b/tests/lib/async/stack_trace17_test.dart index 16be019..bcd1e8b 100644 --- a/tests/lib/async/stack_trace17_test.dart +++ b/tests/lib/async/stack_trace17_test.dart
@@ -18,14 +18,20 @@ Completer completer = new Completer(); StackTrace trace = captureStackTrace(); asyncStart(); - completer.future.whenComplete(() => 499).then<Null>((_) { - throw "bad things happen"; - }).then<Null>((_) { - throw "Unreachable"; - }, onError: (e, st) { - Expect.equals("bad things happen", e); - Expect.isNotNull(st); - asyncEnd(); - }); + completer.future + .whenComplete(() => 499) + .then<Null>((_) { + throw "bad things happen"; + }) + .then<Null>( + (_) { + throw "Unreachable"; + }, + onError: (e, st) { + Expect.equals("bad things happen", e); + Expect.isNotNull(st); + asyncEnd(); + }, + ); completer.complete(499); }
diff --git a/tests/lib/async/stack_trace18_test.dart b/tests/lib/async/stack_trace18_test.dart index 38bffe7..4d920b7 100644 --- a/tests/lib/async/stack_trace18_test.dart +++ b/tests/lib/async/stack_trace18_test.dart
@@ -18,21 +18,31 @@ Completer completer = new Completer(); StackTrace trace = captureStackTrace(); asyncStart(); - completer.future.whenComplete(() => 499).then<Null>((_) { - throw "should never be reached"; - }).then<Null>((_) { - throw "Unreachable"; - }, onError: (e, st) { - Expect.equals("c-error", e); - Expect.identical(trace, st); - // Test the rethrowing the same error keeps the stack trace. - throw e; - }).then<Null>((_) { - throw "Unreachable"; - }, onError: (e, st) { - Expect.equals("c-error", e); - Expect.identical(trace, st); - asyncEnd(); - }); + completer.future + .whenComplete(() => 499) + .then<Null>((_) { + throw "should never be reached"; + }) + .then<Null>( + (_) { + throw "Unreachable"; + }, + onError: (e, st) { + Expect.equals("c-error", e); + Expect.identical(trace, st); + // Test the rethrowing the same error keeps the stack trace. + throw e; + }, + ) + .then<Null>( + (_) { + throw "Unreachable"; + }, + onError: (e, st) { + Expect.equals("c-error", e); + Expect.identical(trace, st); + asyncEnd(); + }, + ); completer.completeError("c-error", trace); }
diff --git a/tests/lib/async/stack_trace19_test.dart b/tests/lib/async/stack_trace19_test.dart index cde3463..d45fe33 100644 --- a/tests/lib/async/stack_trace19_test.dart +++ b/tests/lib/async/stack_trace19_test.dart
@@ -19,21 +19,25 @@ StackTrace trace = captureStackTrace(); late StackTrace whenCompleteStackTrace; asyncStart(); - completer.future.whenComplete(() { - throw "other_error"; - }).then<Null>((_) { - throw "should never be reached"; - }).catchError((e, st) { - Expect.equals("other_error", e); - Expect.isNotNull(st); - Expect.isFalse(identical(trace, st)); - whenCompleteStackTrace = st; - // Test the rethrowing the same error keeps the stack trace. - throw e; - }).catchError((e, st) { - Expect.equals("other_error", e); - Expect.identical(whenCompleteStackTrace, st); - asyncEnd(); - }); + completer.future + .whenComplete(() { + throw "other_error"; + }) + .then<Null>((_) { + throw "should never be reached"; + }) + .catchError((e, st) { + Expect.equals("other_error", e); + Expect.isNotNull(st); + Expect.isFalse(identical(trace, st)); + whenCompleteStackTrace = st; + // Test the rethrowing the same error keeps the stack trace. + throw e; + }) + .catchError((e, st) { + Expect.equals("other_error", e); + Expect.identical(whenCompleteStackTrace, st); + asyncEnd(); + }); completer.completeError("c-error", trace); }
diff --git a/tests/lib/async/stack_trace20_test.dart b/tests/lib/async/stack_trace20_test.dart index af29897..a063f51 100644 --- a/tests/lib/async/stack_trace20_test.dart +++ b/tests/lib/async/stack_trace20_test.dart
@@ -17,16 +17,24 @@ main() { StackTrace trace = captureStackTrace(); var controller; - controller = new StreamController(onListen: () { - controller.addError("error", trace); - controller.close(); - }); + controller = new StreamController( + onListen: () { + controller.addError("error", trace); + controller.close(); + }, + ); asyncStart(); - controller.stream.listen(null).asFuture().then((_) { - throw "should never be reached"; - }, onError: (e, st) { - Expect.equals("error", e); - Expect.identical(trace, st); - asyncEnd(); - }); + controller.stream + .listen(null) + .asFuture() + .then( + (_) { + throw "should never be reached"; + }, + onError: (e, st) { + Expect.equals("error", e); + Expect.identical(trace, st); + asyncEnd(); + }, + ); }
diff --git a/tests/lib/async/stack_trace21_test.dart b/tests/lib/async/stack_trace21_test.dart index 1eadd49..73b9e95 100644 --- a/tests/lib/async/stack_trace21_test.dart +++ b/tests/lib/async/stack_trace21_test.dart
@@ -17,17 +17,23 @@ main() { StackTrace trace = captureStackTrace(); var controller; - controller = new StreamController(onListen: () { - controller.addError("error", trace); - controller.close(); - }); + controller = new StreamController( + onListen: () { + controller.addError("error", trace); + controller.close(); + }, + ); asyncStart(); - controller.stream.listen((_) { - throw "should never be reached"; - }, onError: (e, st) { - Expect.equals("error", e); - Expect.identical(trace, st); - }, onDone: () { - asyncEnd(); - }); + controller.stream.listen( + (_) { + throw "should never be reached"; + }, + onError: (e, st) { + Expect.equals("error", e); + Expect.identical(trace, st); + }, + onDone: () { + asyncEnd(); + }, + ); }
diff --git a/tests/lib/async/stack_trace23_test.dart b/tests/lib/async/stack_trace23_test.dart index a0476e1..6e339f6 100644 --- a/tests/lib/async/stack_trace23_test.dart +++ b/tests/lib/async/stack_trace23_test.dart
@@ -18,13 +18,18 @@ StackTrace trace = captureStackTrace(); asyncStart(); var f = new Future.error(499, trace); - f.catchError((e) { - throw "unreachable"; - }, test: (e) { - Expect.equals(499, e); - return false; - }).catchError((e, st) { - Expect.identical(trace, st); - asyncEnd(); - }, test: (e) => e == 499); + f + .catchError( + (e) { + throw "unreachable"; + }, + test: (e) { + Expect.equals(499, e); + return false; + }, + ) + .catchError((e, st) { + Expect.identical(trace, st); + asyncEnd(); + }, test: (e) => e == 499); }
diff --git a/tests/lib/async/stack_trace24_test.dart b/tests/lib/async/stack_trace24_test.dart index 899c2f1..01ff557 100644 --- a/tests/lib/async/stack_trace24_test.dart +++ b/tests/lib/async/stack_trace24_test.dart
@@ -8,19 +8,27 @@ main() { var controller; - controller = new StreamController(onListen: () { - controller.add(499); - controller.close(); - }); + controller = new StreamController( + onListen: () { + controller.add(499); + controller.close(); + }, + ); asyncStart(); - controller.stream.map((e) { - throw "error"; - }).listen((_) { - throw "should never be reached"; - }, onError: (e, st) { - Expect.equals("error", e); - Expect.isNotNull(st); - }, onDone: () { - asyncEnd(); - }); + controller.stream + .map((e) { + throw "error"; + }) + .listen( + (_) { + throw "should never be reached"; + }, + onError: (e, st) { + Expect.equals("error", e); + Expect.isNotNull(st); + }, + onDone: () { + asyncEnd(); + }, + ); }
diff --git a/tests/lib/async/stack_trace25_test.dart b/tests/lib/async/stack_trace25_test.dart index 3390011..83c3a6c 100644 --- a/tests/lib/async/stack_trace25_test.dart +++ b/tests/lib/async/stack_trace25_test.dart
@@ -17,18 +17,23 @@ main() { StackTrace trace = captureStackTrace(); var controller; - controller = new StreamController(onListen: () { - controller.addError("error", trace); - controller.close(); - }); + controller = new StreamController( + onListen: () { + controller.addError("error", trace); + controller.close(); + }, + ); asyncStart(); var iterator = new StreamIterator(controller.stream); var future = iterator.moveNext(); - future.then<Null>((_) { - throw "unreachable"; - }, onError: (e, st) { - Expect.equals("error", e); - Expect.identical(trace, st); - asyncEnd(); - }); + future.then<Null>( + (_) { + throw "unreachable"; + }, + onError: (e, st) { + Expect.equals("error", e); + Expect.identical(trace, st); + asyncEnd(); + }, + ); }
diff --git a/tests/lib/async/stream_controller_async_test.dart b/tests/lib/async/stream_controller_async_test.dart index a0c7084..cc24012 100644 --- a/tests/lib/async/stream_controller_async_test.dart +++ b/tests/lib/async/stream_controller_async_test.dart
@@ -22,9 +22,13 @@ test("StreamController.fold", () { StreamController c = new StreamController(); Stream stream = c.stream.asBroadcastStream(onCancel: cancelSub); - stream.fold<dynamic>(0, (a, b) => a + b).then(expectAsync((int v) { - Expect.equals(42, v); - })); + stream + .fold<dynamic>(0, (a, b) => a + b) + .then( + expectAsync((int v) { + Expect.equals(42, v); + }), + ); c.add(10); c.add(32); c.close(); @@ -33,11 +37,15 @@ test("StreamController.fold throws", () { StreamController c = new StreamController(); Stream stream = c.stream.asBroadcastStream(onCancel: cancelSub); - Future<int?>.value(stream.fold(0, (a, b) { - throw "Fnyf!"; - })).catchError(expectAsync((error) { - Expect.equals("Fnyf!", error); - })); + Future<int?>.value( + stream.fold(0, (a, b) { + throw "Fnyf!"; + }), + ).catchError( + expectAsync((error) { + Expect.equals("Fnyf!", error); + }), + ); c.add(42); }); } @@ -46,9 +54,13 @@ test("Single-subscription StreamController.fold", () { StreamController c = new StreamController(); Stream stream = c.stream; - stream.fold<dynamic>(0, (a, b) => a + b).then(expectAsync((int v) { - Expect.equals(42, v); - })); + stream + .fold<dynamic>(0, (a, b) => a + b) + .then( + expectAsync((int v) { + Expect.equals(42, v); + }), + ); c.add(10); c.add(32); c.close(); @@ -57,16 +69,19 @@ test("Single-subscription StreamController.fold throws", () { StreamController c = new StreamController(); Stream stream = c.stream; - Future<int?>.value(stream.fold(0, (a, b) { - throw "Fnyf!"; - })).catchError(expectAsync((e) { - Expect.equals("Fnyf!", e); - })); + Future<int?>.value( + stream.fold(0, (a, b) { + throw "Fnyf!"; + }), + ).catchError( + expectAsync((e) { + Expect.equals("Fnyf!", e); + }), + ); c.add(42); }); - test( - "Single-subscription StreamController events are buffered when" + test("Single-subscription StreamController events are buffered when" " there is no subscriber", () { StreamController<int> c = new StreamController(); EventSink sink = c.sink; @@ -75,11 +90,14 @@ sink.add(1); sink.add(2); sink.close(); - stream.listen((data) { - counter += data; - }, onDone: expectAsync(() { - Expect.equals(3, counter); - })); + stream.listen( + (data) { + counter += data; + }, + onDone: expectAsync(() { + Expect.equals(3, counter); + }), + ); }); } @@ -95,10 +113,12 @@ StreamController c = new StreamController(); Events actualEvents = new Events(); Future f = c.stream.forEach(actualEvents.add); - f.then(expectAsync((_) { - actualEvents.close(); - Expect.listEquals(sentEvents.events, actualEvents.events); - })); + f.then( + expectAsync((_) { + actualEvents.close(); + Expect.listEquals(sentEvents.events, actualEvents.events); + }), + ); sentEvents.replay(c); }); @@ -111,10 +131,12 @@ StreamController c = new StreamController(); Events actualEvents = new Events(); Future f = c.stream.forEach(actualEvents.add); - f.catchError(expectAsync((error) { - Expect.equals("bad", error); - Expect.listEquals((new Events()..add(7)).events, actualEvents.events); - })); + f.catchError( + expectAsync((error) { + Expect.equals("bad", error); + Expect.listEquals((new Events()..add(7)).events, actualEvents.events); + }), + ); sentEvents.replay(c); }); @@ -130,19 +152,23 @@ if (x == 9) throw "bad"; actualEvents.add(x); }); - f.catchError(expectAsync((error) { - Expect.equals("bad", error); - Expect.listEquals((new Events()..add(7)).events, actualEvents.events); - })); + f.catchError( + expectAsync((error) { + Expect.equals("bad", error); + Expect.listEquals((new Events()..add(7)).events, actualEvents.events); + }), + ); sentEvents.replay(c); }); test("firstWhere", () { StreamController c = new StreamController(); Future f = c.stream.firstWhere((x) => (x % 3) == 0); - f.then(expectAsync((v) { - Expect.equals(9, v); - })); + f.then( + expectAsync((v) { + Expect.equals(9, v); + }), + ); sentEvents.replay(c); }); @@ -156,18 +182,22 @@ test("firstWhere 3", () { StreamController c = new StreamController(); Future f = c.stream.firstWhere((x) => (x % 4) == 0, orElse: () => 999); - f.then(expectAsync((v) { - Expect.equals(999, v); - })); + f.then( + expectAsync((v) { + Expect.equals(999, v); + }), + ); sentEvents.replay(c); }); test("lastWhere", () { StreamController c = new StreamController(); Future f = c.stream.lastWhere((x) => (x % 3) == 0); - f.then(expectAsync((v) { - Expect.equals(87, v); - })); + f.then( + expectAsync((v) { + Expect.equals(87, v); + }), + ); sentEvents.replay(c); }); @@ -181,45 +211,55 @@ test("lastWhere 3", () { StreamController c = new StreamController(); Future f = c.stream.lastWhere((x) => (x % 4) == 0, orElse: () => 999); - f.then(expectAsync((v) { - Expect.equals(999, v); - })); + f.then( + expectAsync((v) { + Expect.equals(999, v); + }), + ); sentEvents.replay(c); }); test("singleWhere", () { StreamController c = new StreamController(); Future f = c.stream.singleWhere((x) => (x % 9) == 0); - f.then(expectAsync((v) { - Expect.equals(9, v); - })); + f.then( + expectAsync((v) { + Expect.equals(9, v); + }), + ); sentEvents.replay(c); }); test("singleWhere 2", () { StreamController c = new StreamController(); Future f = c.stream.singleWhere((x) => (x % 3) == 0); // Matches 9 and 87.. - f.catchError(expectAsync((error) { - Expect.isTrue(error is StateError); - })); + f.catchError( + expectAsync((error) { + Expect.isTrue(error is StateError); + }), + ); sentEvents.replay(c); }); test("first", () { StreamController c = new StreamController(); Future f = c.stream.first; - f.then(expectAsync((v) { - Expect.equals(7, v); - })); + f.then( + expectAsync((v) { + Expect.equals(7, v); + }), + ); sentEvents.replay(c); }); test("first empty", () { StreamController c = new StreamController(); Future f = c.stream.first; - f.catchError(expectAsync((error) { - Expect.isTrue(error is StateError); - })); + f.catchError( + expectAsync((error) { + Expect.isTrue(error is StateError); + }), + ); Events emptyEvents = new Events()..close(); emptyEvents.replay(c); }); @@ -227,9 +267,11 @@ test("first error", () { StreamController c = new StreamController(); Future f = c.stream.first; - f.catchError(expectAsync((error) { - Expect.equals("error", error); - })); + f.catchError( + expectAsync((error) { + Expect.equals("error", error); + }), + ); Events errorEvents = new Events() ..error("error") ..close(); @@ -239,9 +281,11 @@ test("first error 2", () { StreamController c = new StreamController(); Future f = c.stream.first; - f.catchError(expectAsync((error) { - Expect.equals("error", error); - })); + f.catchError( + expectAsync((error) { + Expect.equals("error", error); + }), + ); Events errorEvents = new Events() ..error("error") ..error("error2") @@ -252,18 +296,22 @@ test("last", () { StreamController c = new StreamController(); Future f = c.stream.last; - f.then(expectAsync((v) { - Expect.equals(87, v); - })); + f.then( + expectAsync((v) { + Expect.equals(87, v); + }), + ); sentEvents.replay(c); }); test("last empty", () { StreamController c = new StreamController(); Future f = c.stream.last; - f.catchError(expectAsync((error) { - Expect.isTrue(error is StateError); - })); + f.catchError( + expectAsync((error) { + Expect.isTrue(error is StateError); + }), + ); Events emptyEvents = new Events()..close(); emptyEvents.replay(c); }); @@ -271,9 +319,11 @@ test("last error", () { StreamController c = new StreamController(); Future f = c.stream.last; - f.catchError(expectAsync((error) { - Expect.equals("error", error); - })); + f.catchError( + expectAsync((error) { + Expect.equals("error", error); + }), + ); Events errorEvents = new Events() ..error("error") ..close(); @@ -283,9 +333,11 @@ test("last error 2", () { StreamController c = new StreamController(); Future f = c.stream.last; - f.catchError(expectAsync((error) { - Expect.equals("error", error); - })); + f.catchError( + expectAsync((error) { + Expect.equals("error", error); + }), + ); Events errorEvents = new Events() ..error("error") ..error("error2") @@ -296,36 +348,44 @@ test("elementAt", () { StreamController c = new StreamController(); Future f = c.stream.elementAt(2); - f.then(expectAsync((v) { - Expect.equals(13, v); - })); + f.then( + expectAsync((v) { + Expect.equals(13, v); + }), + ); sentEvents.replay(c); }); test("elementAt 2", () { StreamController c = new StreamController(); Future f = c.stream.elementAt(20); - f.catchError(expectAsync((error) { - Expect.isTrue(error is RangeError); - })); + f.catchError( + expectAsync((error) { + Expect.isTrue(error is RangeError); + }), + ); sentEvents.replay(c); }); test("drain", () { StreamController c = new StreamController(); Future f = c.stream.drain(); - f.then(expectAsync((v) { - Expect.equals(null, v); - })); + f.then( + expectAsync((v) { + Expect.equals(null, v); + }), + ); sentEvents.replay(c); }); test("drain error", () { StreamController c = new StreamController(); Future f = c.stream.drain(); - f.catchError(expectAsync((error) { - Expect.equals("error", error); - })); + f.catchError( + expectAsync((error) { + Expect.equals("error", error); + }), + ); Events errorEvents = new Events() ..error("error") ..error("error2") @@ -446,11 +506,14 @@ Stream s = streamValueTransform(c.stream, (v) { throw error; }); - s.listen((_) { - Expect.fail("unexpected value"); - }, onError: expectAsync((e) { - Expect.identical(error, e); - })); + s.listen( + (_) { + Expect.fail("unexpected value"); + }, + onError: expectAsync((e) { + Expect.identical(error, e); + }), + ); c.add(null); c.close(); }); @@ -462,11 +525,14 @@ Stream s = streamErrorTransform(c.stream, (e) { throw error; }); - s.listen((_) { - Expect.fail("unexpected value"); - }, onError: expectAsync((e) { - Expect.identical(error, e); - })); + s.listen( + (_) { + Expect.fail("unexpected value"); + }, + onError: expectAsync((e) { + Expect.identical(error, e); + }), + ); c.addError("SOME ERROR"); c.close(); }); @@ -478,11 +544,14 @@ Future f = streamValueTransform(c.stream, (v) { throw error; }); - f.then((v) { - Expect.fail("unreachable"); - }, onError: expectAsync((e) { - Expect.identical(error, e); - })); + f.then( + (v) { + Expect.fail("unreachable"); + }, + onError: expectAsync((e) { + Expect.identical(error, e); + }), + ); // Need two values to trigger compare for reduce. c.add(0); c.add(1); @@ -669,8 +738,11 @@ }); } -void testSink( - {required bool sync, required bool broadcast, required bool asBroadcast}) { +void testSink({ + required bool sync, + required bool broadcast, + required bool asBroadcast, +}) { String type = "${sync ? "S" : "A"}${broadcast ? "B" : "S"}${asBroadcast ? "aB" : ""}"; test("$type-controller-sink", () { @@ -689,17 +761,21 @@ ..add(43) ..close(); var actual = new Events.capture( - asBroadcast ? c.stream.asBroadcastStream() : c.stream); + asBroadcast ? c.stream.asBroadcastStream() : c.stream, + ); var sink = c.sink; sink.add(42); sink.addError("error"); - sink.addStream(new Stream.fromIterable([1, 2, 3, 4, 5])).then((_) { - sink.add(43); - return sink.close(); - }).then((_) { - Expect.listEquals(expected.events, actual.events); - done(); - }); + sink + .addStream(new Stream.fromIterable([1, 2, 3, 4, 5])) + .then((_) { + sink.add(43); + return sink.close(); + }) + .then((_) { + Expect.listEquals(expected.events, actual.events); + done(); + }); }); test("$type-controller-sink-canceled", () { @@ -724,19 +800,22 @@ var sink = c.sink; sink.add(42); sink.addError("error"); - sink.addStream(new Stream.fromIterable([1, 2, 3, 4, 5])).then((_) { - Expect.listEquals(expected.events, actual.events); - // Close controller as well. It has no listener. If it is a broadcast - // stream, it will still be open, and we read the "done" future before - // closing. A normal stream is already done when its listener cancels. - Future doneFuture = sink.done; - sink.close(); - return doneFuture; - }).then((_) { - // No change in events. - Expect.listEquals(expected.events, actual.events); - done(); - }); + sink + .addStream(new Stream.fromIterable([1, 2, 3, 4, 5])) + .then((_) { + Expect.listEquals(expected.events, actual.events); + // Close controller as well. It has no listener. If it is a broadcast + // stream, it will still be open, and we read the "done" future before + // closing. A normal stream is already done when its listener cancels. + Future doneFuture = sink.done; + sink.close(); + return doneFuture; + }) + .then((_) { + // No change in events. + Expect.listEquals(expected.events, actual.events); + done(); + }); }); test("$type-controller-sink-paused", () { @@ -758,36 +837,45 @@ var actual = new Events(); var sub; var pauseIsDone = false; - sub = stream.listen((v) { - if (v == 3) { - sub.pause(new Future.delayed(const Duration(milliseconds: 15), () { - pauseIsDone = true; - })); - } - actual.add(v); - }, onError: actual.error, onDone: actual.close); + sub = stream.listen( + (v) { + if (v == 3) { + sub.pause( + new Future.delayed(const Duration(milliseconds: 15), () { + pauseIsDone = true; + }), + ); + } + actual.add(v); + }, + onError: actual.error, + onDone: actual.close, + ); var sink = c.sink; sink.add(42); sink.addError("error"); - sink.addStream(new Stream.fromIterable([1, 2, 3, 4, 5])).then((_) { - sink.add(43); - return sink.close(); - }).then((_) { - if (asBroadcast || broadcast) { - // The done-future of the sink completes when it passes - // the done event to the asBroadcastStream controller, which is - // before the final listener gets the event. - // Wait for the done event to be *delivered* before testing the - // events. - actual.onDone(() { - Expect.listEquals(expected.events, actual.events); - done(); + sink + .addStream(new Stream.fromIterable([1, 2, 3, 4, 5])) + .then((_) { + sink.add(43); + return sink.close(); + }) + .then((_) { + if (asBroadcast || broadcast) { + // The done-future of the sink completes when it passes + // the done event to the asBroadcastStream controller, which is + // before the final listener gets the event. + // Wait for the done event to be *delivered* before testing the + // events. + actual.onDone(() { + Expect.listEquals(expected.events, actual.events); + done(); + }); + } else { + Expect.listEquals(expected.events, actual.events); + done(); + } }); - } else { - Expect.listEquals(expected.events, actual.events); - done(); - } - }); }); test("$type-controller-addstream-error-stop", () { @@ -864,10 +952,20 @@ var actual = new Events.capture(stream); // Streams of five events, throws on 3. - Stream s1 = new Stream.fromIterable([1, 2, 3, 4, 5]) - .map((x) => (x == 3 ? throw x : x)); - Stream s2 = new Stream.fromIterable([1, 2, 3, 4, 5]) - .map((x) => (x == 3 ? throw x : x)); + Stream s1 = new Stream.fromIterable([ + 1, + 2, + 3, + 4, + 5, + ]).map((x) => (x == 3 ? throw x : x)); + Stream s2 = new Stream.fromIterable([ + 1, + 2, + 3, + 4, + 5, + ]).map((x) => (x == 3 ? throw x : x)); Events expected = new Events(); expected
diff --git a/tests/lib/async/stream_controller_test.dart b/tests/lib/async/stream_controller_test.dart index 1681c4c..4cac3db 100644 --- a/tests/lib/async/stream_controller_test.dart +++ b/tests/lib/async/stream_controller_test.dart
@@ -38,8 +38,10 @@ var expectedEvents = new Events() ..add(42) ..error("error"); - var actualEvents = - new Events.capture(c.stream.asBroadcastStream(), cancelOnError: true); + var actualEvents = new Events.capture( + c.stream.asBroadcastStream(), + cancelOnError: true, + ); Events sentEvents = new Events() ..add(42) ..error("error") @@ -55,8 +57,10 @@ ..add(42) ..error("error") ..add(37); - dynamic actualEvents = - new Events.capture(c.stream.asBroadcastStream(), cancelOnError: false); + dynamic actualEvents = new Events.capture( + c.stream.asBroadcastStream(), + cancelOnError: false, + ); expectedEvents.replay(c); actualEvents.subscription.cancel(); c.add("Are you there"); // Not sent to actualEvents. @@ -76,7 +80,8 @@ ..add("another string") ..close(); var actualEvents = new Events.capture( - c.stream.asBroadcastStream().where((v) => v is String)); + c.stream.asBroadcastStream().where((v) => v is String), + ); sentEvents.replay(c); Expect.listEquals(expectedEvents.events, actualEvents.events); } @@ -92,8 +97,9 @@ ..add("ab") ..error("error") ..close(); - var actualEvents = - new Events.capture(c.stream.asBroadcastStream().map((v) => "$v$v")); + var actualEvents = new Events.capture( + c.stream.asBroadcastStream().map((v) => "$v$v"), + ); sentEvents.replay(c); Expect.listEquals(expectedEvents.events, actualEvents.events); } @@ -110,13 +116,14 @@ ..add("ab") ..close(); var actualEvents = new Events.capture( - c.stream.asBroadcastStream().handleError((error) { - if (error is String) { - // TODO(floitsch): this test originally changed the stacktrace. - throw "[${error}]"; - } - }), - cancelOnError: true); + c.stream.asBroadcastStream().handleError((error) { + if (error is String) { + // TODO(floitsch): this test originally changed the stacktrace. + throw "[${error}]"; + } + }), + cancelOnError: true, + ); sentEvents.replay(c); Expect.listEquals(expectedEvents.events, actualEvents.events); } @@ -142,12 +149,13 @@ ..add(3) ..add(4) ..close(); - var actualEvents = - new Events.capture(c.stream.asBroadcastStream().expand((v) { - var l = []; - for (int i = 0; i < v; i++) l.add(i + 1); - return l; - })); + var actualEvents = new Events.capture( + c.stream.asBroadcastStream().expand((v) { + var l = []; + for (int i = 0; i < v; i++) l.add(i + 1); + return l; + }), + ); sentEvents.replay(c); Expect.listEquals(expectedEvents.events, actualEvents.events); } @@ -166,16 +174,22 @@ ..error("b") ..add("foo") ..close(); - var actualEvents = new Events.capture(c.stream - .asBroadcastStream() - .transform(new StreamTransformer.fromHandlers(handleData: (v, s) { - s.addError(v); - }, handleError: (e, st, s) { - s.add(e); - }, handleDone: (s) { - s.add("foo"); - s.close(); - }))); + var actualEvents = new Events.capture( + c.stream.asBroadcastStream().transform( + new StreamTransformer.fromHandlers( + handleData: (v, s) { + s.addError(v); + }, + handleError: (e, st, s) { + s.add(e); + }, + handleDone: (s) { + s.add("foo"); + s.close(); + }, + ), + ), + ); sentEvents.replay(c); Expect.listEquals(expectedEvents.events, actualEvents.events); } @@ -194,14 +208,16 @@ ..add(42) ..error("not FormatException"); var actualEvents = new Events.capture( - c.stream - .asBroadcastStream() - .where((v) => v is String) - .map((v) => int.parse(v)) - .handleError((error) { - if (error is! FormatException) throw error; - }).where((v) => v > 10), - cancelOnError: true); + c.stream + .asBroadcastStream() + .where((v) => v is String) + .map((v) => int.parse(v)) + .handleError((error) { + if (error is! FormatException) throw error; + }) + .where((v) => v > 10), + cancelOnError: true, + ); sentEvents.replay(c); Expect.listEquals(expectedEvents.events, actualEvents.events); } @@ -322,12 +338,15 @@ ..error("foo") ..add("ab") ..close(); - var actualEvents = new Events.capture(c.stream.handleError((error) { - if (error is String) { - // TODO(floitsch): this error originally changed the stack trace. - throw "[${error}]"; - } - }), cancelOnError: true); + var actualEvents = new Events.capture( + c.stream.handleError((error) { + if (error is String) { + // TODO(floitsch): this error originally changed the stack trace. + throw "[${error}]"; + } + }), + cancelOnError: true, + ); sentEvents.replay(c); Expect.listEquals(expectedEvents.events, actualEvents.events); } @@ -353,11 +372,13 @@ ..add(3) ..add(4) ..close(); - var actualEvents = new Events.capture(c.stream.expand((v) { - var l = []; - for (int i = 0; i < v; i++) l.add(i + 1); - return l; - })); + var actualEvents = new Events.capture( + c.stream.expand((v) { + var l = []; + for (int i = 0; i < v; i++) l.add(i + 1); + return l; + }), + ); sentEvents.replay(c); Expect.listEquals(expectedEvents.events, actualEvents.events); } @@ -402,11 +423,13 @@ ..add("b") ..close(); Future<bool> contains = c.stream.contains("b"); - contains.then((var c) { - Expect.fail("no value expected"); - }).catchError((error) { - Expect.equals("FAIL", error); - }); + contains + .then((var c) { + Expect.fail("no value expected"); + }) + .catchError((error) { + Expect.equals("FAIL", error); + }); sentEvents.replay(c); } @@ -424,15 +447,22 @@ ..error("b") ..add("foo") ..close(); - var actualEvents = new Events.capture(c.stream - .transform(new StreamTransformer.fromHandlers(handleData: (v, s) { - s.addError(v); - }, handleError: (e, st, s) { - s.add(e); - }, handleDone: (s) { - s.add("foo"); - s.close(); - }))); + var actualEvents = new Events.capture( + c.stream.transform( + new StreamTransformer.fromHandlers( + handleData: (v, s) { + s.addError(v); + }, + handleError: (e, st, s) { + s.add(e); + }, + handleDone: (s) { + s.add("foo"); + s.close(); + }, + ), + ), + ); sentEvents.replay(c); Expect.listEquals(expectedEvents.events, actualEvents.events); } @@ -451,13 +481,15 @@ ..add(42) ..error("not FormatException"); var actualEvents = new Events.capture( - c.stream - .where((v) => v is String) - .map((v) => int.parse(v)) - .handleError((error) { - if (error is! FormatException) throw error; - }).where((v) => v > 10), - cancelOnError: true); + c.stream + .where((v) => v is String) + .map((v) => int.parse(v)) + .handleError((error) { + if (error is! FormatException) throw error; + }) + .where((v) => v > 10), + cancelOnError: true, + ); sentEvents.replay(c); Expect.listEquals(expectedEvents.events, actualEvents.events); } @@ -623,10 +655,13 @@ }); // Only listen after a while. new Timer(MS * 250, () { - c.stream.listen(null, onDone: () { - asyncEnd(); - doneSeen = true; - }); + c.stream.listen( + null, + onDone: () { + asyncEnd(); + doneSeen = true; + }, + ); }); } @@ -645,10 +680,13 @@ }); // Only listen after a while. new Timer(MS * 250, () { - c.stream.listen(null, onDone: () { - doneSeen = true; - asyncEnd(); - }); + c.stream.listen( + null, + onDone: () { + doneSeen = true; + asyncEnd(); + }, + ); }); } @@ -692,10 +730,12 @@ asyncStart(); asyncStart(); asyncStart(); - StreamController c = new StreamController(onCancel: () { - asyncEnd(); - throw "ERROR"; - }); + StreamController c = new StreamController( + onCancel: () { + asyncEnd(); + throw "ERROR"; + }, + ); c.add(1); c.add(2); c.add(3); @@ -719,10 +759,12 @@ asyncStart(); asyncStart(); asyncStart(); - StreamController c2 = new StreamController(onCancel: () { - asyncEnd(); - throw "ERROR"; - }); + StreamController c2 = new StreamController( + onCancel: () { + asyncEnd(); + throw "ERROR"; + }, + ); c2.add(1); c2.add(2); Future done2 = c2.close(); @@ -752,19 +794,23 @@ asyncStart(); asyncStart(); asyncStart(); - StreamController c2 = new StreamController(onCancel: () { - asyncEnd(); - throw "ERROR2"; - }); + StreamController c2 = new StreamController( + onCancel: () { + asyncEnd(); + throw "ERROR2"; + }, + ); c2.add(1); c2.add(2); var done2 = c2.close(); done2.catchError(fail).whenComplete(asyncEnd); // Should not get error; - StreamController c = new StreamController(onCancel: () { - asyncEnd(); - throw "ERROR1"; - }); + StreamController c = new StreamController( + onCancel: () { + asyncEnd(); + throw "ERROR1"; + }, + ); var sub; sub = c.stream.listen((v) { Expect.equals(1, v); @@ -796,9 +842,12 @@ var f = c.close(); f.then((_) { // Listening after close is allowed. The listener gets a done event. - var sub = c.stream.listen(null, onDone: () { - Expect.fail("wrong done"); - }); + var sub = c.stream.listen( + null, + onDone: () { + Expect.fail("wrong done"); + }, + ); sub.pause(); sub.pause(); new Timer(MS * 100, () { @@ -836,9 +885,12 @@ var f = c.close(); f.then((_) { // Listening after close is allowed. The listener gets a done event. - var sub = s.listen(null, onDone: () { - Expect.fail("wrong done"); - }); + var sub = s.listen( + null, + onDone: () { + Expect.fail("wrong done"); + }, + ); sub.pause(); sub.pause(); new Timer(MS * 100, () { @@ -879,37 +931,40 @@ for (int i = 0; i < listenerCount; i++) { asyncStart(); asyncStart(); - c.stream.listen((v) { - Expect.equals(42, v); - Expect.throws(() { - c.add(37); - }); - Expect.throws(() { - c.addError(37); - }); - Expect.throws(() { - c.addStream(emptyStream); - }); - Expect.throws(() { - c.close(); - }); - asyncEnd(); - }, onError: (e, s) { - Expect.equals(87, e); - Expect.throws(() { - c.add(37); - }); - Expect.throws(() { - c.addError(37); - }); - Expect.throws(() { - c.addStream(emptyStream); - }); - Expect.throws(() { - c.close(); - }); - asyncEnd(); - }); + c.stream.listen( + (v) { + Expect.equals(42, v); + Expect.throws(() { + c.add(37); + }); + Expect.throws(() { + c.addError(37); + }); + Expect.throws(() { + c.addStream(emptyStream); + }); + Expect.throws(() { + c.close(); + }); + asyncEnd(); + }, + onError: (e, s) { + Expect.equals(87, e); + Expect.throws(() { + c.add(37); + }); + Expect.throws(() { + c.addError(37); + }); + Expect.throws(() { + c.addStream(emptyStream); + }); + Expect.throws(() { + c.close(); + }); + asyncEnd(); + }, + ); } c.add(42); c.addError(87); @@ -1004,10 +1059,11 @@ void testSettingNullCallbacks() { failCallback() => fail("Callback should not be called"); var controller = new StreamController( - onListen: failCallback, - onPause: failCallback, - onResume: failCallback, - onCancel: failCallback); + onListen: failCallback, + onPause: failCallback, + onResume: failCallback, + onCancel: failCallback, + ); var stream = controller.stream; @@ -1095,7 +1151,9 @@ void testBroadcastSettingNullCallbacks() { failCallback() => fail("Callback should not be called"); var controller = new StreamController.broadcast( - onListen: failCallback, onCancel: failCallback); + onListen: failCallback, + onCancel: failCallback, + ); var stream = controller.stream;
diff --git a/tests/lib/async/stream_distinct_test.dart b/tests/lib/async/stream_distinct_test.dart index 5287fd7..f43b79f 100644 --- a/tests/lib/async/stream_distinct_test.dart +++ b/tests/lib/async/stream_distinct_test.dart
@@ -21,7 +21,10 @@ checkStream(mkSingleStream, eq, "single"); checkBroadcastStream(mkBroadcastStream, eq, "broadcast"); checkBroadcastStream( - () => mkSingleStream().asBroadcastStream(), eq, "asBroadcast"); + () => mkSingleStream().asBroadcastStream(), + eq, + "asBroadcast", + ); } // Regression test. Multiple listens on the same broadcast distinct stream. @@ -31,54 +34,67 @@ // Doesn't ignore equality. expectStream( - new Stream.fromIterable([1, 2, 1, 3, 3]).distinct((a, b) => false), - [1, 2, 1, 3, 3], - "kFalse"); + new Stream.fromIterable([1, 2, 1, 3, 3]).distinct((a, b) => false), + [1, 2, 1, 3, 3], + "kFalse", + ); expectStream( - new Stream.fromIterable([1, 2, 1, 3, 3]).distinct((a, b) => true), - [1], - "kTrue"); + new Stream.fromIterable([1, 2, 1, 3, 3]).distinct((a, b) => true), + [1], + "kTrue", + ); expectStream( - new Stream.fromIterable([1, 2, 1, 3, 3]).distinct((a, b) => a != b), - [1, 1], - "neq"); + new Stream.fromIterable([1, 2, 1, 3, 3]).distinct((a, b) => a != b), + [1, 1], + "neq", + ); expectStream( - new Stream.fromIterable([1, 2, 1, 3, 3]).distinct((a, b) => 2 == b), - [1, 1, 3, 3], - "is2"); + new Stream.fromIterable([1, 2, 1, 3, 3]).distinct((a, b) => 2 == b), + [1, 1, 3, 3], + "is2", + ); // Forwards errors as errors. expectStream( - new Stream.fromIterable([1, "E1", 2, "E2", 2, 3]) - .map((v) => (v is String) ? (throw v) : v) // Make strings errors. - .distinct() - .transform(reifyErrors), - [1, "[E1]", 2, "[E2]", 3], - "errors"); + new Stream.fromIterable([1, "E1", 2, "E2", 2, 3]) + .map((v) => (v is String) ? (throw v) : v) // Make strings errors. + .distinct() + .transform(reifyErrors), + [1, "[E1]", 2, "[E2]", 3], + "errors", + ); // Equality throwing acts like error. expectStream( - new Stream.fromIterable([1, "E1", 1, 2, "E2", 3]) - .distinct((a, b) => (b is String) ? (throw b) : (a == b)) - .transform(reifyErrors), - [1, "[E1]", 2, "[E2]", 3], - "eq-throws"); + new Stream.fromIterable([1, "E1", 1, 2, "E2", 3]) + .distinct((a, b) => (b is String) ? (throw b) : (a == b)) + .transform(reifyErrors), + [1, "[E1]", 2, "[E2]", 3], + "eq-throws", + ); // Operator== throwing acts like error. expectStream( - new Stream.fromIterable([1, 1, 2, 2, 1, 3]) - .map((v) => new T(v)) - .distinct() - .transform(reifyErrors.cast<T, dynamic>()) - .map((v) => v is T ? v.value : "$v"), - [1, "[2]", "[2]", 3], - "==-throws"); + new Stream.fromIterable([1, 1, 2, 2, 1, 3]) + .map((v) => new T(v)) + .distinct() + .transform(reifyErrors.cast<T, dynamic>()) + .map((v) => v is T ? v.value : "$v"), + [1, "[2]", "[2]", 3], + "==-throws", + ); asyncEnd(); } checkStream(mkStream, eq, name) { expectStream(mkStream().distinct(eq), [1, 2, 3, 2], "$name.distinct"); - expectStream(mkStream().expand((e) => [e, e]).distinct(eq), [1, 2, 3, 2], - "$name.expand.distinct"); - expectStream(mkStream().where((x) => x != 3).distinct(eq), [1, 2], - "$name.where.distinct"); + expectStream(mkStream().expand((e) => [e, e]).distinct(eq), [ + 1, + 2, + 3, + 2, + ], "$name.expand.distinct"); + expectStream(mkStream().where((x) => x != 3).distinct(eq), [ + 1, + 2, + ], "$name.where.distinct"); } checkBroadcastStream(mkStream, eq, name) { @@ -121,6 +137,8 @@ } StreamTransformer<Object, dynamic> reifyErrors = - new StreamTransformer.fromHandlers(handleError: (e, s, sink) { - sink.add("[$e]"); -}); + new StreamTransformer.fromHandlers( + handleError: (e, s, sink) { + sink.add("[$e]"); + }, + );
diff --git a/tests/lib/async/stream_empty_test.dart b/tests/lib/async/stream_empty_test.dart index d1bb710..5971257 100644 --- a/tests/lib/async/stream_empty_test.dart +++ b/tests/lib/async/stream_empty_test.dart
@@ -13,17 +13,22 @@ // Can be called with optional boolean to say whether broadcast or not. await asyncTest(() => emptyTest(const Stream<int>.empty(), true)); await asyncTest( - () => emptyTest(const Stream<int>.empty(broadcast: true), true)); + () => emptyTest(const Stream<int>.empty(broadcast: true), true), + ); await asyncTest( - () => emptyTest(const Stream<int>.empty(broadcast: false), false)); + () => emptyTest(const Stream<int>.empty(broadcast: false), false), + ); // Check that the behavior is consistent with other empty multi-subscription // streams. await asyncTest(() => emptyTest(Stream<int>.fromIterable(<int>[]), false)); - await asyncTest(() => - emptyTest((StreamController<int>.broadcast()..close()).stream, true)); await asyncTest( - () => emptyTest(Stream<int>.multi((c) => c.close()), false)); + () => + emptyTest((StreamController<int>.broadcast()..close()).stream, true), + ); + await asyncTest( + () => emptyTest(Stream<int>.multi((c) => c.close()), false), + ); }); await flushMicrotasks(); } @@ -50,8 +55,11 @@ // Has the expected `isBroadcast`. Expect.equals(broadcast, s.isBroadcast); - StreamSubscription<int> sub = - s.listen(unreachable, onError: unreachable, onDone: checker.check); + StreamSubscription<int> sub = s.listen( + unreachable, + onError: unreachable, + onDone: checker.check, + ); // Type parameter of subscription respects stream. // Not a `StreamSubscription<Never>`. Expect.isFalse(sub is StreamSubscription<String>); @@ -66,8 +74,11 @@ // Can listen more than once, whether broadcast stream or not. checker = Checker(); - StreamSubscription<int> sub2 = - s.listen(unreachable, onError: unreachable, onDone: checker.check); + StreamSubscription<int> sub2 = s.listen( + unreachable, + onError: unreachable, + onDone: checker.check, + ); // Respects pauses. sub2.pause(); Expect.isTrue(sub2.isPaused); @@ -141,15 +152,19 @@ } zone = Zone.current.fork( - specification: ZoneSpecification(registerCallback: <R>(s, p, z, f) { - if (f == callback1) log.add("reg1"); - if (f == callback2) log.add("reg2"); - return p.registerCallback<R>(z, f); - }, run: <R>(s, p, z, f) { - if (f == callback1) log.add("run1"); - if (f == callback2) log.add("run2"); - return p.run<R>(z, f); - })); + specification: ZoneSpecification( + registerCallback: <R>(s, p, z, f) { + if (f == callback1) log.add("reg1"); + if (f == callback2) log.add("reg2"); + return p.registerCallback<R>(z, f); + }, + run: <R>(s, p, z, f) { + if (f == callback1) log.add("run1"); + if (f == callback2) log.add("run2"); + return p.run<R>(z, f); + }, + ), + ); await zone.run(() async { var s = Stream<int>.empty();
diff --git a/tests/lib/async/stream_error_test.dart b/tests/lib/async/stream_error_test.dart index 28f7e82..6ed0ae8 100644 --- a/tests/lib/async/stream_error_test.dart +++ b/tests/lib/async/stream_error_test.dart
@@ -54,16 +54,20 @@ var stream = Stream<int>.error(error, stack); int errorCount = 0; var onDone = Completer(); - var sub = stream.listen((v) { - Expect.fail("Value event"); - }, onError: (e, s) { - Expect.identical(error, e); - Expect.identical(stack, s); - errorCount++; - }, onDone: () { - Expect.equals(1, errorCount); - onDone.complete(); - }); + var sub = stream.listen( + (v) { + Expect.fail("Value event"); + }, + onError: (e, s) { + Expect.identical(error, e); + Expect.identical(stack, s); + errorCount++; + }, + onDone: () { + Expect.equals(1, errorCount); + onDone.complete(); + }, + ); sub.pause(); await Future.delayed(Duration(milliseconds: 10)); Expect.equals(0, errorCount);
diff --git a/tests/lib/async/stream_event_transformed_test.dart b/tests/lib/async/stream_event_transformed_test.dart index a39a224..f1873d6 100644 --- a/tests/lib/async/stream_event_transformed_test.dart +++ b/tests/lib/async/stream_event_transformed_test.dart
@@ -108,13 +108,14 @@ // similar to a map. asyncStart(); new Stream.fromIterable([1, 2, 3]) - .transform(new SinkTransformer( - (sink) => new DecrementingTransformerSink(sink))) + .transform( + new SinkTransformer((sink) => new DecrementingTransformerSink(sink)), + ) .toList() .then((list) { - Expect.listEquals([0, 1, 2], list); - asyncEnd(); - }); + Expect.listEquals([0, 1, 2], list); + asyncEnd(); + }); } { @@ -124,23 +125,30 @@ var controller; var events = []; var stackTrace = currentStackTrace; - controller = new StreamController(onListen: () { - controller.add(499); - controller.addError(42, stackTrace); - controller.close(); - }); + controller = new StreamController( + onListen: () { + controller.add(499); + controller.addError(42, stackTrace); + controller.close(); + }, + ); controller.stream - .transform(new SinkTransformer( - (sink) => new DecrementingTransformerSink(sink))) - .listen((data) { - events.add(data); - }, onError: (e, st) { - events.add(e); - events.add(st); - }, onDone: () { - Expect.listEquals([498, 41, stackTrace], events); - asyncEnd(); - }); + .transform( + new SinkTransformer((sink) => new DecrementingTransformerSink(sink)), + ) + .listen( + (data) { + events.add(data); + }, + onError: (e, st) { + events.add(e); + events.add(st); + }, + onDone: () { + Expect.listEquals([498, 41, stackTrace], events); + asyncEnd(); + }, + ); } { @@ -153,24 +161,39 @@ var completer2 = new Completer(); var completer3 = new Completer(); var closeCompleter = new Completer(); - controller = new StreamController(onListen: () { - controller.add(completer1.future); - controller.addError(completer2.future, stackTrace); - controller.add(completer3.future); - controller.close(); - }); + controller = new StreamController( + onListen: () { + controller.add(completer1.future); + controller.addError(completer2.future, stackTrace); + controller.add(completer3.future); + controller.close(); + }, + ); controller.stream - .transform(new SinkTransformer((sink) => - new FutureWaitingTransformerSink(sink, closeCompleter.future))) - .listen((data) { - events.add(data); - }, onError: (e, st) { - events.add(e); - events.add(st); - }, onDone: () { - Expect.listEquals(["error2", stackTrace, "future3", "future1"], events); - asyncEnd(); - }); + .transform( + new SinkTransformer( + (sink) => + new FutureWaitingTransformerSink(sink, closeCompleter.future), + ), + ) + .listen( + (data) { + events.add(data); + }, + onError: (e, st) { + events.add(e); + events.add(st); + }, + onDone: () { + Expect.listEquals([ + "error2", + stackTrace, + "future3", + "future1", + ], events); + asyncEnd(); + }, + ); Timer.run(() { completer2.complete("error2"); Timer.run(() { @@ -194,12 +217,14 @@ var completer2 = new Completer.sync(); var completer3 = new Completer.sync(); var closeCompleter = new Completer(); - controller = new StreamController(onListen: () { - controller.add(completer1.future); - controller.addError(completer2.future, stackTrace); - controller.add(completer3.future); - controller.close(); - }); + controller = new StreamController( + onListen: () { + controller.add(completer1.future); + controller.addError(completer2.future, stackTrace); + controller.add(completer3.future); + controller.close(); + }, + ); var subscription; completer1.future.then((_) { Expect.isTrue(subscription.isPaused); @@ -211,18 +236,31 @@ Expect.isTrue(subscription.isPaused); }); subscription = controller.stream - .transform(new SinkTransformer((sink) => - new FutureWaitingTransformerSink(sink, closeCompleter.future))) - .listen((data) { - Expect.isFalse(subscription.isPaused); - events.add(data); - }, onError: (e, st) { - events.add(e); - events.add(st); - }, onDone: () { - Expect.listEquals(["error2", stackTrace, "future3", "future1"], events); - asyncEnd(); - }); + .transform( + new SinkTransformer( + (sink) => + new FutureWaitingTransformerSink(sink, closeCompleter.future), + ), + ) + .listen( + (data) { + Expect.isFalse(subscription.isPaused); + events.add(data); + }, + onError: (e, st) { + events.add(e); + events.add(st); + }, + onDone: () { + Expect.listEquals([ + "error2", + stackTrace, + "future3", + "future1", + ], events); + asyncEnd(); + }, + ); Timer.run(() { subscription.pause(); completer2.complete("error2"); @@ -258,32 +296,47 @@ var completer2 = new Completer(); var completer3 = new Completer(); var closeCompleter = new Completer(); - controller = new StreamController(onListen: () { - controller.add(completer1.future); - controller.addError(completer2.future, stackTrace); - controller.add(completer3.future); - controller.close(); - }); + controller = new StreamController( + onListen: () { + controller.add(completer1.future); + controller.addError(completer2.future, stackTrace); + controller.add(completer3.future); + controller.close(); + }, + ); bool streamIsDone = false; int errorCount = 0; - runZonedGuarded(() { - controller.stream - .transform(new SinkTransformer((sink) => - new FutureWaitingTransformerSink(sink, closeCompleter.future))) - .listen((data) { - events.add(data); - }, onError: (e, st) { - events.add(e); - events.add(st); - }, onDone: () { - Expect.listEquals([], events); - streamIsDone = true; - }); - }, (e, s) { - Expect.isTrue(e is StateError); - errorCount++; - }); + runZonedGuarded( + () { + controller.stream + .transform( + new SinkTransformer( + (sink) => new FutureWaitingTransformerSink( + sink, + closeCompleter.future, + ), + ), + ) + .listen( + (data) { + events.add(data); + }, + onError: (e, st) { + events.add(e); + events.add(st); + }, + onDone: () { + Expect.listEquals([], events); + streamIsDone = true; + }, + ); + }, + (e, s) { + Expect.isTrue(e is StateError); + errorCount++; + }, + ); closeCompleter.complete(); Timer.run(() { Expect.isTrue(streamIsDone); @@ -311,22 +364,28 @@ var stackTrace = currentStackTrace; var events = []; var controller; - controller = new StreamController(onListen: () { - // Events are added outside the zone. - controller.add(499); - controller.addError(42, stackTrace); - controller.close(); - }); + controller = new StreamController( + onListen: () { + // Events are added outside the zone. + controller.add(499); + controller.addError(42, stackTrace); + controller.close(); + }, + ); Zone zone = Zone.current.fork(); var stream = controller.stream.transform( - new SinkTransformer((sink) => new ZoneTransformerSink(sink))); + new SinkTransformer((sink) => new ZoneTransformerSink(sink)), + ); zone.run(() { - stream.listen((data) { - events.add(data); - }, onDone: () { - Expect.listEquals([zone, zone, zone], events); - delayCycles(asyncEnd, 3); - }); + stream.listen( + (data) { + events.add(data); + }, + onDone: () { + Expect.listEquals([zone, zone, zone], events); + delayCycles(asyncEnd, 3); + }, + ); }); } @@ -334,12 +393,15 @@ // Just make sure that the generic types are correct everywhere. asyncStart(); new Stream.fromIterable([1, 2, 3]) - .transform(new SinkTransformer<int, String>( - (sink) => new TypeChangingSink(sink))) + .transform( + new SinkTransformer<int, String>( + (sink) => new TypeChangingSink(sink), + ), + ) .toList() .then((list) { - Expect.listEquals(["1", "2", "3"], list); - asyncEnd(); - }); + Expect.listEquals(["1", "2", "3"], list); + asyncEnd(); + }); } }
diff --git a/tests/lib/async/stream_from_futures_test.dart b/tests/lib/async/stream_from_futures_test.dart index 65fb578..c3a7563 100644 --- a/tests/lib/async/stream_from_futures_test.dart +++ b/tests/lib/async/stream_from_futures_test.dart
@@ -41,14 +41,18 @@ var stream = new Stream.fromFutures(cs.map((x) => x.future)); int counter = 0; - stream.listen((_) { - Expect.fail("unexpected value"); - }, onError: (e) { - Expect.equals(++counter, e); - }, onDone: () { - Expect.equals(3, counter); - asyncEnd(); - }); + stream.listen( + (_) { + Expect.fail("unexpected value"); + }, + onError: (e) { + Expect.equals(++counter, e); + }, + onDone: () { + Expect.equals(3, counter); + asyncEnd(); + }, + ); cs[1].completeError(1); cs[2].completeError(2); @@ -61,16 +65,20 @@ var stream = new Stream.fromFutures(cs.map((x) => x.future)); int counter = 0; - stream.listen((v) { - Expect.isTrue(counter == 0 || counter == 2); - Expect.equals(++counter, v); - }, onError: (e) { - Expect.equals(++counter, 2); - Expect.equals(2, e); - }, onDone: () { - Expect.equals(3, counter); - asyncEnd(); - }); + stream.listen( + (v) { + Expect.isTrue(counter == 0 || counter == 2); + Expect.equals(++counter, v); + }, + onError: (e) { + Expect.equals(++counter, 2); + Expect.equals(2, e); + }, + onDone: () { + Expect.equals(3, counter); + asyncEnd(); + }, + ); cs[1].complete(1); cs[2].completeError(2); @@ -107,25 +115,33 @@ asyncStart(); var stream = new Stream.fromFutures([]); - stream.listen((_) { - Expect.fail("unexpected value"); - }, onError: (e) { - Expect.fail("unexpected error"); - }, onDone: () { - asyncEnd(); - }); + stream.listen( + (_) { + Expect.fail("unexpected value"); + }, + onError: (e) { + Expect.fail("unexpected error"); + }, + onDone: () { + asyncEnd(); + }, + ); } void testPrecompleted() { asyncStart(); var stream = new Stream.fromFutures( - new Iterable.generate(3, (v) => new Future.value(v + 1))); + new Iterable.generate(3, (v) => new Future.value(v + 1)), + ); var expected = new Set.from([1, 2, 3]); - stream.listen((v) { - Expect.isTrue(expected.contains(v)); - expected.remove(v); - }, onDone: () { - Expect.isTrue(expected.isEmpty); - asyncEnd(); - }); + stream.listen( + (v) { + Expect.isTrue(expected.contains(v)); + expected.remove(v); + }, + onDone: () { + Expect.isTrue(expected.isEmpty); + asyncEnd(); + }, + ); }
diff --git a/tests/lib/async/stream_from_iterable_test.dart b/tests/lib/async/stream_from_iterable_test.dart index dcfdee0..76920e8 100644 --- a/tests/lib/async/stream_from_iterable_test.dart +++ b/tests/lib/async/stream_from_iterable_test.dart
@@ -19,10 +19,13 @@ List<T> expected = iterable.toList(); Stream<T> stream = new Stream<T>.fromIterable(iterable); var events = <T>[]; - stream.listen(events.add, onDone: () { - Expect.listEquals(expected, events, "fromIterable $iterable"); - asyncEnd(); - }); + stream.listen( + events.add, + onDone: () { + Expect.listEquals(expected, events, "fromIterable $iterable"); + asyncEnd(); + }, + ); } main() { @@ -36,7 +39,8 @@ iterableTest<String>(<String>["one", "two", "three", "four"]); iterableTest<int>(new Iterable<int>.generate(1000, (i) => i)); iterableTest<String>( - new Iterable<int>.generate(1000, (i) => i).map((i) => "$i")); + new Iterable<int>.generate(1000, (i) => i).map((i) => "$i"), + ); Iterable<int> iter = new Iterable.generate(25, (i) => i * 2); @@ -66,29 +70,36 @@ asyncStart(); int ctr = 0; - var stream = new Stream<int>.fromIterable(iter.map((x) { - ctr++; - return x; - })); + var stream = new Stream<int>.fromIterable( + iter.map((x) { + ctr++; + return x; + }), + ); late StreamSubscription subscription; var actual = []; - subscription = stream.listen((int value) { - actual.add(value); - // Do a 10 ms pause during the playback of the iterable. - Duration duration = const Duration(milliseconds: 10); - if (value == 20) { - asyncStart(); - int beforeCtr = ctr; - subscription.pause(new Future.delayed(duration, () {}).whenComplete(() { - Expect.equals(beforeCtr, ctr); - asyncEnd(); - })); - } - }, onDone: () { - Expect.listEquals(iter.toList(), actual); - asyncEnd(); - }); + subscription = stream.listen( + (int value) { + actual.add(value); + // Do a 10 ms pause during the playback of the iterable. + Duration duration = const Duration(milliseconds: 10); + if (value == 20) { + asyncStart(); + int beforeCtr = ctr; + subscription.pause( + new Future.delayed(duration, () {}).whenComplete(() { + Expect.equals(beforeCtr, ctr); + asyncEnd(); + }), + ); + } + }, + onDone: () { + Expect.listEquals(iter.toList(), actual); + asyncEnd(); + }, + ); } { @@ -139,11 +150,15 @@ asyncStart(); var data = [], errors = []; - c.stream.listen(data.add, onError: errors.add, onDone: () { - Expect.listEquals([1, 3, 5], data); - Expect.listEquals([2, 4], errors); - asyncEnd(); - }); + c.stream.listen( + data.add, + onError: errors.add, + onDone: () { + Expect.listEquals([1, 3, 5], data); + Expect.listEquals([2, 4], errors); + asyncEnd(); + }, + ); c.addStream(from).then((_) { c.close(); }); @@ -187,11 +202,14 @@ { // Test error behavior. Changed when fixing issue 33431. // Iterable where "current" throws for third value, moveNext on fifth call. - var m = new MockIterable<int>((n) { - return n != 5 || (throw "moveNext"); - }, (n) { - return n != 3 ? n : throw "current"; - }); + var m = new MockIterable<int>( + (n) { + return n != 5 || (throw "moveNext"); + }, + (n) { + return n != 3 ? n : throw "current"; + }, + ); asyncStart(); collectEvents(new Stream<int>.fromIterable(m)).then((events) { // Error on "current" does not stop iteration. @@ -206,7 +224,7 @@ "value", 4, "error", - "moveNext" + "moveNext", ], events); asyncEnd(); }); @@ -221,17 +239,21 @@ Future<List<Object>> collectEvents(Stream<Object> stream) { var c = new Completer<List<Object>>(); var events = <Object>[]; - stream.listen((value) { - events - ..add("value") - ..add(value); - }, onError: (error) { - events - ..add("error") - ..add(error); - }, onDone: () { - c.complete(events); - }); + stream.listen( + (value) { + events + ..add("value") + ..add(value); + }, + onError: (error) { + events + ..add("error") + ..add(error); + }, + onDone: () { + c.complete(events); + }, + ); return c.future; }
diff --git a/tests/lib/async/stream_join_test.dart b/tests/lib/async/stream_join_test.dart index e75272d..cf7df79 100644 --- a/tests/lib/async/stream_join_test.dart +++ b/tests/lib/async/stream_join_test.dart
@@ -52,8 +52,9 @@ test("join-error", () { StreamController c = new StreamController(); - Future<String?>.value(c.stream.join("X")) - .catchError(expectAsync((String s) => expect(s, equals("BAD!")))); + Future<String?>.value( + c.stream.join("X"), + ).catchError(expectAsync((String s) => expect(s, equals("BAD!")))); c.add(new Foo("foo")); c.add(new Foo("bar")); c.add(new Bad());
diff --git a/tests/lib/async/stream_listen_zone_test.dart b/tests/lib/async/stream_listen_zone_test.dart index f3f4939..535aedae 100644 --- a/tests/lib/async/stream_listen_zone_test.dart +++ b/tests/lib/async/stream_listen_zone_test.dart
@@ -19,19 +19,33 @@ controller = new StreamController.broadcast(sync: sync); testStream("BSC$mode", controller, controller.stream, overrideDone); controller = new StreamController(sync: sync); - testStream("SCAB$mode", controller, controller.stream.asBroadcastStream(), - overrideDone, 3); + testStream( + "SCAB$mode", + controller, + controller.stream.asBroadcastStream(), + overrideDone, + 3, + ); controller = new StreamController(sync: sync); - testStream("SCMap$mode", controller, controller.stream.map((x) => x), - overrideDone, 3); + testStream( + "SCMap$mode", + controller, + controller.stream.map((x) => x), + overrideDone, + 3, + ); } } asyncEnd(); } void testStream( - String name, StreamController controller, Stream stream, bool overrideDone, - [int registerExpect = 0]) { + String name, + StreamController controller, + Stream stream, + bool overrideDone, [ + int registerExpect = 0, +]) { asyncStart(); late StreamSubscription sub; late Zone zone; @@ -43,51 +57,60 @@ Zone.root.scheduleMicrotask(step); } - runZoned(() { - zone = Zone.current; - sub = stream.listen((v) { - Expect.identical(zone, Zone.current, name); - Expect.equals(42, v, name); - callbackBits |= 1; - nextStep(); - }, onError: (e, s) { - Expect.identical(zone, Zone.current, name); - Expect.equals("ERROR", e, name); - callbackBits |= 2; - nextStep(); - }, onDone: () { - Expect.identical(zone, Zone.current, name); - if (overrideDone) throw "RUNNING WRONG ONDONE"; - callbackBits |= 4; - nextStep(); - }); - registerExpect += 3; - Expect.equals(registerExpect, registerCount, name); - }, - zoneSpecification: new ZoneSpecification( - registerCallback: <R>(self, p, z, R callback()) { + runZoned( + () { + zone = Zone.current; + sub = stream.listen( + (v) { + Expect.identical(zone, Zone.current, name); + Expect.equals(42, v, name); + callbackBits |= 1; + nextStep(); + }, + onError: (e, s) { + Expect.identical(zone, Zone.current, name); + Expect.equals("ERROR", e, name); + callbackBits |= 2; + nextStep(); + }, + onDone: () { + Expect.identical(zone, Zone.current, name); + if (overrideDone) throw "RUNNING WRONG ONDONE"; + callbackBits |= 4; + nextStep(); + }, + ); + registerExpect += 3; + Expect.equals(registerExpect, registerCount, name); + }, + zoneSpecification: new ZoneSpecification( + registerCallback: <R>(self, p, z, R callback()) { Expect.identical(zone, self, name); registerCount++; return () { Expect.identical(zone, Zone.current, name); return callback(); }; - }, registerUnaryCallback: <R, T>(self, p, z, R callback(T a)) { + }, + registerUnaryCallback: <R, T>(self, p, z, R callback(T a)) { Expect.identical(zone, self, name); registerCount++; return (a) { Expect.identical(zone, Zone.current, name); return callback(a); }; - }, registerBinaryCallback: - <R, T1, T2>(self, package, z, R callback(T1 a, T2 b)) { - Expect.identical(zone, self, name); - registerCount++; - return (a, b) { - Expect.identical(zone, Zone.current, name); - return callback(a, b); - }; - })); + }, + registerBinaryCallback: + <R, T1, T2>(self, package, z, R callback(T1 a, T2 b)) { + Expect.identical(zone, self, name); + registerCount++; + return (a, b) { + Expect.identical(zone, Zone.current, name); + return callback(a, b); + }; + }, + ), + ); int expectedBits = 0; step = () {
diff --git a/tests/lib/async/stream_multi_test.dart b/tests/lib/async/stream_multi_test.dart index e91bd5b..f5cbee3 100644 --- a/tests/lib/async/stream_multi_test.dart +++ b/tests/lib/async/stream_multi_test.dart
@@ -12,18 +12,22 @@ var done = false; T? latest = null; var currentListeners = <MultiStreamController<T>>{}; - this.listen((event) { - latest = event; - for (var listener in [...currentListeners]) listener.addSync(event); - }, onError: (Object error, StackTrace stack) { - for (var listener in [...currentListeners]) - listener.addErrorSync(error, stack); - }, onDone: () { - done = true; - latest = null; - for (var listener in currentListeners) listener.closeSync(); - currentListeners.clear(); - }); + this.listen( + (event) { + latest = event; + for (var listener in [...currentListeners]) listener.addSync(event); + }, + onError: (Object error, StackTrace stack) { + for (var listener in [...currentListeners]) + listener.addErrorSync(error, stack); + }, + onDone: () { + done = true; + latest = null; + for (var listener in currentListeners) listener.closeSync(); + currentListeners.clear(); + }, + ); return Stream.multi((controller) { if (done) { controller.close(); @@ -65,14 +69,15 @@ } asyncStart(); - Future.wait([multi.forEach(logList), multi.forEach(logList)]) - .whenComplete(() { - Expect.equals(7, log.length); - for (var element in ["1", "1-0", "1-1", "2", "2-0", "2-1", "2-2"]) { - Expect.isTrue(log.contains(element)); - } - asyncEnd(); - }); + Future.wait([multi.forEach(logList), multi.forEach(logList)]).whenComplete( + () { + Expect.equals(7, log.length); + for (var element in ["1", "1-0", "1-1", "2", "2-0", "2-1", "2-2"]) { + Expect.isTrue(log.contains(element)); + } + asyncEnd(); + }, + ); } /// Test that stream can be listened to again after having no listener. @@ -88,16 +93,20 @@ }); for (var i in [1, 2, 3]) { var log = <Object?>[]; - var subscription = stream.listen((v) { - log.add(v); - if (!completer.isCompleted) completer.complete(v); - }, onError: (e, s) { - log.add(e); - if (!completer.isCompleted) completer.complete(e); - }, onDone: () { - log.add(null); - if (!completer.isCompleted) completer.complete(null); - }); + var subscription = stream.listen( + (v) { + log.add(v); + if (!completer.isCompleted) completer.complete(v); + }, + onError: (e, s) { + log.add(e); + if (!completer.isCompleted) completer.complete(e); + }, + onDone: () { + log.add(null); + if (!completer.isCompleted) completer.complete(null); + }, + ); Expect.isNotNull(controller); controller!.add(1); await completer.future;
diff --git a/tests/lib/async/stream_periodic2_test.dart b/tests/lib/async/stream_periodic2_test.dart index 5a4b2d1..62c0b3e 100644 --- a/tests/lib/async/stream_periodic2_test.dart +++ b/tests/lib/async/stream_periodic2_test.dart
@@ -11,14 +11,18 @@ main() { test("stream-periodic2", () { - Stream stream = - new Stream.periodic(const Duration(milliseconds: 1), (x) => x); + Stream stream = new Stream.periodic( + const Duration(milliseconds: 1), + (x) => x, + ); int receivedCount = 0; var subscription; - subscription = stream.listen(expectAsync((data) { - expect(data, receivedCount); - receivedCount++; - if (receivedCount == 5) subscription.cancel(); - }, count: 5)); + subscription = stream.listen( + expectAsync((data) { + expect(data, receivedCount); + receivedCount++; + if (receivedCount == 5) subscription.cancel(); + }, count: 5), + ); }); }
diff --git a/tests/lib/async/stream_periodic3_test.dart b/tests/lib/async/stream_periodic3_test.dart index 9e64369..acd166b 100644 --- a/tests/lib/async/stream_periodic3_test.dart +++ b/tests/lib/async/stream_periodic3_test.dart
@@ -18,11 +18,18 @@ main() { test("stream-periodic3", () { Stopwatch watch = new Stopwatch()..start(); - Stream stream = - new Stream.periodic(const Duration(milliseconds: 1), (x) => x); - stream.take(10).listen((_) {}, onDone: expectAsync(() { - int millis = watch.elapsedMilliseconds + safetyMargin; - expect(millis, greaterThanOrEqualTo(10)); - })); + Stream stream = new Stream.periodic( + const Duration(milliseconds: 1), + (x) => x, + ); + stream + .take(10) + .listen( + (_) {}, + onDone: expectAsync(() { + int millis = watch.elapsedMilliseconds + safetyMargin; + expect(millis, greaterThanOrEqualTo(10)); + }), + ); }); }
diff --git a/tests/lib/async/stream_periodic4_test.dart b/tests/lib/async/stream_periodic4_test.dart index 2617f19..451c807 100644 --- a/tests/lib/async/stream_periodic4_test.dart +++ b/tests/lib/async/stream_periodic4_test.dart
@@ -44,7 +44,10 @@ main() { test("stream-periodic4", () { - runTest(const Duration(milliseconds: 2), const Duration(milliseconds: 8), - const Duration(milliseconds: 10)); + runTest( + const Duration(milliseconds: 2), + const Duration(milliseconds: 8), + const Duration(milliseconds: 10), + ); }); }
diff --git a/tests/lib/async/stream_periodic5_test.dart b/tests/lib/async/stream_periodic5_test.dart index 276c698..0a42cdc 100644 --- a/tests/lib/async/stream_periodic5_test.dart +++ b/tests/lib/async/stream_periodic5_test.dart
@@ -19,8 +19,10 @@ main() { test("stream-periodic4", () { - Stream stream = - new Stream.periodic(const Duration(milliseconds: 5), (x) => x); + Stream stream = new Stream.periodic( + const Duration(milliseconds: 5), + (x) => x, + ); Stopwatch watch = new Stopwatch()..start(); var subscription; subscription = stream.take(10).listen((i) {
diff --git a/tests/lib/async/stream_periodic6_test.dart b/tests/lib/async/stream_periodic6_test.dart index 5a8976b..cc23011 100644 --- a/tests/lib/async/stream_periodic6_test.dart +++ b/tests/lib/async/stream_periodic6_test.dart
@@ -18,12 +18,14 @@ int expected = 0; var subscription; subscription = stream.listen( - expectAsync((data) { - expect(data, expected++); - if (expected == 5) subscription.cancel(); - }, count: 4), onError: expectAsync((e, s) { - expect(e, 42); - expected++; - })); + expectAsync((data) { + expect(data, expected++); + if (expected == 5) subscription.cancel(); + }, count: 4), + onError: expectAsync((e, s) { + expect(e, 42); + expected++; + }), + ); }); }
diff --git a/tests/lib/async/stream_periodic_test.dart b/tests/lib/async/stream_periodic_test.dart index f636301..e6a9126 100644 --- a/tests/lib/async/stream_periodic_test.dart +++ b/tests/lib/async/stream_periodic_test.dart
@@ -14,13 +14,15 @@ Stream stream = new Stream.periodic(const Duration(milliseconds: 1)); int receivedCount = 0; var subscription; - subscription = stream.listen(expectAsync((data) { - expect(data, isNull); - receivedCount++; - if (receivedCount == 5) { - var future = subscription.cancel(); - expect(future, completes); - } - }, count: 5)); + subscription = stream.listen( + expectAsync((data) { + expect(data, isNull); + receivedCount++; + if (receivedCount == 5) { + var future = subscription.cancel(); + expect(future, completes); + } + }, count: 5), + ); }); }
diff --git a/tests/lib/async/stream_single_test.dart b/tests/lib/async/stream_single_test.dart index 3404843..396dd4b 100644 --- a/tests/lib/async/stream_single_test.dart +++ b/tests/lib/async/stream_single_test.dart
@@ -16,27 +16,33 @@ test("single", () { StreamController c = new StreamController(sync: true); Future f = c.stream.single; - f.then(expectAsync((v) { - Expect.equals(42, v); - })); + f.then( + expectAsync((v) { + Expect.equals(42, v); + }), + ); new Events.fromIterable([42]).replay(c); }); test("single empty", () { StreamController c = new StreamController(sync: true); Future f = c.stream.single; - f.catchError(expectAsync((error) { - Expect.isTrue(error is StateError); - })); + f.catchError( + expectAsync((error) { + Expect.isTrue(error is StateError); + }), + ); new Events.fromIterable([]).replay(c); }); test("single error", () { StreamController c = new StreamController(sync: true); Future f = c.stream.single; - f.catchError(expectAsync((error) { - Expect.equals("error", error); - })); + f.catchError( + expectAsync((error) { + Expect.equals("error", error); + }), + ); Events errorEvents = new Events() ..error("error") ..close(); @@ -46,9 +52,11 @@ test("single error 2", () { StreamController c = new StreamController(sync: true); Future f = c.stream.single; - f.catchError(expectAsync((error) { - Expect.equals("error", error); - })); + f.catchError( + expectAsync((error) { + Expect.equals("error", error); + }), + ); Events errorEvents = new Events() ..error("error") ..error("error2") @@ -59,9 +67,11 @@ test("single error 3", () { StreamController c = new StreamController(sync: true); Future f = c.stream.single; - f.catchError(expectAsync((error) { - Expect.equals("error", error); - })); + f.catchError( + expectAsync((error) { + Expect.equals("error", error); + }), + ); Events errorEvents = new Events() ..add(499) ..error("error")
diff --git a/tests/lib/async/stream_single_to_multi_subscriber_test.dart b/tests/lib/async/stream_single_to_multi_subscriber_test.dart index 5cc0b0f..2807451 100644 --- a/tests/lib/async/stream_single_to_multi_subscriber_test.dart +++ b/tests/lib/async/stream_single_to_multi_subscriber_test.dart
@@ -28,12 +28,16 @@ Events expected = new Events.fromIterable([1, 2, 3, 4, 5]); Events actual1 = new Events.capture(multi); Events actual2 = new Events.capture(multi); - actual1.onDone(expectAsync(() { - Expect.listEquals(expected.events, actual1.events); - })); - actual2.onDone(expectAsync(() { - Expect.listEquals(expected.events, actual2.events); - })); + actual1.onDone( + expectAsync(() { + Expect.listEquals(expected.events, actual1.events); + }), + ); + actual2.onDone( + expectAsync(() { + Expect.listEquals(expected.events, actual2.events); + }), + ); expected.replay(c); }); @@ -43,12 +47,16 @@ Events expected = new Events.fromIterable([1, 2, 3, 4, 5]); Events actual1 = new Events.capture(multi); Events actual2 = new Events.capture(multi); - actual1.onDone(expectAsync(() { - Expect.listEquals(expected.events, actual1.events); - })); - actual2.onDone(expectAsync(() { - Expect.listEquals(expected.events, actual2.events); - })); + actual1.onDone( + expectAsync(() { + Expect.listEquals(expected.events, actual1.events); + }), + ); + actual2.onDone( + expectAsync(() { + Expect.listEquals(expected.events, actual2.events); + }), + ); expected.replay(c); }); }
diff --git a/tests/lib/async/stream_state_helper.dart b/tests/lib/async/stream_state_helper.dart index 4edc1234..49b0f4e 100644 --- a/tests/lib/async/stream_state_helper.dart +++ b/tests/lib/async/stream_state_helper.dart
@@ -62,10 +62,13 @@ Function? _onComplete; StreamProtocolTest.broadcast({bool sync = false}) - : isBroadcast = true, - isAsBroadcast = false { + : isBroadcast = true, + isAsBroadcast = false { _controller = new StreamController.broadcast( - sync: sync, onListen: _onListen, onCancel: _onCancel); + sync: sync, + onListen: _onListen, + onCancel: _onCancel, + ); _controllerStream = _controller.stream; _onComplete = expectAsync(() { _onComplete = null; // Being null marks the test as being complete. @@ -73,14 +76,15 @@ } StreamProtocolTest({bool sync = false}) - : isBroadcast = false, - isAsBroadcast = false { + : isBroadcast = false, + isAsBroadcast = false { _controller = new StreamController( - sync: sync, - onListen: _onListen, - onPause: _onPause, - onResume: _onResume, - onCancel: _onCancel); + sync: sync, + onListen: _onListen, + onPause: _onPause, + onResume: _onResume, + onCancel: _onCancel, + ); _controllerStream = _controller.stream; _onComplete = expectAsync(() { _onComplete = null; // Being null marks the test as being complete. @@ -88,16 +92,19 @@ } StreamProtocolTest.asBroadcast({bool sync = false}) - : isBroadcast = false, - isAsBroadcast = true { + : isBroadcast = false, + isAsBroadcast = true { _controller = new StreamController( - sync: sync, - onListen: _onListen, - onPause: _onPause, - onResume: _onResume, - onCancel: _onCancel); + sync: sync, + onListen: _onListen, + onPause: _onPause, + onResume: _onResume, + onCancel: _onCancel, + ); _controllerStream = _controller.stream.asBroadcastStream( - onListen: _onBroadcastListen, onCancel: _onBroadcastCancel); + onListen: _onBroadcastListen, + onCancel: _onBroadcastCancel, + ); _onComplete = expectAsync(() { _onComplete = null; // Being null marks the test as being complete. }); @@ -119,15 +126,23 @@ SubscriptionProtocolTest listen({bool cancelOnError = false}) { int subscriptionId = _subscriptionIdCounter++; - StreamSubscription subscription = _controllerStream.listen((var data) { - _onData(subscriptionId, data); - }, onError: (Object error) { - _onError(subscriptionId, error); - }, onDone: () { - _onDone(subscriptionId); - }, cancelOnError: cancelOnError); - _latestSubscription = - new SubscriptionProtocolTest(subscriptionId, subscription, this); + StreamSubscription subscription = _controllerStream.listen( + (var data) { + _onData(subscriptionId, data); + }, + onError: (Object error) { + _onError(subscriptionId, error); + }, + onDone: () { + _onDone(subscriptionId); + }, + cancelOnError: cancelOnError, + ); + _latestSubscription = new SubscriptionProtocolTest( + subscriptionId, + subscription, + this, + ); if (trace) { print("[Listen #$subscriptionId(#${_latestSubscription.hashCode})]"); } @@ -154,8 +169,10 @@ void terminate() { if (_nextExpectationIndex != _expectations.length) { _withNextExpectation((Event expect) { - _fail("Expected: $expect\n" - "Found : Early termination.\n${expect._stackTrace}"); + _fail( + "Expected: $expect\n" + "Found : Early termination.\n${expect._stackTrace}", + ); }); } _onComplete!(); @@ -166,8 +183,10 @@ if (trace) print("[Data#$id : $data]"); _withNextExpectation((Event expect) { if (!expect.matchData(id, data)) { - _fail("Expected: $expect\n" - "Found : [Data#$id: $data]\n${expect._stackTrace}"); + _fail( + "Expected: $expect\n" + "Found : [Data#$id: $data]\n${expect._stackTrace}", + ); } }); } @@ -176,8 +195,10 @@ if (trace) print("[Error#$id : $error]"); _withNextExpectation((Event expect) { if (!expect.matchError(id, error)) { - _fail("Expected: $expect\n" - "Found : [Error#$id: ${error}]\n${expect._stackTrace}"); + _fail( + "Expected: $expect\n" + "Found : [Error#$id: ${error}]\n${expect._stackTrace}", + ); } }); } @@ -186,8 +207,10 @@ if (trace) print("[Done#$id]"); _withNextExpectation((Event expect) { if (!expect.matchDone(id)) { - _fail("Expected: $expect\n" - "Found : [Done#$id]\n${expect._stackTrace}"); + _fail( + "Expected: $expect\n" + "Found : [Done#$id]\n${expect._stackTrace}", + ); } }); } @@ -196,8 +219,10 @@ if (trace) print("[Pause]"); _withNextExpectation((Event expect) { if (!expect.matchPause()) { - _fail("Expected: $expect\n" - "Found : [Paused]\n${expect._stackTrace}"); + _fail( + "Expected: $expect\n" + "Found : [Paused]\n${expect._stackTrace}", + ); } }); } @@ -206,8 +231,10 @@ if (trace) print("[Resumed]"); _withNextExpectation((Event expect) { if (!expect.matchResume()) { - _fail("Expected: $expect\n" - "Found : [Resumed]\n${expect._stackTrace}"); + _fail( + "Expected: $expect\n" + "Found : [Resumed]\n${expect._stackTrace}", + ); } }); } @@ -216,8 +243,10 @@ if (trace) print("[Subscribed]"); _withNextExpectation((Event expect) { if (!expect.matchSubscribe()) { - _fail("Expected: $expect\n" - "Found: [Subscribed]\n${expect._stackTrace}"); + _fail( + "Expected: $expect\n" + "Found: [Subscribed]\n${expect._stackTrace}", + ); } }); } @@ -226,8 +255,10 @@ if (trace) print("[Cancelled]"); _withNextExpectation((Event expect) { if (!expect.matchCancel()) { - _fail("Expected: $expect\n" - "Found: [Cancelled]\n${expect._stackTrace}"); + _fail( + "Expected: $expect\n" + "Found: [Cancelled]\n${expect._stackTrace}", + ); } }); } @@ -236,8 +267,10 @@ if (trace) print("[BroadcastListen]"); _withNextExpectation((Event expect) { if (!expect.matchBroadcastListen(sub)) { - _fail("Expected: $expect\n" - "Found: [BroadcastListen]\n${expect._stackTrace}"); + _fail( + "Expected: $expect\n" + "Found: [BroadcastListen]\n${expect._stackTrace}", + ); } }); } @@ -246,8 +279,10 @@ if (trace) print("[BroadcastCancel]"); _withNextExpectation((Event expect) { if (!expect.matchBroadcastCancel(sub)) { - _fail("Expected: $expect\n" - "Found: [BroadcastCancel]\n${expect._stackTrace}"); + _fail( + "Expected: $expect\n" + "Found: [BroadcastCancel]\n${expect._stackTrace}", + ); } }); } @@ -385,7 +420,7 @@ Function? _action; StackTrace? _stackTrace; Event(void action()?) - : _action = (action == null) ? null : expectAsync(action) { + : _action = (action == null) ? null : expectAsync(action) { try { throw 0; } catch (_, s) { @@ -393,7 +428,7 @@ } } Event.broadcast(void action(StreamSubscription sub)?) - : _action = (action == null) ? null : expectAsync(action) { + : _action = (action == null) ? null : expectAsync(action) { try { throw 0; } catch (_, s) { @@ -496,7 +531,7 @@ class DataEvent extends SubscriptionEvent { final data; DataEvent(SubscriptionProtocolTest? sub, this.data, void action()?) - : super(sub, action); + : super(sub, action); bool _testData(var data) => this.data == data; String toString() => "[Data$_id: $data]"; } @@ -504,7 +539,7 @@ class ErrorEvent extends SubscriptionEvent { final error; ErrorEvent(SubscriptionProtocolTest? sub, this.error, void action()?) - : super(sub, action); + : super(sub, action); bool _testError(error) => this.error == error; String toString() => "[Error$_id: $error]"; } @@ -541,14 +576,14 @@ class BroadcastCancelCallbackEvent extends Event { BroadcastCancelCallbackEvent(void action(StreamSubscription sub)?) - : super.broadcast(action); + : super.broadcast(action); bool _testBroadcastCancel() => true; String toString() => "[BroadcastCancel]"; } class BroadcastListenCallbackEvent extends Event { BroadcastListenCallbackEvent(void action(StreamSubscription sub)?) - : super.broadcast(action); + : super.broadcast(action); bool _testBroadcastListen() => true; String toString() => "[BroadcastListen]"; }
diff --git a/tests/lib/async/stream_subscription_as_future_test.dart b/tests/lib/async/stream_subscription_as_future_test.dart index 11b1724..8fca943 100644 --- a/tests/lib/async/stream_subscription_as_future_test.dart +++ b/tests/lib/async/stream_subscription_as_future_test.dart
@@ -17,9 +17,13 @@ var subscription = stream.listen((x) { output.add(x); }); - subscription.asFuture(output).then(expectAsync((o) { - Expect.listEquals([1, 2, 3], o); - })); + subscription + .asFuture(output) + .then( + expectAsync((o) { + Expect.listEquals([1, 2, 3], o); + }), + ); }); test("subscription.asFuture success2", () { @@ -31,9 +35,13 @@ var subscription = stream.listen((x) { output.add(x); }); - subscription.asFuture(output).then(expectAsync((o) { - Expect.listEquals([1, 2, 3], o); - })); + subscription + .asFuture(output) + .then( + expectAsync((o) { + Expect.listEquals([1, 2, 3], o); + }), + ); }); test("subscription.asFuture success 3", () { @@ -42,9 +50,13 @@ var subscription = stream.listen((x) { output.add(x); }); - subscription.asFuture(output).then(expectAsync((o) { - Expect.listEquals([1, 2, 3], o); - })); + subscription + .asFuture(output) + .then( + expectAsync((o) { + Expect.listEquals([1, 2, 3], o); + }), + ); }); test("subscription.asFuture different type", () { @@ -71,9 +83,13 @@ var subscription = stream.listen((x) { output.add(x); }); - subscription.asFuture<List?>(output).catchError(expectAsync((error) { - Expect.equals(error, "foo"); - })); + subscription + .asFuture<List?>(output) + .catchError( + expectAsync((error) { + Expect.equals(error, "foo"); + }), + ); }); test("subscription.asFuture failure2", () { @@ -85,15 +101,21 @@ var subscription = stream.listen((x) { output.add(x); }); - subscription.asFuture<List?>(output).catchError(expectAsync((error) { - Expect.equals(error, "foo"); - })); + subscription + .asFuture<List?>(output) + .catchError( + expectAsync((error) { + Expect.equals(error, "foo"); + }), + ); }); test("subscription.asFuture delayed cancel", () { var completer = new Completer(); - var controller = - new StreamController(onCancel: () => completer.future, sync: true); + var controller = new StreamController( + onCancel: () => completer.future, + sync: true, + ); [1, 2, 3].forEach(controller.add); controller.addError("foo"); controller.close(); @@ -103,40 +125,57 @@ output.add(x); }); bool catchErrorHasRun = false; - subscription.asFuture<List?>(output).catchError(expectAsync((error) { - Expect.equals(error, "foo"); - catchErrorHasRun = true; - })); - Timer.run(expectAsync(() { - Expect.isFalse(catchErrorHasRun); - completer.complete(); - })); + subscription + .asFuture<List?>(output) + .catchError( + expectAsync((error) { + Expect.equals(error, "foo"); + catchErrorHasRun = true; + }), + ); + Timer.run( + expectAsync(() { + Expect.isFalse(catchErrorHasRun); + completer.complete(); + }), + ); }); test("subscription.asFuture failure in cancel", () { - runZonedGuarded(() { - var completer = new Completer(); - var controller = - new StreamController(onCancel: () => completer.future, sync: true); - [1, 2, 3].forEach(controller.add); - controller.addError("foo"); - controller.close(); - Stream stream = controller.stream; - var output = []; - var subscription = stream.listen((x) { - output.add(x); - }); - bool catchErrorHasRun = false; - subscription.asFuture<List?>(output).catchError(expectAsync((error) { - Expect.equals(error, "foo"); - catchErrorHasRun = true; - })); - Timer.run(expectAsync(() { - Expect.isFalse(catchErrorHasRun); - completer.completeError(499); - })); - }, expectAsync2((e, s) { - Expect.equals(499, e); - })); + runZonedGuarded( + () { + var completer = new Completer(); + var controller = new StreamController( + onCancel: () => completer.future, + sync: true, + ); + [1, 2, 3].forEach(controller.add); + controller.addError("foo"); + controller.close(); + Stream stream = controller.stream; + var output = []; + var subscription = stream.listen((x) { + output.add(x); + }); + bool catchErrorHasRun = false; + subscription + .asFuture<List?>(output) + .catchError( + expectAsync((error) { + Expect.equals(error, "foo"); + catchErrorHasRun = true; + }), + ); + Timer.run( + expectAsync(() { + Expect.isFalse(catchErrorHasRun); + completer.completeError(499); + }), + ); + }, + expectAsync2((e, s) { + Expect.equals(499, e); + }), + ); }); }
diff --git a/tests/lib/async/stream_subscription_cancel_test.dart b/tests/lib/async/stream_subscription_cancel_test.dart index 459adda..2c13935 100644 --- a/tests/lib/async/stream_subscription_cancel_test.dart +++ b/tests/lib/async/stream_subscription_cancel_test.dart
@@ -12,12 +12,15 @@ void main() { test('subscription.cancel', () { var completer = new Completer(); - StreamController controller = - new StreamController(onCancel: () => completer.future); + StreamController controller = new StreamController( + onCancel: () => completer.future, + ); bool done = false; - expect(controller.stream.listen(null).cancel().then((_) => done), - completion(equals(true))); + expect( + controller.stream.listen(null).cancel().then((_) => done), + completion(equals(true)), + ); Timer.run(() { done = true; @@ -27,10 +30,12 @@ test('subscription.cancel after close', () { var completer = new Completer(); - StreamController controller = new StreamController(onCancel: () { - completer.complete(); - return completer.future; - }); + StreamController controller = new StreamController( + onCancel: () { + completer.complete(); + return completer.future; + }, + ); controller.close(); @@ -47,8 +52,9 @@ test('subscription.cancel after error', () { var completer = new Completer(); - StreamController controller = - new StreamController(onCancel: () => completer.future); + StreamController controller = new StreamController( + onCancel: () => completer.future, + ); controller.addError("error"); @@ -68,9 +74,11 @@ test('subscription.cancel after error (cancelOnError)', () { bool called = false; - StreamController controller = new StreamController(onCancel: () { - called = true; - }); + StreamController controller = new StreamController( + onCancel: () { + called = true; + }, + ); controller.addError("error"); @@ -86,9 +94,11 @@ test('subscription.cancel before error (cancelOnError)', () { var doneCompleter = new Completer(); - StreamController controller = new StreamController(onCancel: () { - doneCompleter.complete(true); - }); + StreamController controller = new StreamController( + onCancel: () { + doneCompleter.complete(true); + }, + ); controller.addError("error"); @@ -104,10 +114,12 @@ test('subscription.cancel on error (cancelOnError)', () { bool called = false; - StreamController controller = new StreamController(onCancel: () { - expect(called, isFalse); - called = true; - }); + StreamController controller = new StreamController( + onCancel: () { + expect(called, isFalse); + called = true; + }, + ); controller.addError("error"); @@ -125,9 +137,11 @@ test('subscription.cancel before done', () { var doneCompleter = new Completer(); - StreamController controller = new StreamController(onCancel: () { - doneCompleter.complete(true); - }); + StreamController controller = new StreamController( + onCancel: () { + doneCompleter.complete(true); + }, + ); controller.close(); @@ -141,8 +155,9 @@ test('subscription.cancel through map', () { var completer = new Completer(); - StreamController controller = - new StreamController(onCancel: () => completer.future); + StreamController controller = new StreamController( + onCancel: () => completer.future, + ); bool done = false; var future = controller.stream.map((x) => x).listen(null).cancel(); @@ -157,8 +172,9 @@ test('subscription.cancel through asyncMap', () { var completer = new Completer(); - StreamController controller = - new StreamController(onCancel: () => completer.future); + StreamController controller = new StreamController( + onCancel: () => completer.future, + ); bool done = false; var future = controller.stream.asyncMap((x) => x).listen(null).cancel(); @@ -173,8 +189,9 @@ test('subscription.cancel through asyncExpand', () { var completer = new Completer(); - StreamController controller = - new StreamController(onCancel: () => completer.future); + StreamController controller = new StreamController( + onCancel: () => completer.future, + ); bool done = false; var future = controller.stream.asyncExpand((x) => x).listen(null).cancel(); @@ -189,8 +206,9 @@ test('subscription.cancel through handleError', () { var completer = new Completer(); - StreamController controller = - new StreamController(onCancel: () => completer.future); + StreamController controller = new StreamController( + onCancel: () => completer.future, + ); bool done = false; var future = controller.stream.handleError((x) => x).listen(null).cancel(); @@ -205,8 +223,9 @@ test('subscription.cancel through skip', () { var completer = new Completer(); - StreamController controller = - new StreamController(onCancel: () => completer.future); + StreamController controller = new StreamController( + onCancel: () => completer.future, + ); bool done = false; var future = controller.stream.skip(1).listen(null).cancel(); @@ -221,8 +240,9 @@ test('subscription.cancel through take', () { var completer = new Completer(); - StreamController controller = - new StreamController(onCancel: () => completer.future); + StreamController controller = new StreamController( + onCancel: () => completer.future, + ); bool done = false; var future = controller.stream.take(1).listen(null).cancel(); @@ -237,8 +257,9 @@ test('subscription.cancel through skipWhile', () { var completer = new Completer(); - StreamController controller = - new StreamController(onCancel: () => completer.future); + StreamController controller = new StreamController( + onCancel: () => completer.future, + ); bool done = false; var future = controller.stream.skipWhile((x) => true).listen(null).cancel(); @@ -253,8 +274,9 @@ test('subscription.cancel through takeWhile', () { var completer = new Completer(); - StreamController controller = - new StreamController(onCancel: () => completer.future); + StreamController controller = new StreamController( + onCancel: () => completer.future, + ); bool done = false; var future = controller.stream.takeWhile((x) => true).listen(null).cancel(); @@ -269,8 +291,9 @@ test('subscription.cancel through timeOut', () { var completer = new Completer(); - StreamController controller = - new StreamController(onCancel: () => completer.future); + StreamController controller = new StreamController( + onCancel: () => completer.future, + ); bool done = false; var duration = const Duration(hours: 5); @@ -286,8 +309,9 @@ test('subscription.cancel through transform', () { var completer = new Completer(); - StreamController controller = - new StreamController(onCancel: () => completer.future); + StreamController controller = new StreamController( + onCancel: () => completer.future, + ); bool done = false; var transformer = new StreamTransformer.fromHandlers(handleData: (x, y) {}); @@ -303,8 +327,9 @@ test('subscription.cancel through where', () { var completer = new Completer(); - StreamController controller = - new StreamController(onCancel: () => completer.future); + StreamController controller = new StreamController( + onCancel: () => completer.future, + ); bool done = false; var future = controller.stream.where((x) => true).listen(null).cancel();
diff --git a/tests/lib/async/stream_take_test.dart b/tests/lib/async/stream_take_test.dart index e7d8f70..cd237ce 100644 --- a/tests/lib/async/stream_take_test.dart +++ b/tests/lib/async/stream_take_test.dart
@@ -21,23 +21,26 @@ var c; int event = 0; bool canceled = false; - c = new StreamController(onListen: () { - new Timer.periodic(const Duration(milliseconds: 10), (t) { - if (canceled) { - t.cancel(); - return; - } - if (event == maxEvents) { - c.addError("NOT CANCELED IN TIME: $maxEvents"); - c.close(); - t.cancel(); - } else { - c.add(event++); - } - }); - }, onCancel: () { - canceled = true; - }); + c = new StreamController( + onListen: () { + new Timer.periodic(const Duration(milliseconds: 10), (t) { + if (canceled) { + t.cancel(); + return; + } + if (event == maxEvents) { + c.addError("NOT CANCELED IN TIME: $maxEvents"); + c.close(); + t.cancel(); + } else { + c.add(event++); + } + }); + }, + onCancel: () { + canceled = true; + }, + ); return c.stream; }
diff --git a/tests/lib/async/stream_timeout_test.dart b/tests/lib/async/stream_timeout_test.dart index 82ed41d..b58de28 100644 --- a/tests/lib/async/stream_timeout_test.dart +++ b/tests/lib/async/stream_timeout_test.dart
@@ -14,41 +14,56 @@ StreamController c = new StreamController(); Stream tos = c.stream.timeout(ms5); expect(tos.isBroadcast, false); - tos.handleError(expectAsync((e, s) { - expect(e, new isInstanceOf<TimeoutException>()); - expect(s, StackTrace.empty); - })).listen((v) { - fail("Unexpected event"); - }); + tos + .handleError( + expectAsync((e, s) { + expect(e, new isInstanceOf<TimeoutException>()); + expect(s, StackTrace.empty); + }), + ) + .listen((v) { + fail("Unexpected event"); + }); }); test("stream timeout add events", () { StreamController c = new StreamController(); - Stream tos = c.stream.timeout(ms5, onTimeout: (sink) { - sink.add(42); - sink.addError("ERROR"); - sink.close(); - }); + Stream tos = c.stream.timeout( + ms5, + onTimeout: (sink) { + sink.add(42); + sink.addError("ERROR"); + sink.close(); + }, + ); expect(tos.isBroadcast, false); - tos.listen(expectAsync((v) { - expect(v, 42); - }), onError: expectAsync((e, s) { - expect(e, "ERROR"); - }), onDone: expectAsync(() {})); + tos.listen( + expectAsync((v) { + expect(v, 42); + }), + onError: expectAsync((e, s) { + expect(e, "ERROR"); + }), + onDone: expectAsync(() {}), + ); }); test("stream no timeout", () { StreamController c = new StreamController(); Stream tos = c.stream.timeout(twoSecs); int ctr = 0; - tos.listen((v) { - expect(v, 42); - ctr++; - }, onError: (e, s) { - fail("No error expected"); - }, onDone: expectAsync(() { - expect(ctr, 2); - })); + tos.listen( + (v) { + expect(v, 42); + ctr++; + }, + onError: (e, s) { + fail("No error expected"); + }, + onDone: expectAsync(() { + expect(ctr, 2); + }), + ); expect(tos.isBroadcast, false); c ..add(42) @@ -61,13 +76,16 @@ Stream tos = c.stream.timeout(twoSecs); expect(tos.isBroadcast, false); int ctr = 0; - tos.listen((v) { - expect(v, 42); - ctr++; - }, onError: expectAsync((e, s) { - expect(ctr, 2); - expect(e, new isInstanceOf<TimeoutException>()); - })); + tos.listen( + (v) { + expect(v, 42); + ctr++; + }, + onError: expectAsync((e, s) { + expect(ctr, 2); + expect(e, new isInstanceOf<TimeoutException>()); + }), + ); c ..add(42) ..add(42); // No close, timeout after two events. @@ -77,52 +95,67 @@ StreamController c = new StreamController.broadcast(); Stream tos = c.stream.timeout(ms5); expect(tos.isBroadcast, true); - tos.handleError(expectAsync((e, s) { - expect(e, new isInstanceOf<TimeoutException>()); - expect(s, StackTrace.empty); - })).listen((v) { - fail("Unexpected event"); - }); + tos + .handleError( + expectAsync((e, s) { + expect(e, new isInstanceOf<TimeoutException>()); + expect(s, StackTrace.empty); + }), + ) + .listen((v) { + fail("Unexpected event"); + }); }); test("asBroadcast stream timeout", () { StreamController c = new StreamController.broadcast(); Stream tos = c.stream.asBroadcastStream().timeout(ms5); expect(tos.isBroadcast, true); - tos.handleError(expectAsync((e, s) { - expect(e, new isInstanceOf<TimeoutException>()); - expect(s, StackTrace.empty); - })).listen((v) { - fail("Unexpected event"); - }); + tos + .handleError( + expectAsync((e, s) { + expect(e, new isInstanceOf<TimeoutException>()); + expect(s, StackTrace.empty); + }), + ) + .listen((v) { + fail("Unexpected event"); + }); }); test("mapped stream timeout", () { StreamController c = new StreamController(); Stream tos = c.stream.map((x) => 2 * x).timeout(ms5); expect(tos.isBroadcast, false); - tos.handleError(expectAsync((e, s) { - expect(e, new isInstanceOf<TimeoutException>()); - expect(s, StackTrace.empty); - })).listen((v) { - fail("Unexpected event"); - }); + tos + .handleError( + expectAsync((e, s) { + expect(e, new isInstanceOf<TimeoutException>()); + expect(s, StackTrace.empty); + }), + ) + .listen((v) { + fail("Unexpected event"); + }); }); test("events prevent timeout", () { Stopwatch sw = new Stopwatch(); StreamController c = new StreamController(); - Stream tos = c.stream.timeout(twoSecs, onTimeout: (_) { - int elapsed = sw.elapsedMilliseconds; - if (elapsed > 250) { - // This should not happen, but it does occasionally. - // Starving the periodic timer has made the test useless. - print("Periodic timer of 5 ms delayed $elapsed ms."); - return; - } - fail("Timeout not prevented by events"); - throw "ERROR"; - }); + Stream tos = c.stream.timeout( + twoSecs, + onTimeout: (_) { + int elapsed = sw.elapsedMilliseconds; + if (elapsed > 250) { + // This should not happen, but it does occasionally. + // Starving the periodic timer has made the test useless. + print("Periodic timer of 5 ms delayed $elapsed ms."); + return; + } + fail("Timeout not prevented by events"); + throw "ERROR"; + }, + ); // Start the periodic timer before we start listening to the stream. // This should reduce the flakiness of the test. int ctr = 200; // send this many events at 5ms intervals. Then close. @@ -144,16 +177,19 @@ test("errors prevent timeout", () { Stopwatch sw = new Stopwatch(); StreamController c = new StreamController(); - Stream tos = c.stream.timeout(twoSecs, onTimeout: (_) { - int elapsed = sw.elapsedMilliseconds; - if (elapsed > 250) { - // This should not happen, but it does occasionally. - // Starving the periodic timer has made the test useless. - print("Periodic timer of 5 ms delayed $elapsed ms."); - return; - } - fail("Timeout not prevented by errors"); - }); + Stream tos = c.stream.timeout( + twoSecs, + onTimeout: (_) { + int elapsed = sw.elapsedMilliseconds; + if (elapsed > 250) { + // This should not happen, but it does occasionally. + // Starving the periodic timer has made the test useless. + print("Periodic timer of 5 ms delayed $elapsed ms."); + return; + } + fail("Timeout not prevented by errors"); + }, + ); // Start the periodic timer before we start listening to the stream. // This should reduce the flakiness of the test. @@ -168,25 +204,35 @@ }); sw.start(); - tos.listen((_) {}, onError: (e, s) { - expect(e, "ERROR"); - }, onDone: expectAsync(() {})); + tos.listen( + (_) {}, + onError: (e, s) { + expect(e, "ERROR"); + }, + onDone: expectAsync(() {}), + ); }); test("closing prevents timeout", () { StreamController c = new StreamController(); - Stream tos = c.stream.timeout(twoSecs, onTimeout: (_) { - fail("Timeout not prevented by close"); - }); + Stream tos = c.stream.timeout( + twoSecs, + onTimeout: (_) { + fail("Timeout not prevented by close"); + }, + ); tos.listen((_) {}, onDone: expectAsync(() {})); c.close(); }); test("pausing prevents timeout", () { StreamController c = new StreamController(); - Stream tos = c.stream.timeout(ms5, onTimeout: (_) { - fail("Timeout not prevented by close"); - }); + Stream tos = c.stream.timeout( + ms5, + onTimeout: (_) { + fail("Timeout not prevented by close"); + }, + ); var subscription = tos.listen((_) {}, onDone: expectAsync(() {})); subscription.pause(); new Timer(twoSecs, () {
diff --git a/tests/lib/async/stream_transform_test.dart b/tests/lib/async/stream_transform_test.dart index a2e7fb4..25dbeb3 100644 --- a/tests/lib/async/stream_transform_test.dart +++ b/tests/lib/async/stream_transform_test.dart
@@ -27,10 +27,13 @@ Events expected = new Events.fromIterable([10, 12]); Events input = new Events.fromIterable([1, 2, 3, 4, 5, 6, 7]); Events actual = new Events.capture( - c.stream.map((x) => x * 2).where((x) => x > 5).skip(2).take(2)); - actual.onDone(expectAsync(() { - Expect.listEquals(expected.events, actual.events); - })); + c.stream.map((x) => x * 2).where((x) => x > 5).skip(2).take(2), + ); + actual.onDone( + expectAsync(() { + Expect.listEquals(expected.events, actual.events); + }), + ); input.replay(c); }); @@ -39,10 +42,13 @@ Events expected = new Events.fromIterable([10, 12]); Events input = new Events.fromIterable([1, 2, 3, 4, 5, 6, 7]); Events actual = new Events.capture( - c.stream.map((x) => x * 2).where((x) => x > 5).skip(2).take(2)); - actual.onDone(expectAsync(() { - Expect.listEquals(expected.events, actual.events); - })); + c.stream.map((x) => x * 2).where((x) => x > 5).skip(2).take(2), + ); + actual.onDone( + expectAsync(() { + Expect.listEquals(expected.events, actual.events); + }), + ); actual.pause(); input.replay(c); actual.resume(); @@ -53,11 +59,15 @@ controller.stream .map((e) => e) .transform( - new StreamTransformer.fromHandlers(handleData: (element, sink) { - sink.add(element); - }, handleDone: (sink) { - sink.close(); - })) + new StreamTransformer.fromHandlers( + handleData: (element, sink) { + sink.add(element); + }, + handleDone: (sink) { + sink.close(); + }, + ), + ) .listen(expectAsync((e) => expect(e, equals("foo")))); controller.add("foo");
diff --git a/tests/lib/async/stream_transformation_broadcast_test.dart b/tests/lib/async/stream_transformation_broadcast_test.dart index d327a6d..012ee50 100644 --- a/tests/lib/async/stream_transformation_broadcast_test.dart +++ b/tests/lib/async/stream_transformation_broadcast_test.dart
@@ -15,23 +15,37 @@ main() { testStream("singlesub", () => new StreamController(), (c) => c.stream); testStream( - "broadcast", () => new StreamController.broadcast(), (c) => c.stream); - testStream("asBroadcast", () => new StreamController(), - (c) => c.stream.asBroadcastStream()); - testStream("broadcast.asBroadcast", () => new StreamController.broadcast(), - (c) => c.stream.asBroadcastStream()); + "broadcast", + () => new StreamController.broadcast(), + (c) => c.stream, + ); + testStream( + "asBroadcast", + () => new StreamController(), + (c) => c.stream.asBroadcastStream(), + ); + testStream( + "broadcast.asBroadcast", + () => new StreamController.broadcast(), + (c) => c.stream.asBroadcastStream(), + ); } void testStream( - String name, StreamController create(), Stream getStream(controller)) { + String name, + StreamController create(), + Stream getStream(controller), +) { test("$name-map", () { var c = create(); var s = getStream(c); Stream newStream = s.map((x) => x + 1); Expect.equals(s.isBroadcast, newStream.isBroadcast); - newStream.single.then(expectAsync((v) { - Expect.equals(43, v); - })); + newStream.single.then( + expectAsync((v) { + Expect.equals(43, v); + }), + ); c.add(42); c.close(); }); @@ -40,9 +54,11 @@ var s = getStream(c); Stream newStream = s.where((x) => x.isEven); Expect.equals(s.isBroadcast, newStream.isBroadcast); - newStream.single.then(expectAsync((v) { - Expect.equals(42, v); - })); + newStream.single.then( + expectAsync((v) { + Expect.equals(42, v); + }), + ); c.add(37); c.add(42); c.add(87); @@ -53,9 +69,11 @@ var s = getStream(c); Stream newStream = s.handleError((x, s) {}); Expect.equals(s.isBroadcast, newStream.isBroadcast); - newStream.single.then(expectAsync((v) { - Expect.equals(42, v); - })); + newStream.single.then( + expectAsync((v) { + Expect.equals(42, v); + }), + ); c.addError("BAD1"); c.add(42); c.addError("BAD2"); @@ -66,9 +84,11 @@ var s = getStream(c); Stream newStream = s.expand((x) => x.isEven ? [x] : []); Expect.equals(s.isBroadcast, newStream.isBroadcast); - newStream.single.then(expectAsync((v) { - Expect.equals(42, v); - })); + newStream.single.then( + expectAsync((v) { + Expect.equals(42, v); + }), + ); c.add(37); c.add(42); c.add(87); @@ -78,15 +98,18 @@ var c = create(); var s = getStream(c); // TODO: find name of default transformer - var t = - new StreamTransformer.fromHandlers(handleData: (value, EventSink sink) { - sink.add(value); - }); + var t = new StreamTransformer.fromHandlers( + handleData: (value, EventSink sink) { + sink.add(value); + }, + ); Stream newStream = s.transform(t); Expect.equals(s.isBroadcast, newStream.isBroadcast); - newStream.single.then(expectAsync((v) { - Expect.equals(42, v); - })); + newStream.single.then( + expectAsync((v) { + Expect.equals(42, v); + }), + ); c.add(42); c.close(); }); @@ -95,9 +118,11 @@ var s = getStream(c); Stream newStream = s.take(1); Expect.equals(s.isBroadcast, newStream.isBroadcast); - newStream.single.then(expectAsync((v) { - Expect.equals(42, v); - })); + newStream.single.then( + expectAsync((v) { + Expect.equals(42, v); + }), + ); c.add(42); c.add(37); c.close(); @@ -107,9 +132,11 @@ var s = getStream(c); Stream newStream = s.takeWhile((x) => x.isEven); Expect.equals(s.isBroadcast, newStream.isBroadcast); - newStream.single.then(expectAsync((v) { - Expect.equals(42, v); - })); + newStream.single.then( + expectAsync((v) { + Expect.equals(42, v); + }), + ); c.add(42); c.add(37); c.close(); @@ -119,9 +146,11 @@ var s = getStream(c); Stream newStream = s.skip(1); Expect.equals(s.isBroadcast, newStream.isBroadcast); - newStream.single.then(expectAsync((v) { - Expect.equals(42, v); - })); + newStream.single.then( + expectAsync((v) { + Expect.equals(42, v); + }), + ); c.add(37); c.add(42); c.close(); @@ -131,9 +160,11 @@ var s = getStream(c); Stream newStream = s.skipWhile((x) => x.isOdd); Expect.equals(s.isBroadcast, newStream.isBroadcast); - newStream.single.then(expectAsync((v) { - Expect.equals(42, v); - })); + newStream.single.then( + expectAsync((v) { + Expect.equals(42, v); + }), + ); c.add(37); c.add(42); c.close(); @@ -143,9 +174,11 @@ var s = getStream(c); Stream newStream = s.distinct(); Expect.equals(s.isBroadcast, newStream.isBroadcast); - newStream.single.then(expectAsync((v) { - Expect.equals(42, v); - })); + newStream.single.then( + expectAsync((v) { + Expect.equals(42, v); + }), + ); c.add(42); c.add(42); c.close(); @@ -155,9 +188,11 @@ var s = getStream(c); Stream newStream = s.timeout(const Duration(seconds: 1)); Expect.equals(s.isBroadcast, newStream.isBroadcast); - newStream.single.then(expectAsync((v) { - Expect.equals(42, v); - })); + newStream.single.then( + expectAsync((v) { + Expect.equals(42, v); + }), + ); c.add(42); c.close(); }); @@ -166,9 +201,11 @@ var s = getStream(c); Stream newStream = s.asyncMap((x) => new Future.value(x + 1)); Expect.equals(s.isBroadcast, newStream.isBroadcast); - newStream.single.then(expectAsync((v) { - Expect.equals(43, v); - })); + newStream.single.then( + expectAsync((v) { + Expect.equals(43, v); + }), + ); c.add(42); c.close(); }); @@ -177,9 +214,11 @@ var s = getStream(c); Stream newStream = s.asyncExpand((x) => new Stream.fromIterable([x + 1])); Expect.equals(s.isBroadcast, newStream.isBroadcast); - newStream.single.then(expectAsync((v) { - Expect.equals(43, v); - })); + newStream.single.then( + expectAsync((v) { + Expect.equals(43, v); + }), + ); c.add(42); c.close(); });
diff --git a/tests/lib/async/stream_transformer_from_bind_test.dart b/tests/lib/async/stream_transformer_from_bind_test.dart index 0942d54..225164e 100644 --- a/tests/lib/async/stream_transformer_from_bind_test.dart +++ b/tests/lib/async/stream_transformer_from_bind_test.dart
@@ -11,8 +11,9 @@ void main() { asyncStart(); - var transformer = - new StreamTransformer<int, String>.fromBind((s) => s.map((v) => '$v')); + var transformer = new StreamTransformer<int, String>.fromBind( + (s) => s.map((v) => '$v'), + ); var controller = new StreamController<int>(sync: true); Events expected = new Events.fromIterable(['1', '2']); Events input = new Events.fromIterable([1, 2]);
diff --git a/tests/lib/async/stream_transformer_from_handlers_test.dart b/tests/lib/async/stream_transformer_from_handlers_test.dart index e78cf18..f75cb4e1 100644 --- a/tests/lib/async/stream_transformer_from_handlers_test.dart +++ b/tests/lib/async/stream_transformer_from_handlers_test.dart
@@ -34,27 +34,38 @@ var stackTrace = currentStackTrace; var events = []; var controller; - controller = new StreamController<int>(onListen: () { - controller.add(499); - controller.addError(42, stackTrace); - controller.close(); - }); + controller = new StreamController<int>( + onListen: () { + controller.add(499); + controller.addError(42, stackTrace); + controller.close(); + }, + ); controller.stream - .transform(new StreamTransformer<int, String>.fromHandlers( + .transform( + new StreamTransformer<int, String>.fromHandlers( handleData: (int data, EventSink<String> sink) { - sink.add(data.toString()); - }, handleError: (e, st, EventSink<String> sink) { - sink.add(e.toString()); - sink.addError(e, st); - }, handleDone: (EventSink<String> sink) { - sink.add("done"); - sink.close(); - })) - .listen((data) => events.add(data), onError: (e, st) { - events.add(e); - events.add(st); - }, onDone: () { - Expect.listEquals(["499", "42", 42, stackTrace, "done"], events); - delayCycles(asyncEnd, 3); - }); + sink.add(data.toString()); + }, + handleError: (e, st, EventSink<String> sink) { + sink.add(e.toString()); + sink.addError(e, st); + }, + handleDone: (EventSink<String> sink) { + sink.add("done"); + sink.close(); + }, + ), + ) + .listen( + (data) => events.add(data), + onError: (e, st) { + events.add(e); + events.add(st); + }, + onDone: () { + Expect.listEquals(["499", "42", 42, stackTrace, "done"], events); + delayCycles(asyncEnd, 3); + }, + ); }
diff --git a/tests/lib/async/stream_transformer_test.dart b/tests/lib/async/stream_transformer_test.dart index c6ad4d8..eba448a 100644 --- a/tests/lib/async/stream_transformer_test.dart +++ b/tests/lib/async/stream_transformer_test.dart
@@ -41,8 +41,8 @@ main() { var transformer = new StreamTransformer<int, String>( - (stream, cancelOnError) => - new MyStreamSubscription(stream, cancelOnError)); + (stream, cancelOnError) => new MyStreamSubscription(stream, cancelOnError), + ); var controller = new StreamController<int>(sync: true); var stream = controller.stream; @@ -55,7 +55,8 @@ var handleDone = () => 99; MyStreamSubscription<String> subscription = - transformed.listen(handleData, onError: handleError, onDone: handleDone) as MyStreamSubscription<String>; + transformed.listen(handleData, onError: handleError, onDone: handleDone) + as MyStreamSubscription<String>; Expect.identical(stream, subscription.stream); Expect.equals(false, subscription.cancelOnError); @@ -80,7 +81,8 @@ stream = controller.stream; transformed = stream.transform(transformer); subscription = - transformed.listen(null, onDone: handleDone, cancelOnError: true) as MyStreamSubscription<String>; + transformed.listen(null, onDone: handleDone, cancelOnError: true) + as MyStreamSubscription<String>; Expect.identical(stream, subscription.stream); Expect.equals(true, subscription.cancelOnError); @@ -93,7 +95,8 @@ transformed = stream.transform(transformer); Expect.isTrue(transformed.isBroadcast); subscription = - transformed.listen(null, onDone: handleDone, cancelOnError: true) as MyStreamSubscription<String>; + transformed.listen(null, onDone: handleDone, cancelOnError: true) + as MyStreamSubscription<String>; Expect.identical(stream, subscription.stream); Expect.equals(true, subscription.cancelOnError);
diff --git a/tests/lib/async/stream_type_test.dart b/tests/lib/async/stream_type_test.dart index f13f0f3..1b6ed74 100644 --- a/tests/lib/async/stream_type_test.dart +++ b/tests/lib/async/stream_type_test.dart
@@ -56,11 +56,17 @@ testIntStream(() => stream().distinct(f), "$name.distinct", n); testIntStream(() => stream().handleError(f), "$name.handleError", n); testIntStream( - () => stream().asBroadcastStream(), "$name.asBroadcastStream", n); + () => stream().asBroadcastStream(), + "$name.asBroadcastStream", + n, + ); } } testIntStream(() => new StreamController<int>().stream, "Stream<int>", 3); - testIntStream(() => new StreamController<int>.broadcast().stream, - "BroadcastStream<int>", 3); + testIntStream( + () => new StreamController<int>.broadcast().stream, + "BroadcastStream<int>", + 3, + ); }
diff --git a/tests/lib/async/stream_value_test.dart b/tests/lib/async/stream_value_test.dart index 993efec..e1d4738 100644 --- a/tests/lib/async/stream_value_test.dart +++ b/tests/lib/async/stream_value_test.dart
@@ -53,12 +53,15 @@ var stream = Stream<int>.value(42); var value; var onDone = Completer(); - var sub = stream.listen((v) { - value = v; - }, onDone: () { - Expect.equals(42, value); - onDone.complete(); - }); + var sub = stream.listen( + (v) { + value = v; + }, + onDone: () { + Expect.equals(42, value); + onDone.complete(); + }, + ); sub.pause(); await Future.delayed(Duration(milliseconds: 10)); Expect.isNull(value);
diff --git a/tests/lib/async/stream_view_test.dart b/tests/lib/async/stream_view_test.dart index 5414844..700ba34 100644 --- a/tests/lib/async/stream_view_test.dart +++ b/tests/lib/async/stream_view_test.dart
@@ -29,8 +29,11 @@ Stream<int> s = const StreamView<int>(const Stream<int>.empty()); Expect.isFalse(s is Stream<String>); // Respects type parameter. - StreamSubscription<int> sub = - s.listen(unreachable, onError: unreachable, onDone: ticker); + StreamSubscription<int> sub = s.listen( + unreachable, + onError: unreachable, + onDone: ticker, + ); Expect.isFalse(sub is StreamSubscription<String>); // Type parameter in sub. Stream iterableStream = new Stream.fromIterable([1, 2, 3]);
diff --git a/tests/lib/async/stream_zones_test.dart b/tests/lib/async/stream_zones_test.dart index b636be1..53280121 100644 --- a/tests/lib/async/stream_zones_test.dart +++ b/tests/lib/async/stream_zones_test.dart
@@ -14,9 +14,11 @@ runZonedGuarded(() { runZonedGuarded(() { var c = new StreamController(); - c.stream.listen((x) => events.add("stream: $x"), - onError: (x) => events.add("stream: error $x"), - onDone: done.complete); + c.stream.listen( + (x) => events.add("stream: $x"), + onError: (x) => events.add("stream: error $x"), + onDone: done.complete, + ); c.add(1); c.addError(2); c.close(); @@ -26,7 +28,7 @@ done.future, () { Expect.listEquals(["stream: 1", "stream: error 2"], events); - } + }, ]; } @@ -38,9 +40,11 @@ var c; runZonedGuarded(() { c = new StreamController(); - c.stream.listen((x) => events.add("stream: $x"), - onError: (x) => events.add("stream: error $x"), - onDone: done.complete); + c.stream.listen( + (x) => events.add("stream: $x"), + onError: (x) => events.add("stream: error $x"), + onDone: done.complete, + ); }, (e, s) => events.add("rza: error $e")); c.add(1); c.addError(2); @@ -50,7 +54,7 @@ done.future, () { Expect.listEquals(["stream: 1", "stream: error 2"], events); - } + }, ]; } @@ -60,8 +64,11 @@ var done = new Completer(); runZonedGuarded(() { var c = new StreamController(); - c.stream.listen((x) => events.add("stream: $x"), - onError: (x) => events.add("stream: error $x"), onDone: done.complete); + c.stream.listen( + (x) => events.add("stream: $x"), + onError: (x) => events.add("stream: error $x"), + onDone: done.complete, + ); runZonedGuarded(() { c.add(1); c.addError(2); @@ -72,7 +79,7 @@ done.future, () { Expect.listEquals(["stream: 1", "stream: error 2"], events); - } + }, ]; } @@ -82,8 +89,11 @@ var done = new Completer(); runZonedGuarded(() { var c = new StreamController(); - c.stream.listen((x) => events.add("stream: $x"), - onError: (x) => events.add("stream: error $x"), onDone: done.complete); + c.stream.listen( + (x) => events.add("stream: $x"), + onError: (x) => events.add("stream: error $x"), + onDone: done.complete, + ); runZonedGuarded(() { var c2 = new StreamController(); c.addStream(c2.stream).whenComplete(c.close); @@ -96,7 +106,7 @@ done.future, () { Expect.listEquals(["stream: 1", "stream: error 2"], events); - } + }, ]; } @@ -109,9 +119,11 @@ var c; runZonedGuarded(() { c = new StreamController(); - c.stream.listen((x) => events.add("stream: $x"), - onError: (x) => events.add("stream: error $x"), - onDone: done.complete); + c.stream.listen( + (x) => events.add("stream: $x"), + onError: (x) => events.add("stream: error $x"), + onDone: done.complete, + ); }, (e, s) => events.add("rza: error $e")); var c2 = new StreamController(); c.addStream(c2.stream).whenComplete(c.close); @@ -123,7 +135,7 @@ done.future, () { Expect.listEquals(["stream: 1", "stream: error 2"], events); - } + }, ]; } @@ -133,8 +145,11 @@ var c; runZonedGuarded(() { c = new StreamController(); - c.stream.listen((x) => events.add("stream: $x"), - onError: (x) => events.add("stream: error $x"), onDone: done.complete); + c.stream.listen( + (x) => events.add("stream: $x"), + onError: (x) => events.add("stream: error $x"), + onDone: done.complete, + ); }, (e, s) => events.add("rza: error $e")); runZonedGuarded(() { var c2 = new StreamController(); @@ -147,7 +162,7 @@ done.future, () { Expect.listEquals(["stream: 1", "stream: error 2"], events); - } + }, ]; } @@ -158,8 +173,11 @@ var c; runZonedGuarded(() { c = new StreamController(); - c.stream.listen((x) => events.add("stream: $x"), - onError: (x) => events.add("stream: error $x"), onDone: done.complete); + c.stream.listen( + (x) => events.add("stream: $x"), + onError: (x) => events.add("stream: error $x"), + onDone: done.complete, + ); }, (e, s) => events.add("rza: error $e")); runZonedGuarded(() { c.add(1); @@ -170,22 +188,14 @@ done.future, () { Expect.listEquals(["stream: 1", "stream: error 2"], events); - } + }, ]; } main() { asyncStart(); - var tests = [ - test1(), - test2(), - test3(), - test4(), - test5(), - test6(), - test7(), - ]; + var tests = [test1(), test2(), test3(), test4(), test5(), test6(), test7()]; Future.wait(tests.map((l) => l.first as Future)).then((_) { // Give time to complete all pending actions.
diff --git a/tests/lib/async/timer_cancel1_test.dart b/tests/lib/async/timer_cancel1_test.dart index 05b5ff6..d7fa1ca 100644 --- a/tests/lib/async/timer_cancel1_test.dart +++ b/tests/lib/async/timer_cancel1_test.dart
@@ -22,9 +22,13 @@ canceleeTimer.cancel(); } - cancelerTimer = - new Timer(const Duration(milliseconds: 1), expectAsync(handler)); + cancelerTimer = new Timer( + const Duration(milliseconds: 1), + expectAsync(handler), + ); canceleeTimer = new Timer( - const Duration(milliseconds: 1000), expectAsync(unreachable, count: 0)); + const Duration(milliseconds: 1000), + expectAsync(unreachable, count: 0), + ); }); }
diff --git a/tests/lib/async/timer_cancel2_test.dart b/tests/lib/async/timer_cancel2_test.dart index 7b3d0e2..b51e397 100644 --- a/tests/lib/async/timer_cancel2_test.dart +++ b/tests/lib/async/timer_cancel2_test.dart
@@ -18,7 +18,9 @@ completer.complete(); } - cancelTimer = - new Timer.periodic(const Duration(milliseconds: 1), cancelHandler); + cancelTimer = new Timer.periodic( + const Duration(milliseconds: 1), + cancelHandler, + ); return completer.future; }
diff --git a/tests/lib/async/timer_isActive_test.dart b/tests/lib/async/timer_isActive_test.dart index b9b09a5..6493dc3 100644 --- a/tests/lib/async/timer_isActive_test.dart +++ b/tests/lib/async/timer_isActive_test.dart
@@ -10,8 +10,10 @@ test("timer isActive test", () { late Timer t; - t = new Timer(const Duration(seconds: 1), - expectAsync0(() => expect(t.isActive, equals(false)))); + t = new Timer( + const Duration(seconds: 1), + expectAsync0(() => expect(t.isActive, equals(false))), + ); expect(t.isActive, equals(true)); }); @@ -29,17 +31,23 @@ } t = new Timer.periodic( - new Duration(milliseconds: 1), expectAsync1(checkActive, count: 3)); + new Duration(milliseconds: 1), + expectAsync1(checkActive, count: 3), + ); expect(t.isActive, equals(true)); }); test("timer cancel test", () { Timer timer = new Timer( - const Duration(seconds: 15), () => fail("Should not be reached.")); - Timer.run(expectAsync0(() { - expect(timer.isActive, equals(true)); - timer.cancel(); - expect(timer.isActive, equals(false)); - })); + const Duration(seconds: 15), + () => fail("Should not be reached."), + ); + Timer.run( + expectAsync0(() { + expect(timer.isActive, equals(true)); + timer.cancel(); + expect(timer.isActive, equals(false)); + }), + ); }); }
diff --git a/tests/lib/async/timer_repeat_test.dart b/tests/lib/async/timer_repeat_test.dart index b62c7fe..dcf178a 100644 --- a/tests/lib/async/timer_repeat_test.dart +++ b/tests/lib/async/timer_repeat_test.dart
@@ -30,8 +30,10 @@ // certain amount of time to have passed. Checking the time on // each iteration doesn't work because the timeoutHandler runs // concurrently with the periodic timer. - Expect.isTrue(stopwatch.elapsedMilliseconds + safetyMargin >= - ITERATIONS * TIMEOUT.inMilliseconds); + Expect.isTrue( + stopwatch.elapsedMilliseconds + safetyMargin >= + ITERATIONS * TIMEOUT.inMilliseconds, + ); timer.cancel(); completer.complete(); }
diff --git a/tests/lib/async/timer_test.dart b/tests/lib/async/timer_test.dart index e322368..dc90426 100644 --- a/tests/lib/async/timer_test.dart +++ b/tests/lib/async/timer_test.dart
@@ -22,8 +22,10 @@ int get safetyMargin => identical(1, 1.0) ? 100 : 0; void timeoutHandler() { - expect(stopwatch.elapsedMilliseconds + safetyMargin, - greaterThanOrEqualTo(timeout)); + expect( + stopwatch.elapsedMilliseconds + safetyMargin, + greaterThanOrEqualTo(timeout), + ); if (iteration < ITERATIONS) { iteration++; timeout = timeout - DECREASE;
diff --git a/tests/lib/async/unawaited_error_test.dart b/tests/lib/async/unawaited_error_test.dart index c1eecb8..0ec67c0 100644 --- a/tests/lib/async/unawaited_error_test.dart +++ b/tests/lib/async/unawaited_error_test.dart
@@ -5,7 +5,7 @@ void main() { // The `unawaited` function is not exposed by dart:core. unawaited; -//^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Undefined name 'unawaited'. + // [error column 3, length 9] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Undefined name 'unawaited'. }
diff --git a/tests/lib/async/unawaited_test.dart b/tests/lib/async/unawaited_test.dart index 53d1750..ce78385 100644 --- a/tests/lib/async/unawaited_test.dart +++ b/tests/lib/async/unawaited_test.dart
@@ -41,15 +41,18 @@ // Unawaited futures are still uncaught errors. { asyncStart(); - runZonedGuarded(() { - var c = Completer<int>(); - var f = c.future; - unawaited(f); - c.completeError("ERROR2"); - }, (e, s) { - Expect.equals("ERROR2", e); - asyncEnd(); - }); + runZonedGuarded( + () { + var c = Completer<int>(); + var f = c.future; + unawaited(f); + c.completeError("ERROR2"); + }, + (e, s) { + Expect.equals("ERROR2", e); + asyncEnd(); + }, + ); } asyncEnd(); }
diff --git a/tests/lib/async/uncaught_error_handler_throws_test.dart b/tests/lib/async/uncaught_error_handler_throws_test.dart index ce7251f..a92213e 100644 --- a/tests/lib/async/uncaught_error_handler_throws_test.dart +++ b/tests/lib/async/uncaught_error_handler_throws_test.dart
@@ -18,22 +18,26 @@ var object1 = Object(); var stack1 = StackTrace.current; var outerZone = Zone.current; - var firstZone = Zone.current.fork(specification: onError((error, stack) { - // Uncaught error handlers run in the parent zone. - Expect.identical(outerZone, Zone.current); - Expect.identical(object1, error); - Expect.identical(stack1, stack); // Get same stack trace. - asyncEnd(); - })); + var firstZone = Zone.current.fork( + specification: onError((error, stack) { + // Uncaught error handlers run in the parent zone. + Expect.identical(outerZone, Zone.current); + Expect.identical(object1, error); + Expect.identical(stack1, stack); // Get same stack trace. + asyncEnd(); + }), + ); firstZone.run(() async { Expect.identical(firstZone, Zone.current); - var secondZone = Zone.current.fork(specification: onError((error, stack) { - // Uncaught error handlers run in the parent zone. - Expect.identical(firstZone, Zone.current); - Expect.identical(object1, error); - Expect.identical(stack1, stack); - throw error; // Throw same object - })); + var secondZone = Zone.current.fork( + specification: onError((error, stack) { + // Uncaught error handlers run in the parent zone. + Expect.identical(firstZone, Zone.current); + Expect.identical(object1, error); + Expect.identical(stack1, stack); + throw error; // Throw same object + }), + ); secondZone.run(() async { Expect.identical(secondZone, Zone.current); Future.error(object1, stack1); // Unhandled async error. @@ -48,20 +52,24 @@ var object2 = Object(); var stack1 = StackTrace.current; var outerZone = Zone.current; - var firstZone = Zone.current.fork(specification: onError((error, stack) { - Expect.identical(outerZone, Zone.current); - Expect.identical(object2, error); - Expect.notIdentical(stack1, stack); // Get different stack trace. - asyncEnd(); - })); + var firstZone = Zone.current.fork( + specification: onError((error, stack) { + Expect.identical(outerZone, Zone.current); + Expect.identical(object2, error); + Expect.notIdentical(stack1, stack); // Get different stack trace. + asyncEnd(); + }), + ); firstZone.run(() async { Expect.identical(firstZone, Zone.current); - var secondZone = Zone.current.fork(specification: onError((error, stack) { - Expect.identical(firstZone, Zone.current); - Expect.identical(object1, error); - Expect.identical(stack1, stack); - throw object2; // Throw different object - })); + var secondZone = Zone.current.fork( + specification: onError((error, stack) { + Expect.identical(firstZone, Zone.current); + Expect.identical(object1, error); + Expect.identical(stack1, stack); + throw object2; // Throw different object + }), + ); secondZone.run(() async { Expect.identical(secondZone, Zone.current); Future.error(object1, stack1); // Unhandled async error. @@ -72,5 +80,6 @@ ZoneSpecification onError(void Function(Object, StackTrace) handler) { return ZoneSpecification( - handleUncaughtError: (s, p, z, e, st) => handler(e, st)); + handleUncaughtError: (s, p, z, e, st) => handler(e, st), + ); }
diff --git a/tests/lib/async/wait_for_cancel_test.dart b/tests/lib/async/wait_for_cancel_test.dart index adc49c0..2680707 100644 --- a/tests/lib/async/wait_for_cancel_test.dart +++ b/tests/lib/async/wait_for_cancel_test.dart
@@ -12,7 +12,8 @@ bool waitedForCancel = false; var controller = new StreamController( - onCancel: () => new Future(() => waitedForCancel = true)); + onCancel: () => new Future(() => waitedForCancel = true), + ); var sub = controller.stream.take(1).listen((x) { Expect.fail("onData should not be called"); });
diff --git a/tests/lib/async/zone_bind_callback_test.dart b/tests/lib/async/zone_bind_callback_test.dart index 3c07b26..8a0f22a 100644 --- a/tests/lib/async/zone_bind_callback_test.dart +++ b/tests/lib/async/zone_bind_callback_test.dart
@@ -13,19 +13,21 @@ var restoredValue; Expect.identical(Zone.root, Zone.current); - Zone forked = Zone.current.fork(specification: new ZoneSpecification( - registerCallback: - <R>(Zone self, ZoneDelegate parent, Zone origin, R f()) { - // The zone is still the same as when origin.run was invoked, which - // is the root zone. (The origin zone hasn't been set yet). - Expect.identical(Zone.current, Zone.root); - // Note that not forwarding is completely legal, though not encouraged. - var capturedValue = valueToCapture; - return parent.registerCallback(origin, () { - restoredValue = capturedValue; - return f(); - }); - })); + Zone forked = Zone.current.fork( + specification: new ZoneSpecification( + registerCallback: <R>(Zone self, ZoneDelegate parent, Zone origin, R f()) { + // The zone is still the same as when origin.run was invoked, which + // is the root zone. (The origin zone hasn't been set yet). + Expect.identical(Zone.current, Zone.root); + // Note that not forwarding is completely legal, though not encouraged. + var capturedValue = valueToCapture; + return parent.registerCallback(origin, () { + restoredValue = capturedValue; + return f(); + }); + }, + ), + ); valueToCapture = 499; var fun = () {
diff --git a/tests/lib/async/zone_bind_callback_unary_test.dart b/tests/lib/async/zone_bind_callback_unary_test.dart index 64a170f..691d13f 100644 --- a/tests/lib/async/zone_bind_callback_unary_test.dart +++ b/tests/lib/async/zone_bind_callback_unary_test.dart
@@ -13,19 +13,22 @@ var restoredValue; Expect.identical(Zone.root, Zone.current); - Zone forked = Zone.current.fork(specification: new ZoneSpecification( + Zone forked = Zone.current.fork( + specification: new ZoneSpecification( registerUnaryCallback: <R, T>(Zone self, ZoneDelegate parent, Zone origin, R f(T arg)) { - // The zone is still the same as when origin.run was invoked, which - // is the root zone. (The origin zone hasn't been set yet). - Expect.identical(Zone.current, Zone.root); - // Note that not forwarding is completely legal, though not encouraged. - var capturedValue = valueToCapture; - return parent.registerUnaryCallback(origin, (arg) { - restoredValue = capturedValue; - return f(arg); - }); - })); + // The zone is still the same as when origin.run was invoked, which + // is the root zone. (The origin zone hasn't been set yet). + Expect.identical(Zone.current, Zone.root); + // Note that not forwarding is completely legal, though not encouraged. + var capturedValue = valueToCapture; + return parent.registerUnaryCallback(origin, (arg) { + restoredValue = capturedValue; + return f(arg); + }); + }, + ), + ); valueToCapture = 499; var fun = (x) {
diff --git a/tests/lib/async/zone_create_periodic_timer_test.dart b/tests/lib/async/zone_create_periodic_timer_test.dart index 973e6d5..226a2f7 100644 --- a/tests/lib/async/zone_create_periodic_timer_test.dart +++ b/tests/lib/async/zone_create_periodic_timer_test.dart
@@ -12,15 +12,24 @@ Expect.identical(Zone.root, Zone.current); Zone forked; - forked = Zone.current.fork(specification: new ZoneSpecification( - createPeriodicTimer: (Zone self, ZoneDelegate parent, Zone origin, - Duration period, f(Timer timer)) { - events.add("forked.createPeriodicTimer"); - return parent.createPeriodicTimer(origin, period, (Timer timer) { - events.add("wrapped function ${period.inMilliseconds}"); - f(timer); - }); - })); + forked = Zone.current.fork( + specification: new ZoneSpecification( + createPeriodicTimer: + ( + Zone self, + ZoneDelegate parent, + Zone origin, + Duration period, + f(Timer timer), + ) { + events.add("forked.createPeriodicTimer"); + return parent.createPeriodicTimer(origin, period, (Timer timer) { + events.add("wrapped function ${period.inMilliseconds}"); + f(timer); + }); + }, + ), + ); asyncStart(); int tickCount = 0; @@ -51,7 +60,7 @@ "wrapped function 5", "periodic Timer 2", "wrapped function 5", - "periodic Timer 3" + "periodic Timer 3", ], events); asyncEnd(); });
diff --git a/tests/lib/async/zone_create_timer2_test.dart b/tests/lib/async/zone_create_timer2_test.dart index 3c42c51..f2108cf 100644 --- a/tests/lib/async/zone_create_timer2_test.dart +++ b/tests/lib/async/zone_create_timer2_test.dart
@@ -12,14 +12,24 @@ Expect.identical(Zone.root, Zone.current); Zone forked; - forked = Zone.current.fork(specification: new ZoneSpecification(createTimer: - (Zone self, ZoneDelegate parent, Zone origin, Duration duration, f()) { - events.add("forked.createTimer"); - return parent.createTimer(origin, duration, () { - events.add("wrapped function ${duration.inMilliseconds}"); - f(); - }); - })); + forked = Zone.current.fork( + specification: new ZoneSpecification( + createTimer: + ( + Zone self, + ZoneDelegate parent, + Zone origin, + Duration duration, + f(), + ) { + events.add("forked.createTimer"); + return parent.createTimer(origin, duration, () { + events.add("wrapped function ${duration.inMilliseconds}"); + f(); + }); + }, + ), + ); asyncStart(); forked.run(() { @@ -38,7 +48,7 @@ "forked.createTimer", "after createTimer", "wrapped function 20", - "createTimer" + "createTimer", ], events); asyncEnd(); });
diff --git a/tests/lib/async/zone_create_timer_test.dart b/tests/lib/async/zone_create_timer_test.dart index 5053912..4d4bcf05 100644 --- a/tests/lib/async/zone_create_timer_test.dart +++ b/tests/lib/async/zone_create_timer_test.dart
@@ -12,14 +12,24 @@ Expect.identical(Zone.root, Zone.current); Zone forked; - forked = Zone.current.fork(specification: new ZoneSpecification(createTimer: - (Zone self, ZoneDelegate parent, Zone origin, Duration duration, f()) { - events.add("forked.createTimer"); - return parent.createTimer(origin, duration, () { - events.add("wrapped function ${duration.inMilliseconds}"); - f(); - }); - })); + forked = Zone.current.fork( + specification: new ZoneSpecification( + createTimer: + ( + Zone self, + ZoneDelegate parent, + Zone origin, + Duration duration, + f(), + ) { + events.add("forked.createTimer"); + return parent.createTimer(origin, duration, () { + events.add("wrapped function ${duration.inMilliseconds}"); + f(); + }); + }, + ), + ); asyncStart(); forked.run(() { @@ -38,7 +48,7 @@ "forked.createTimer", "after createTimer", "wrapped function 0", - "createTimer" + "createTimer", ], events); asyncEnd(); });
diff --git a/tests/lib/async/zone_debug_test.dart b/tests/lib/async/zone_debug_test.dart index a966546..51a8ac1 100644 --- a/tests/lib/async/zone_debug_test.dart +++ b/tests/lib/async/zone_debug_test.dart
@@ -16,7 +16,11 @@ List events = []; ZoneCallback<R> debugZoneRegisterCallback<R>( - Zone self, ZoneDelegate parent, Zone origin, R f()) { + Zone self, + ZoneDelegate parent, + Zone origin, + R f(), +) { List savedTrace = [stackTrace]..addAll(restoredStackTrace); return parent.registerCallback(origin, () { restoredStackTrace = savedTrace; @@ -25,7 +29,11 @@ } ZoneUnaryCallback<R, T> debugZoneRegisterUnaryCallback<R, T>( - Zone self, ZoneDelegate parent, Zone origin, R f(T arg)) { + Zone self, + ZoneDelegate parent, + Zone origin, + R f(T arg), +) { List savedTrace = [stackTrace]..addAll(restoredStackTrace); return parent.registerUnaryCallback(origin, (arg) { restoredStackTrace = savedTrace; @@ -40,7 +48,12 @@ } R debugZoneRunUnary<R, T>( - Zone self, ZoneDelegate parent, Zone origin, R f(T arg), T arg) { + Zone self, + ZoneDelegate parent, + Zone origin, + R f(T arg), + T arg, +) { stackTrace++; restoredStackTrace = []; return parent.runUnary(origin, f, arg); @@ -48,19 +61,25 @@ late List expectedDebugTrace; -void debugUncaughtHandler(Zone self, ZoneDelegate parent, Zone origin, error, - StackTrace? stackTrace) { +void debugUncaughtHandler( + Zone self, + ZoneDelegate parent, + Zone origin, + error, + StackTrace? stackTrace, +) { events.add("handling uncaught error $error"); Expect.listEquals(expectedDebugTrace, restoredStackTrace); // Suppress the error and don't propagate to parent. } const DEBUG_SPECIFICATION = const ZoneSpecification( - registerCallback: debugZoneRegisterCallback, - registerUnaryCallback: debugZoneRegisterUnaryCallback, - run: debugZoneRun, - runUnary: debugZoneRunUnary, - handleUncaughtError: debugUncaughtHandler); + registerCallback: debugZoneRegisterCallback, + registerUnaryCallback: debugZoneRegisterUnaryCallback, + run: debugZoneRun, + runUnary: debugZoneRunUnary, + handleUncaughtError: debugUncaughtHandler, +); main() { Completer done = new Completer(); @@ -128,7 +147,7 @@ Expect.listEquals([ "handling uncaught error bar", "handling uncaught error foo", - "handling uncaught error gee" + "handling uncaught error gee", ], events); asyncEnd(); });
diff --git a/tests/lib/async/zone_error_callback_test.dart b/tests/lib/async/zone_error_callback_test.dart index b59c139..db209ee 100644 --- a/tests/lib/async/zone_error_callback_test.dart +++ b/tests/lib/async/zone_error_callback_test.dart
@@ -105,18 +105,22 @@ { asyncStart(); StreamController controller = new StreamController(); - controller.stream - .asBroadcastStream() - .listen(null, onError: expectError, cancelOnError: true); + controller.stream.asBroadcastStream().listen( + null, + onError: expectError, + cancelOnError: true, + ); controller.addError(error1, stack1); } { asyncStart(); StreamController controller = new StreamController(sync: true); - controller.stream - .asBroadcastStream() - .listen(null, onError: expectError, cancelOnError: true); + controller.stream.asBroadcastStream().listen( + null, + onError: expectError, + cancelOnError: true, + ); controller.addError(error1, stack1); } @@ -229,16 +233,18 @@ { asyncStart(); StreamController controller = new StreamController(); - Future<bool?>.value(controller.stream.every((x) => throw error1)) - .catchError(expectErrorOnly); + Future<bool?>.value( + controller.stream.every((x) => throw error1), + ).catchError(expectErrorOnly); controller.add(null); } { asyncStart(); StreamController controller = new StreamController(); - Future<bool?>.value(controller.stream.any((x) => throw error1)) - .catchError(expectErrorOnly); + Future<bool?>.value( + controller.stream.any((x) => throw error1), + ).catchError(expectErrorOnly); controller.add(null); } @@ -299,30 +305,45 @@ testTransparent(); // Run in a zone that doesn't change callback. - runZoned(testTransparent, - zoneSpecification: - new ZoneSpecification(handleUncaughtError: (s, p, z, e, t) {})); + runZoned( + testTransparent, + zoneSpecification: new ZoneSpecification( + handleUncaughtError: (s, p, z, e, t) {}, + ), + ); // Run in zone that delegates to root zone - runZoned(testTransparent, - zoneSpecification: new ZoneSpecification( - errorCallback: (s, p, z, e, t) => p.errorCallback(z, e, t))); + runZoned( + testTransparent, + zoneSpecification: new ZoneSpecification( + errorCallback: (s, p, z, e, t) => p.errorCallback(z, e, t), + ), + ); // Run in a zone that returns null from the callback. - runZoned(testTransparent, - zoneSpecification: - new ZoneSpecification(errorCallback: (s, p, z, e, t) => null)); + runZoned( + testTransparent, + zoneSpecification: new ZoneSpecification( + errorCallback: (s, p, z, e, t) => null, + ), + ); // Run in zone that returns same values. - runZoned(testTransparent, - zoneSpecification: new ZoneSpecification( - errorCallback: (s, p, z, e, t) => new AsyncError(e, t))); + runZoned( + testTransparent, + zoneSpecification: new ZoneSpecification( + errorCallback: (s, p, z, e, t) => new AsyncError(e, t), + ), + ); // Run in zone that returns null, inside zone that does replacement. runZoned(() { - runZoned(testTransparent, - zoneSpecification: - new ZoneSpecification(errorCallback: (s, p, z, e, t) => null)); + runZoned( + testTransparent, + zoneSpecification: new ZoneSpecification( + errorCallback: (s, p, z, e, t) => null, + ), + ); }, zoneSpecification: replaceZoneSpec); } @@ -342,8 +363,11 @@ // Use delegation to parent which replaces. runZoned(() { - runZoned(testReplaced, - zoneSpecification: new ZoneSpecification( - errorCallback: (s, p, z, e, t) => p.errorCallback(z, e, t))); + runZoned( + testReplaced, + zoneSpecification: new ZoneSpecification( + errorCallback: (s, p, z, e, t) => p.errorCallback(z, e, t), + ), + ); }, zoneSpecification: replaceZoneSpec); }
diff --git a/tests/lib/async/zone_fork_test.dart b/tests/lib/async/zone_fork_test.dart index 54fbd17..779e848 100644 --- a/tests/lib/async/zone_fork_test.dart +++ b/tests/lib/async/zone_fork_test.dart
@@ -12,34 +12,45 @@ Expect.identical(Zone.root, Zone.current); Zone forked; - forked = Zone.current.fork(specification: new ZoneSpecification(fork: - (Zone self, - ZoneDelegate parent, - Zone origin, - ZoneSpecification? zoneSpecification, - Map<Object?, Object?>? mapValues) { - // The zone is still the same as when origin.run was invoked, which - // is the root zone. (The origin zone hasn't been set yet). - Expect.identical(Zone.root, Zone.current); - events.add("forked.fork"); - var descriptionRun = zoneSpecification!.run!; - ZoneSpecification modified = new ZoneSpecification.from(zoneSpecification, - run: <R>(self, parent, origin, R f()) { - events.add("wrapped run"); - return descriptionRun(self, parent, origin, () { - events.add("wrapped f"); - return f(); - }); - }); - return parent.fork(origin, modified, mapValues); - })); + forked = Zone.current.fork( + specification: new ZoneSpecification( + fork: + ( + Zone self, + ZoneDelegate parent, + Zone origin, + ZoneSpecification? zoneSpecification, + Map<Object?, Object?>? mapValues, + ) { + // The zone is still the same as when origin.run was invoked, which + // is the root zone. (The origin zone hasn't been set yet). + Expect.identical(Zone.root, Zone.current); + events.add("forked.fork"); + var descriptionRun = zoneSpecification!.run!; + ZoneSpecification modified = new ZoneSpecification.from( + zoneSpecification, + run: <R>(self, parent, origin, R f()) { + events.add("wrapped run"); + return descriptionRun(self, parent, origin, () { + events.add("wrapped f"); + return f(); + }); + }, + ); + return parent.fork(origin, modified, mapValues); + }, + ), + ); events.add("start"); - Zone forkedChild = forked.fork(specification: new ZoneSpecification( + Zone forkedChild = forked.fork( + specification: new ZoneSpecification( run: <R>(Zone self, ZoneDelegate parent, Zone origin, R f()) { - events.add("executing child run"); - return parent.run(origin, f); - })); + events.add("executing child run"); + return parent.run(origin, f); + }, + ), + ); events.add("after child fork"); Expect.identical(Zone.root, Zone.current); @@ -58,6 +69,6 @@ "executing child run", "wrapped f", "child run", - "after child run" + "after child run", ], events); }
diff --git a/tests/lib/async/zone_future_schedule_microtask_test.dart b/tests/lib/async/zone_future_schedule_microtask_test.dart index 5766964..7bf23fc 100644 --- a/tests/lib/async/zone_future_schedule_microtask_test.dart +++ b/tests/lib/async/zone_future_schedule_microtask_test.dart
@@ -17,17 +17,20 @@ late Completer completer2; late Future future; late Future future2; - runZonedScheduleMicrotask(() { - completer = new Completer(); - completer.complete(499); - completer2 = new Completer.sync(); - completer2.complete(-499); - future = new Future.value(42); - future2 = new Future.error(11); - }, onScheduleMicrotask: (f) { - scheduleMicrotaskCount++; - scheduleMicrotask(f); - }); + runZonedScheduleMicrotask( + () { + completer = new Completer(); + completer.complete(499); + completer2 = new Completer.sync(); + completer2.complete(-499); + future = new Future.value(42); + future2 = new Future.error(11); + }, + onScheduleMicrotask: (f) { + scheduleMicrotaskCount++; + scheduleMicrotask(f); + }, + ); int openCallbackCount = 0; openCallbackCount++;
diff --git a/tests/lib/async/zone_register_callback_test.dart b/tests/lib/async/zone_register_callback_test.dart index a0fcd03..9e5ba36 100644 --- a/tests/lib/async/zone_register_callback_test.dart +++ b/tests/lib/async/zone_register_callback_test.dart
@@ -13,19 +13,21 @@ var restoredValue; Expect.identical(Zone.root, Zone.current); - Zone forked = Zone.current.fork(specification: new ZoneSpecification( - registerCallback: - <R>(Zone self, ZoneDelegate parent, Zone origin, R f()) { - // The zone is still the same as when origin.run was invoked, which - // is the root zone. (The origin zone hasn't been set yet). - Expect.identical(Zone.current, Zone.root); - // Note that not forwarding is completely legal, though not encouraged. - var capturedValue = valueToCapture; - return parent.registerCallback(origin, () { - restoredValue = capturedValue; - return f(); - }); - })); + Zone forked = Zone.current.fork( + specification: new ZoneSpecification( + registerCallback: <R>(Zone self, ZoneDelegate parent, Zone origin, R f()) { + // The zone is still the same as when origin.run was invoked, which + // is the root zone. (The origin zone hasn't been set yet). + Expect.identical(Zone.current, Zone.root); + // Note that not forwarding is completely legal, though not encouraged. + var capturedValue = valueToCapture; + return parent.registerCallback(origin, () { + restoredValue = capturedValue; + return f(); + }); + }, + ), + ); valueToCapture = 499; var fun = () => 99;
diff --git a/tests/lib/async/zone_register_callback_unary_test.dart b/tests/lib/async/zone_register_callback_unary_test.dart index 1a7c731..6aa7ec3 100644 --- a/tests/lib/async/zone_register_callback_unary_test.dart +++ b/tests/lib/async/zone_register_callback_unary_test.dart
@@ -13,19 +13,22 @@ var restoredValue; Expect.identical(Zone.root, Zone.current); - Zone forked = Zone.current.fork(specification: new ZoneSpecification( + Zone forked = Zone.current.fork( + specification: new ZoneSpecification( registerUnaryCallback: <R, T>(Zone self, ZoneDelegate parent, Zone origin, R f(T arg)) { - // The zone is still the same as when origin.run was invoked, which - // is the root zone. (The origin zone hasn't been set yet). - Expect.identical(Zone.current, Zone.root); - // Note that not forwarding is completely legal, though not encouraged. - var capturedValue = valueToCapture; - return parent.registerUnaryCallback(origin, (arg) { - restoredValue = capturedValue; - return f(arg); - }); - })); + // The zone is still the same as when origin.run was invoked, which + // is the root zone. (The origin zone hasn't been set yet). + Expect.identical(Zone.current, Zone.root); + // Note that not forwarding is completely legal, though not encouraged. + var capturedValue = valueToCapture; + return parent.registerUnaryCallback(origin, (arg) { + restoredValue = capturedValue; + return f(arg); + }); + }, + ), + ); valueToCapture = 499; var fun = (x) => x + 99;
diff --git a/tests/lib/async/zone_run_guarded_test.dart b/tests/lib/async/zone_run_guarded_test.dart index 8fe38c2..0816ecc 100644 --- a/tests/lib/async/zone_run_guarded_test.dart +++ b/tests/lib/async/zone_run_guarded_test.dart
@@ -18,20 +18,23 @@ Expect.identical(Zone.root, Zone.current); late Zone forked; forked = Zone.current.fork( - specification: new ZoneSpecification( - run: <R>(Zone self, ZoneDelegate parent, Zone origin, R f()) { - // The zone is still the same as when origin.run was invoked, which - // is the root zone. (The origin zone hasn't been set yet). - Expect.identical(Zone.root, Zone.current); - events.add("forked.run"); - return parent.run(origin, f); - }, handleUncaughtError: - (Zone self, ZoneDelegate parent, Zone origin, error, stackTrace) { - Expect.identical(Zone.root, Zone.current); - Expect.identical(forked, origin); - events.add("forked.handleUncaught $error"); - result = 499; - })); + specification: new ZoneSpecification( + run: <R>(Zone self, ZoneDelegate parent, Zone origin, R f()) { + // The zone is still the same as when origin.run was invoked, which + // is the root zone. (The origin zone hasn't been set yet). + Expect.identical(Zone.root, Zone.current); + events.add("forked.run"); + return parent.run(origin, f); + }, + handleUncaughtError: + (Zone self, ZoneDelegate parent, Zone origin, error, stackTrace) { + Expect.identical(Zone.root, Zone.current); + Expect.identical(forked, origin); + events.add("forked.handleUncaught $error"); + result = 499; + }, + ), + ); forked.runGuarded(() { events.add("runGuarded 1"); @@ -56,7 +59,7 @@ "after runGuarded 1", "forked.run", "runGuarded 2", - "forked.handleUncaught 42" + "forked.handleUncaught 42", ], events); result = null; @@ -84,7 +87,7 @@ "after nested scheduleMicrotask", "forked.run", "run closure 2", - "forked.handleUncaught 88" + "forked.handleUncaught 88", ], events); asyncEnd(); });
diff --git a/tests/lib/async/zone_run_test.dart b/tests/lib/async/zone_run_test.dart index b52d818..e1051bc 100644 --- a/tests/lib/async/zone_run_test.dart +++ b/tests/lib/async/zone_run_test.dart
@@ -12,15 +12,18 @@ bool shouldForward = true; Expect.identical(Zone.root, Zone.current); - Zone forked = Zone.current.fork(specification: new ZoneSpecification( + Zone forked = Zone.current.fork( + specification: new ZoneSpecification( run: <R>(Zone self, ZoneDelegate parent, Zone origin, R f()) { - // The zone is still the same as when origin.run was invoked, which - // is the root zone. (The origin zone hasn't been set yet). - Expect.identical(Zone.root, Zone.current); - events.add("forked.run"); - if (shouldForward) return parent.run(origin, f); - return 42 as R; - })); + // The zone is still the same as when origin.run was invoked, which + // is the root zone. (The origin zone hasn't been set yet). + Expect.identical(Zone.root, Zone.current); + events.add("forked.run"); + if (shouldForward) return parent.run(origin, f); + return 42 as R; + }, + ), + ); events.add("zone forked"); Zone expectedZone = forked; @@ -67,7 +70,7 @@ "run closure 2", "after nested scheduleMicrotask", "forked.run", - "run closure 3" + "run closure 3", ], events); asyncEnd(); });
diff --git a/tests/lib/async/zone_run_unary_test.dart b/tests/lib/async/zone_run_unary_test.dart index 92adf54..46014e1 100644 --- a/tests/lib/async/zone_run_unary_test.dart +++ b/tests/lib/async/zone_run_unary_test.dart
@@ -12,16 +12,26 @@ bool shouldForward = true; Expect.identical(Zone.root, Zone.current); - Zone forked = Zone.current.fork(specification: new ZoneSpecification(runUnary: - <R, T>(Zone self, ZoneDelegate parent, Zone origin, R f(T arg), T arg) { - // The zone is still the same as when origin.run was invoked, which - // is the root zone. (The origin zone hasn't been set yet). - Expect.identical(Zone.current, Zone.root); - events.add("forked.run1"); - if (shouldForward) - return parent.runUnary<R, T>(origin, f, ((arg as int) + 1) as T); - return 42 as R; - })); + Zone forked = Zone.current.fork( + specification: new ZoneSpecification( + runUnary: + <R, T>( + Zone self, + ZoneDelegate parent, + Zone origin, + R f(T arg), + T arg, + ) { + // The zone is still the same as when origin.run was invoked, which + // is the root zone. (The origin zone hasn't been set yet). + Expect.identical(Zone.current, Zone.root); + events.add("forked.run1"); + if (shouldForward) + return parent.runUnary<R, T>(origin, f, ((arg as int) + 1) as T); + return 42 as R; + }, + ), + ); events.add("zone forked"); Zone expectedZone = forked; @@ -67,7 +77,7 @@ "forked.run1", "run closure 2", "after nested scheduleMicrotask", - "run closure 3" + "run closure 3", ], events); asyncEnd(); });
diff --git a/tests/lib/collection/queue_test.dart b/tests/lib/collection/queue_test.dart index 0abfa51..f25fa15 100644 --- a/tests/lib/collection/queue_test.dart +++ b/tests/lib/collection/queue_test.dart
@@ -225,9 +225,31 @@ queue.retainWhere((x) => x != 3); testLength(23, queue); - Expect.listEquals( - [6, 8, 9, 1, 2, 4, 5, 6, 8, 9, 10, 1, 2, 4, 5, 6, 8, 9, 10, 1, 2, 4, 5], - queue.toList()); + Expect.listEquals([ + 6, + 8, + 9, + 1, + 2, + 4, + 5, + 6, + 8, + 9, + 10, + 1, + 2, + 4, + 5, + 6, + 8, + 9, + 10, + 1, + 2, + 4, + 5, + ], queue.toList()); // Regression test: http://dartbug.com/16270 // These should all do nothing, and should not throw.
diff --git a/tests/lib/collection/regress_47852_test.dart b/tests/lib/collection/regress_47852_test.dart index 4345878..4b2bc7f 100644 --- a/tests/lib/collection/regress_47852_test.dart +++ b/tests/lib/collection/regress_47852_test.dart
@@ -14,7 +14,9 @@ map.putIfAbsent(key, () { wasAbsent = true; Expect.isFalse( - map.containsKey(key), 'containsKey should be false in putIfAbsent'); + map.containsKey(key), + 'containsKey should be false in putIfAbsent', + ); return key; }); Expect.isTrue(wasAbsent); @@ -39,7 +41,7 @@ final keys = [ 123, 3.14, - 10.0, // int or double depending on platform. + 10.0, // int or double depending on platform. 'aString', #someSymbol, true, @@ -66,8 +68,10 @@ bool wasAbsent = false; map.putIfAbsent(key, () { wasAbsent = true; - Expect.isFalse(map.containsKey(key), - 'containsKey should be false in putIfAbsent. key = $key'); + Expect.isFalse( + map.containsKey(key), + 'containsKey should be false in putIfAbsent. key = $key', + ); return key; }); Expect.isTrue(wasAbsent); @@ -88,12 +92,18 @@ testMap(LinkedHashMap.identity()); // Should be same as `Map.identity()`. // Custom maps: - testMap(HashMap( + testMap( + HashMap( equals: (k1, k2) => k2 == k1, hashCode: (key) => key.hashCode + 1, - isValidKey: (_) => true)); - testMap(LinkedHashMap( + isValidKey: (_) => true, + ), + ); + testMap( + LinkedHashMap( equals: (k1, k2) => k2 == k1, hashCode: (key) => key.hashCode + 1, - isValidKey: (_) => true)); + isValidKey: (_) => true, + ), + ); }
diff --git a/tests/lib/convert/ascii_test.dart b/tests/lib/convert/ascii_test.dart index 06aa7ef..6d50001 100644 --- a/tests/lib/convert/ascii_test.dart +++ b/tests/lib/convert/ascii_test.dart
@@ -8,14 +8,14 @@ var asciiStrings = [ "pure ascii", "\x00 with control characters \n", - "\x01 edge cases \x7f" + "\x01 edge cases \x7f", ]; var nonAsciiStrings = [ "\x80 edge case first", "Edge case ASCII \u{80}", "Edge case byte \u{ff}", - "Edge case super-BMP \u{10000}" + "Edge case super-BMP \u{10000}", ]; void main() { @@ -50,9 +50,13 @@ } for (var nonAsciiString in nonAsciiStrings) { - Expect.throws(() { - print(codec.encoder.convert(nonAsciiString)); - }, (_) => true, nonAsciiString); + Expect.throws( + () { + print(codec.encoder.convert(nonAsciiString)); + }, + (_) => true, + nonAsciiString, + ); } var encode = codec.encoder.convert; @@ -113,7 +117,10 @@ } List<int> encode( - String str, int chunkSize, Converter<String, List<int>> converter) { + String str, + int chunkSize, + Converter<String, List<int>> converter, +) { List<int> bytes = <int>[]; var byteSink = new ByteConversionSink.withCallback(bytes.addAll); var stringConversionSink = converter.startChunkedConversion(byteSink); @@ -129,7 +136,10 @@ } String decode( - List<int> bytes, int chunkSize, Converter<List<int>, String> converter) { + List<int> bytes, + int chunkSize, + Converter<List<int>, String> converter, +) { StringBuffer buf = new StringBuffer(); var stringSink = new StringConversionSink.fromStringSink(buf); var byteConversionSink = converter.startChunkedConversion(stringSink); @@ -149,7 +159,7 @@ for (var converter in [ ascii.encoder, new AsciiCodec().encoder, - new AsciiEncoder() + new AsciiEncoder(), ]) { for (int chunkSize in [1, 2, 5, 50]) { for (var asciiString in asciiStrings) { @@ -168,7 +178,7 @@ for (var converter in [ ascii.decoder, new AsciiCodec().decoder, - new AsciiDecoder() + new AsciiDecoder(), ]) { for (int chunkSize in [1, 2, 5, 50]) { for (var asciiString in asciiStrings) {
diff --git a/tests/lib/convert/chunked_conversion1_test.dart b/tests/lib/convert/chunked_conversion1_test.dart index edf7882..dc98559 100644 --- a/tests/lib/convert/chunked_conversion1_test.dart +++ b/tests/lib/convert/chunked_conversion1_test.dart
@@ -127,8 +127,11 @@ // Test int->bool converter individually. Converter<int, bool> int2boolConverter = new IntBoolConverter1(); - Expect.listEquals( - [true, false, true], [2, -2, 2].map(int2boolConverter.convert).toList()); + Expect.listEquals([ + true, + false, + true, + ], [2, -2, 2].map(int2boolConverter.convert).toList()); var hasExecuted = false; boolSink = new MyChunkedBoolSink.withCallback((value) { hasExecuted = true; @@ -146,8 +149,11 @@ // Test bool->int converter individually. Converter<bool, int> bool2intConverter = new BoolIntConverter1(); - Expect.listEquals( - [1, 0, 1], [true, false, true].map(bool2intConverter.convert).toList()); + Expect.listEquals([ + 1, + 0, + 1, + ], [true, false, true].map(bool2intConverter.convert).toList()); hasExecuted = false; intSink = new MyChunkedIntSink.withCallback((value) { hasExecuted = true; @@ -237,8 +243,9 @@ hasExecuted = false; // With identity between the two converters. - fused = - int2boolConverter.fuse(new IdentityConverter()).fuse(bool2intConverter); + fused = int2boolConverter + .fuse(new IdentityConverter()) + .fuse(bool2intConverter); Expect.listEquals([1, 0, 1], [2, -2, 2].map(fused.convert).toList()); hasExecuted = false; intSink2 = new MyChunkedIntSink.withCallback((value) {
diff --git a/tests/lib/convert/chunked_conversion_json_decode1_test.dart b/tests/lib/convert/chunked_conversion_json_decode1_test.dart index 0122721..e6ec82f 100644 --- a/tests/lib/convert/chunked_conversion_json_decode1_test.dart +++ b/tests/lib/convert/chunked_conversion_json_decode1_test.dart
@@ -17,42 +17,42 @@ [[], "[]"], [ [3, -4.5, true, "hi", false], - '[3,-4.5,true,"hi",false]' + '[3,-4.5,true,"hi",false]', ], [ [null], - "[null]" + "[null]", ], [ [ - [null] + [null], ], - "[[null]]" + "[[null]]", ], [ [ - [3] + [3], ], - "[[3]]" + "[[3]]", ], [{}, "{}"], [ {"x": 3, "y": 4.5, "z": "hi", "u": true, "v": false}, - '{"x":3,"y":4.5,"z":"hi","u":true,"v":false}' + '{"x":3,"y":4.5,"z":"hi","u":true,"v":false}', ], [ {"x": null}, - '{"x":null}' + '{"x":null}', ], [ {"x": {}}, - '{"x":{}}' + '{"x":{}}', ], // Note that -0.0 won't be treated the same in JS. The Json spec seems to // allow it, though. [ {"hi there": 499, "'": -0.0}, - '{"hi there":499,"\'":-0.0}' + '{"hi there":499,"\'":-0.0}', ], [r'\foo', r'"\\foo"'], ]; @@ -81,8 +81,9 @@ Object? decode(String str) { Object? result; var decoder = new JsonDecoder(null); - ChunkedConversionSink objectSink = - new ChunkedConversionSink.withCallback((x) => result = x.single); + ChunkedConversionSink objectSink = new ChunkedConversionSink.withCallback( + (x) => result = x.single, + ); var stringConversionSink = decoder.startChunkedConversion(objectSink); stringConversionSink.add(str); stringConversionSink.close(); @@ -92,8 +93,9 @@ Object? decode2(String str) { Object? result; var decoder = new JsonDecoder(null); - ChunkedConversionSink objectSink = - new ChunkedConversionSink.withCallback((x) => result = x.single); + ChunkedConversionSink objectSink = new ChunkedConversionSink.withCallback( + (x) => result = x.single, + ); var stringConversionSink = decoder.startChunkedConversion(objectSink); ClosableStringSink stringSink = stringConversionSink.asStringSink(); stringSink.write(str); @@ -104,8 +106,9 @@ Object? decode3(String str) { Object? result; var decoder = new JsonDecoder(null); - ChunkedConversionSink objectSink = - new ChunkedConversionSink.withCallback((x) => result = x.single); + ChunkedConversionSink objectSink = new ChunkedConversionSink.withCallback( + (x) => result = x.single, + ); var stringConversionSink = decoder.startChunkedConversion(objectSink); ClosableStringSink stringSink = stringConversionSink.asStringSink(); str.codeUnits.forEach(stringSink.writeCharCode); @@ -116,8 +119,9 @@ Object? decode4(String str) { Object? result; var decoder = new JsonDecoder(null); - ChunkedConversionSink objectSink = - new ChunkedConversionSink.withCallback((x) => result = x.single); + ChunkedConversionSink objectSink = new ChunkedConversionSink.withCallback( + (x) => result = x.single, + ); var stringConversionSink = decoder.startChunkedConversion(objectSink); ClosableStringSink stringSink = stringConversionSink.asStringSink(); str.runes.forEach(stringSink.writeCharCode); @@ -128,8 +132,9 @@ Object? decode5(String str) { Object? result; var decoder = new JsonDecoder(null); - ChunkedConversionSink objectSink = - new ChunkedConversionSink.withCallback((x) => result = x.single); + ChunkedConversionSink objectSink = new ChunkedConversionSink.withCallback( + (x) => result = x.single, + ); var stringConversionSink = decoder.startChunkedConversion(objectSink); ByteConversionSink inputByteSink = stringConversionSink.asUtf8Sink(false); var tmpBytes = utf8.encode(str); @@ -141,8 +146,9 @@ Object? decode6(String str) { Object? result; var decoder = new JsonDecoder(null); - ChunkedConversionSink objectSink = - new ChunkedConversionSink.withCallback((x) => result = x.single); + ChunkedConversionSink objectSink = new ChunkedConversionSink.withCallback( + (x) => result = x.single, + ); var stringConversionSink = decoder.startChunkedConversion(objectSink); ByteConversionSink inputByteSink = stringConversionSink.asUtf8Sink(false); var tmpBytes = utf8.encode(str); @@ -154,8 +160,9 @@ Object? decode7(String str) { Object? result; var decoder = new JsonDecoder(null); - ChunkedConversionSink objectSink = - new ChunkedConversionSink.withCallback((x) => result = x.single); + ChunkedConversionSink objectSink = new ChunkedConversionSink.withCallback( + (x) => result = x.single, + ); var stringConversionSink = decoder.startChunkedConversion(objectSink); stringConversionSink.addSlice("1" + str + "2", 1, str.length + 1, false); stringConversionSink.close(); @@ -166,14 +173,15 @@ var tests = TESTS.expand((test) { var object = test[0]; var string = test[1]; - var longString = " " + var longString = + " " " " "$string" " " " "; return [ test, - [object, longString] + [object, longString], ]; }); for (var test in tests) {
diff --git a/tests/lib/convert/chunked_conversion_json_encode1_test.dart b/tests/lib/convert/chunked_conversion_json_encode1_test.dart index 5ffad23..ac69ce45 100644 --- a/tests/lib/convert/chunked_conversion_json_encode1_test.dart +++ b/tests/lib/convert/chunked_conversion_json_encode1_test.dart
@@ -17,42 +17,42 @@ [[], "[]"], [ [3, -4.5, true, "hi", false], - '[3,-4.5,true,"hi",false]' + '[3,-4.5,true,"hi",false]', ], [ [null], - "[null]" + "[null]", ], [ [ - [null] + [null], ], - "[[null]]" + "[[null]]", ], [ [ - [3] + [3], ], - "[[3]]" + "[[3]]", ], [{}, "{}"], [ {"x": 3, "y": 4.5, "z": "hi", "u": true, "v": false}, - '{"x":3,"y":4.5,"z":"hi","u":true,"v":false}' + '{"x":3,"y":4.5,"z":"hi","u":true,"v":false}', ], [ {"x": null}, - '{"x":null}' + '{"x":null}', ], [ {"x": {}}, - '{"x":{}}' + '{"x":{}}', ], // Note that -0.0 won't be treated the same in JS. The Json spec seems to // allow it, though. [ {"hi there": 499, "'": -0.0}, - '{"hi there":499,"\'":-0.0}' + '{"hi there":499,"\'":-0.0}', ], [r'\foo', r'"\\foo"'], ]; @@ -75,8 +75,9 @@ String encode(Object? o) { var result; - ChunkedConversionSink<String> stringSink = - new MyStringConversionSink((x) => result = x); + ChunkedConversionSink<String> stringSink = new MyStringConversionSink( + (x) => result = x, + ); var objectSink = new JsonEncoder().startChunkedConversion(stringSink); objectSink.add(o); objectSink.close();
diff --git a/tests/lib/convert/chunked_conversion_utf82_test.dart b/tests/lib/convert/chunked_conversion_utf82_test.dart index 2e07f87..bcc25ec 100644 --- a/tests/lib/convert/chunked_conversion_utf82_test.dart +++ b/tests/lib/convert/chunked_conversion_utf82_test.dart
@@ -50,7 +50,7 @@ // Unfinished UTF-8 sequences. [0xc3], [0xE2, 0x82], - [0xF0, 0xA4, 0xAD] + [0xF0, 0xA4, 0xAD], ]; final TESTS1 = [ @@ -73,153 +73,153 @@ [0xC0, 0x80], [0xC1, 0x80], // Outside valid range. - [0xF4, 0xBF, 0xBF, 0xBF] + [0xF4, 0xBF, 0xBF, 0xBF], ]; final TESTS2 = [ // Test that 0xC0|1, 0x80 does not eat the next character. [ [0xC0, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xC1, 0x80, 0x61], - "XXa" + "XXa", ], // 0xF5 .. 0xFF never appear in valid UTF-8 sequences. [ [0xF5, 0x80], - "XX" + "XX", ], [ [0xF6, 0x80], - "XX" + "XX", ], [ [0xF7, 0x80], - "XX" + "XX", ], [ [0xF8, 0x80], - "XX" + "XX", ], [ [0xF9, 0x80], - "XX" + "XX", ], [ [0xFA, 0x80], - "XX" + "XX", ], [ [0xFB, 0x80], - "XX" + "XX", ], [ [0xFC, 0x80], - "XX" + "XX", ], [ [0xFD, 0x80], - "XX" + "XX", ], [ [0xFE, 0x80], - "XX" + "XX", ], [ [0xFF, 0x80], - "XX" + "XX", ], [ [0xF5, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xF6, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xF7, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xF8, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xF9, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFA, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFB, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFC, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFD, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFE, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFF, 0x80, 0x61], - "XXa" + "XXa", ], // Characters outside the valid range. [ [0xF5, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xF6, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xF7, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xF8, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xF9, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFA, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFB, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFC, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFD, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFE, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFF, 0x80, 0x80, 0x61], - "XXXa" - ] + "XXXa", + ], ]; main() { @@ -227,46 +227,47 @@ // Pairs of test and expected string output when malformed strings are // allowed. Replacement character: U+FFFD, one per unfinished sequence or // undecodable byte. - String replacement = - TESTS0.contains(test) ? "\u{FFFD}" : "\u{FFFD}" * test.length; + String replacement = TESTS0.contains(test) + ? "\u{FFFD}" + : "\u{FFFD}" * test.length; return [ [test, "${replacement}"], [ [0x61, ...test], - "a${replacement}" + "a${replacement}", ], [ [0x61, ...test, 0x61], - "a${replacement}a" + "a${replacement}a", ], [ [...test, 0x61], - "${replacement}a" + "${replacement}a", ], [ [...test, ...test], - "${replacement}${replacement}" + "${replacement}${replacement}", ], [ [...test, 0x61, ...test], - "${replacement}a${replacement}" + "${replacement}a${replacement}", ], [ [0xc3, 0xa5, ...test], - "å${replacement}" + "å${replacement}", ], [ [0xc3, 0xa5, ...test, 0xc3, 0xa5], - "å${replacement}å" + "å${replacement}å", ], [ [...test, 0xc3, 0xa5], - "${replacement}å" + "${replacement}å", ], [ [...test, 0xc3, 0xa5, ...test], - "${replacement}å${replacement}" - ] + "${replacement}å${replacement}", + ], ]; }); @@ -277,7 +278,10 @@ return [test[0], expected]; }); - for (var test in []..addAll(allTests)..addAll(allTests2)) { + for (var test + in [] + ..addAll(allTests) + ..addAll(allTests2)) { List<int> bytes = test[0]; Expect.throwsFormatException(() => decode(bytes, 1)); Expect.throwsFormatException(() => decode(bytes, 2));
diff --git a/tests/lib/convert/chunked_conversion_utf84_test.dart b/tests/lib/convert/chunked_conversion_utf84_test.dart index 206a8a9..2fea38a 100644 --- a/tests/lib/convert/chunked_conversion_utf84_test.dart +++ b/tests/lib/convert/chunked_conversion_utf84_test.dart
@@ -9,8 +9,9 @@ String decode(List<int> bytes, int chunkSize) { // Use a non-chunked interface. late String result; - var chunkedSink = - new StringConversionSink.withCallback((decoded) => result = decoded); + var chunkedSink = new StringConversionSink.withCallback( + (decoded) => result = decoded, + ); var byteSink = new Utf8Decoder().startChunkedConversion(chunkedSink); int i = 0; while (i < bytes.length) {
diff --git a/tests/lib/convert/chunked_conversion_utf85_test.dart b/tests/lib/convert/chunked_conversion_utf85_test.dart index 6487818..27b8e96 100644 --- a/tests/lib/convert/chunked_conversion_utf85_test.dart +++ b/tests/lib/convert/chunked_conversion_utf85_test.dart
@@ -8,8 +8,9 @@ List<int> encode(String str) { late List<int> bytes; - var byteSink = - new ByteConversionSink.withCallback((result) => bytes = result); + var byteSink = new ByteConversionSink.withCallback( + (result) => bytes = result, + ); var stringConversionSink = new Utf8Encoder().startChunkedConversion(byteSink); stringConversionSink.add(str); stringConversionSink.close(); @@ -18,8 +19,9 @@ List<int> encode2(String str) { late List<int> bytes; - var byteSink = - new ByteConversionSink.withCallback((result) => bytes = result); + var byteSink = new ByteConversionSink.withCallback( + (result) => bytes = result, + ); var stringConversionSink = new Utf8Encoder().startChunkedConversion(byteSink); ClosableStringSink stringSink = stringConversionSink.asStringSink(); stringSink.write(str); @@ -29,8 +31,9 @@ List<int> encode3(String str) { late List<int> bytes; - var byteSink = - new ByteConversionSink.withCallback((result) => bytes = result); + var byteSink = new ByteConversionSink.withCallback( + (result) => bytes = result, + ); var stringConversionSink = new Utf8Encoder().startChunkedConversion(byteSink); ClosableStringSink stringSink = stringConversionSink.asStringSink(); str.codeUnits.forEach(stringSink.writeCharCode); @@ -40,8 +43,9 @@ List<int> encode4(String str) { late List<int> bytes; - var byteSink = - new ByteConversionSink.withCallback((result) => bytes = result); + var byteSink = new ByteConversionSink.withCallback( + (result) => bytes = result, + ); var stringConversionSink = new Utf8Encoder().startChunkedConversion(byteSink); ClosableStringSink stringSink = stringConversionSink.asStringSink(); str.runes.forEach(stringSink.writeCharCode); @@ -51,8 +55,9 @@ List<int> encode5(String str) { late List<int> bytes; - var byteSink = - new ByteConversionSink.withCallback((result) => bytes = result); + var byteSink = new ByteConversionSink.withCallback( + (result) => bytes = result, + ); var stringConversionSink = new Utf8Encoder().startChunkedConversion(byteSink); ByteConversionSink inputByteSink = stringConversionSink.asUtf8Sink(false); List<int> tmpBytes = utf8.encode(str); @@ -63,8 +68,9 @@ List<int> encode6(String str) { late List<int> bytes; - var byteSink = - new ByteConversionSink.withCallback((result) => bytes = result); + var byteSink = new ByteConversionSink.withCallback( + (result) => bytes = result, + ); var stringConversionSink = new Utf8Encoder().startChunkedConversion(byteSink); ByteConversionSink inputByteSink = stringConversionSink.asUtf8Sink(false); List<int> tmpBytes = utf8.encode(str); @@ -75,8 +81,9 @@ List<int> encode7(String str) { late List<int> bytes; - var byteSink = - new ByteConversionSink.withCallback((result) => bytes = result); + var byteSink = new ByteConversionSink.withCallback( + (result) => bytes = result, + ); var stringConversionSink = new Utf8Encoder().startChunkedConversion(byteSink); stringConversionSink.addSlice("1" + str + "2", 1, str.length + 1, false); stringConversionSink.close();
diff --git a/tests/lib/convert/chunked_conversion_utf86_test.dart b/tests/lib/convert/chunked_conversion_utf86_test.dart index 8c9a08c..064d3de 100644 --- a/tests/lib/convert/chunked_conversion_utf86_test.dart +++ b/tests/lib/convert/chunked_conversion_utf86_test.dart
@@ -32,7 +32,7 @@ // Unfinished UTF-8 sequences. [0xc3], [0xE2, 0x82], - [0xF0, 0xA4, 0xAD] + [0xF0, 0xA4, 0xAD], ]; final TESTS1 = [ @@ -55,153 +55,153 @@ [0xC0, 0x80], [0xC1, 0x80], // Outside valid range. - [0xF4, 0xBF, 0xBF, 0xBF] + [0xF4, 0xBF, 0xBF, 0xBF], ]; final TESTS2 = [ // Test that 0xC0|1, 0x80 does not eat the next character. [ [0xC0, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xC1, 0x80, 0x61], - "XXa" + "XXa", ], // 0xF5 .. 0xFF never appear in valid UTF-8 sequences. [ [0xF5, 0x80], - "XX" + "XX", ], [ [0xF6, 0x80], - "XX" + "XX", ], [ [0xF7, 0x80], - "XX" + "XX", ], [ [0xF8, 0x80], - "XX" + "XX", ], [ [0xF9, 0x80], - "XX" + "XX", ], [ [0xFA, 0x80], - "XX" + "XX", ], [ [0xFB, 0x80], - "XX" + "XX", ], [ [0xFC, 0x80], - "XX" + "XX", ], [ [0xFD, 0x80], - "XX" + "XX", ], [ [0xFE, 0x80], - "XX" + "XX", ], [ [0xFF, 0x80], - "XX" + "XX", ], [ [0xF5, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xF6, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xF7, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xF8, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xF9, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFA, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFB, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFC, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFD, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFE, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFF, 0x80, 0x61], - "XXa" + "XXa", ], // Characters outside the valid range. [ [0xF5, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xF6, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xF7, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xF8, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xF9, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFA, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFB, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFC, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFD, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFE, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFF, 0x80, 0x80, 0x61], - "XXXa" - ] + "XXXa", + ], ]; main() { @@ -209,46 +209,47 @@ // Pairs of test and expected string output when malformed strings are // allowed. Replacement character: U+FFFD, one per unfinished sequence or // undecodable byte. - String replacement = - TESTS0.contains(test) ? "\u{FFFD}" : "\u{FFFD}" * test.length; + String replacement = TESTS0.contains(test) + ? "\u{FFFD}" + : "\u{FFFD}" * test.length; return [ [test, "${replacement}"], [ [0x61, ...test], - "a${replacement}" + "a${replacement}", ], [ [0x61, ...test, 0x61], - "a${replacement}a" + "a${replacement}a", ], [ [...test, 0x61], - "${replacement}a" + "${replacement}a", ], [ [...test, ...test], - "${replacement}${replacement}" + "${replacement}${replacement}", ], [ [...test, 0x61, ...test], - "${replacement}a${replacement}" + "${replacement}a${replacement}", ], [ [0xc3, 0xa5, ...test], - "å${replacement}" + "å${replacement}", ], [ [0xc3, 0xa5, ...test, 0xc3, 0xa5], - "å${replacement}å" + "å${replacement}å", ], [ [...test, 0xc3, 0xa5], - "${replacement}å" + "${replacement}å", ], [ [...test, 0xc3, 0xa5, ...test], - "${replacement}å${replacement}" - ] + "${replacement}å${replacement}", + ], ]; }); @@ -259,7 +260,10 @@ return [test[0], expected]; }); - for (var test in []..addAll(allTests)..addAll(allTests2)) { + for (var test + in [] + ..addAll(allTests) + ..addAll(allTests2)) { List<int> bytes = test[0]; Expect.throwsFormatException(() => decode(bytes));
diff --git a/tests/lib/convert/chunked_conversion_utf87_test.dart b/tests/lib/convert/chunked_conversion_utf87_test.dart index 5434f1f..a79275c 100644 --- a/tests/lib/convert/chunked_conversion_utf87_test.dart +++ b/tests/lib/convert/chunked_conversion_utf87_test.dart
@@ -7,8 +7,9 @@ String decode(List<int> inputBytes) { late List<int> bytes; - var byteSink = - new ByteConversionSink.withCallback((result) => bytes = result); + var byteSink = new ByteConversionSink.withCallback( + (result) => bytes = result, + ); var stringConversionSink = new Utf8Encoder().startChunkedConversion(byteSink); ByteConversionSink inputByteSink = stringConversionSink.asUtf8Sink(false); inputByteSink.add(inputBytes); @@ -18,8 +19,9 @@ String decode2(List<int> inputBytes) { late List<int> bytes; - var byteSink = - new ByteConversionSink.withCallback((result) => bytes = result); + var byteSink = new ByteConversionSink.withCallback( + (result) => bytes = result, + ); var stringConversionSink = new Utf8Encoder().startChunkedConversion(byteSink); ByteConversionSink inputByteSink = stringConversionSink.asUtf8Sink(false); inputBytes.forEach((b) => inputByteSink.addSlice([0, b, 1], 1, 2, false)); @@ -29,8 +31,9 @@ String decodeAllowMalformed(List<int> inputBytes) { late List<int> bytes; - var byteSink = - new ByteConversionSink.withCallback((result) => bytes = result); + var byteSink = new ByteConversionSink.withCallback( + (result) => bytes = result, + ); var stringConversionSink = new Utf8Encoder().startChunkedConversion(byteSink); ByteConversionSink inputByteSink = stringConversionSink.asUtf8Sink(true); inputByteSink.add(inputBytes); @@ -40,8 +43,9 @@ String decodeAllowMalformed2(List<int> inputBytes) { late List<int> bytes; - var byteSink = - new ByteConversionSink.withCallback((result) => bytes = result); + var byteSink = new ByteConversionSink.withCallback( + (result) => bytes = result, + ); var stringConversionSink = new Utf8Encoder().startChunkedConversion(byteSink); ByteConversionSink inputByteSink = stringConversionSink.asUtf8Sink(true); inputBytes.forEach((b) => inputByteSink.addSlice([0, b, 1], 1, 2, false)); @@ -53,7 +57,7 @@ // Unfinished UTF-8 sequences. [0xc3], [0xE2, 0x82], - [0xF0, 0xA4, 0xAD] + [0xF0, 0xA4, 0xAD], ]; final TESTS1 = [ @@ -76,153 +80,153 @@ [0xC0, 0x80], [0xC1, 0x80], // Outside valid range. - [0xF4, 0xBF, 0xBF, 0xBF] + [0xF4, 0xBF, 0xBF, 0xBF], ]; final TESTS2 = [ // Test that 0xC0|1, 0x80 does not eat the next character. [ [0xC0, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xC1, 0x80, 0x61], - "XXa" + "XXa", ], // 0xF5 .. 0xFF never appear in valid UTF-8 sequences. [ [0xF5, 0x80], - "XX" + "XX", ], [ [0xF6, 0x80], - "XX" + "XX", ], [ [0xF7, 0x80], - "XX" + "XX", ], [ [0xF8, 0x80], - "XX" + "XX", ], [ [0xF9, 0x80], - "XX" + "XX", ], [ [0xFA, 0x80], - "XX" + "XX", ], [ [0xFB, 0x80], - "XX" + "XX", ], [ [0xFC, 0x80], - "XX" + "XX", ], [ [0xFD, 0x80], - "XX" + "XX", ], [ [0xFE, 0x80], - "XX" + "XX", ], [ [0xFF, 0x80], - "XX" + "XX", ], [ [0xF5, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xF6, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xF7, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xF8, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xF9, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFA, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFB, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFC, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFD, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFE, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFF, 0x80, 0x61], - "XXa" + "XXa", ], // Characters outside the valid range. [ [0xF5, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xF6, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xF7, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xF8, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xF9, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFA, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFB, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFC, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFD, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFE, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFF, 0x80, 0x80, 0x61], - "XXXa" - ] + "XXXa", + ], ]; main() { @@ -230,46 +234,47 @@ // Pairs of test and expected string output when malformed strings are // allowed. Replacement character: U+FFFD, one per unfinished sequence or // undecodable byte. - String replacement = - TESTS0.contains(test) ? "\u{FFFD}" : "\u{FFFD}" * test.length; + String replacement = TESTS0.contains(test) + ? "\u{FFFD}" + : "\u{FFFD}" * test.length; return [ [test, "${replacement}"], [ [0x61, ...test], - "a${replacement}" + "a${replacement}", ], [ [0x61, ...test, 0x61], - "a${replacement}a" + "a${replacement}a", ], [ [...test, 0x61], - "${replacement}a" + "${replacement}a", ], [ [...test, ...test], - "${replacement}${replacement}" + "${replacement}${replacement}", ], [ [...test, 0x61, ...test], - "${replacement}a${replacement}" + "${replacement}a${replacement}", ], [ [0xc3, 0xa5, ...test], - "å${replacement}" + "å${replacement}", ], [ [0xc3, 0xa5, ...test, 0xc3, 0xa5], - "å${replacement}å" + "å${replacement}å", ], [ [...test, 0xc3, 0xa5], - "${replacement}å" + "${replacement}å", ], [ [...test, 0xc3, 0xa5, ...test], - "${replacement}å${replacement}" - ] + "${replacement}å${replacement}", + ], ]; }); @@ -280,7 +285,10 @@ return [test[0], expected]; }); - for (var test in []..addAll(allTests)..addAll(allTests2)) { + for (var test + in [] + ..addAll(allTests) + ..addAll(allTests2)) { List<int> bytes = test[0]; Expect.throwsFormatException(() => decode(bytes)); Expect.throwsFormatException(() => decode2(bytes));
diff --git a/tests/lib/convert/chunked_conversion_utf88_test.dart b/tests/lib/convert/chunked_conversion_utf88_test.dart index 93cab53b..71bebef 100644 --- a/tests/lib/convert/chunked_conversion_utf88_test.dart +++ b/tests/lib/convert/chunked_conversion_utf88_test.dart
@@ -9,8 +9,9 @@ List<int> encode(String str) { late List<int> bytes; - var byteSink = - new ByteConversionSink.withCallback((result) => bytes = result); + var byteSink = new ByteConversionSink.withCallback( + (result) => bytes = result, + ); var stringConversionSink = new Utf8Encoder().startChunkedConversion(byteSink); stringConversionSink.add(str); stringConversionSink.close(); @@ -19,8 +20,9 @@ List<int> encode2(String str) { late List<int> bytes; - var byteSink = - new ByteConversionSink.withCallback((result) => bytes = result); + var byteSink = new ByteConversionSink.withCallback( + (result) => bytes = result, + ); var stringConversionSink = new Utf8Encoder().startChunkedConversion(byteSink); ClosableStringSink stringSink = stringConversionSink.asStringSink(); stringSink.write(str); @@ -30,8 +32,9 @@ List<int> encode3(String str) { late List<int> bytes; - var byteSink = - new ByteConversionSink.withCallback((result) => bytes = result); + var byteSink = new ByteConversionSink.withCallback( + (result) => bytes = result, + ); var stringConversionSink = new Utf8Encoder().startChunkedConversion(byteSink); ClosableStringSink stringSink = stringConversionSink.asStringSink(); str.codeUnits.forEach(stringSink.writeCharCode); @@ -41,8 +44,9 @@ List<int> encode4(String str) { late List<int> bytes; - var byteSink = - new ByteConversionSink.withCallback((result) => bytes = result); + var byteSink = new ByteConversionSink.withCallback( + (result) => bytes = result, + ); var stringConversionSink = new Utf8Encoder().startChunkedConversion(byteSink); ClosableStringSink stringSink = stringConversionSink.asStringSink(); str.runes.forEach(stringSink.writeCharCode); @@ -52,8 +56,9 @@ List<int> encode5(String str) { late List<int> bytes; - var byteSink = - new ByteConversionSink.withCallback((result) => bytes = result); + var byteSink = new ByteConversionSink.withCallback( + (result) => bytes = result, + ); var stringConversionSink = new Utf8Encoder().startChunkedConversion(byteSink); ByteConversionSink inputByteSink = stringConversionSink.asUtf8Sink(false); List<int> tmpBytes = utf8.encode(str); @@ -64,8 +69,9 @@ List<int> encode6(String str) { late List<int> bytes; - var byteSink = - new ByteConversionSink.withCallback((result) => bytes = result); + var byteSink = new ByteConversionSink.withCallback( + (result) => bytes = result, + ); var stringConversionSink = new Utf8Encoder().startChunkedConversion(byteSink); ByteConversionSink inputByteSink = stringConversionSink.asUtf8Sink(false); List<int> tmpBytes = utf8.encode(str); @@ -76,8 +82,9 @@ List<int> encode7(String str) { late List<int> bytes; - var byteSink = - new ByteConversionSink.withCallback((result) => bytes = result); + var byteSink = new ByteConversionSink.withCallback( + (result) => bytes = result, + ); var stringConversionSink = new Utf8Encoder().startChunkedConversion(byteSink); stringConversionSink.addSlice("1" + str + "2", 1, str.length + 1, false); stringConversionSink.close();
diff --git a/tests/lib/convert/codec2_test.dart b/tests/lib/convert/codec2_test.dart index 7af8d1a..f87b5f1 100644 --- a/tests/lib/convert/codec2_test.dart +++ b/tests/lib/convert/codec2_test.dart
@@ -27,7 +27,7 @@ 50, 51, 49, - 93 + 93, ]; Expect.listEquals(ENCODED, utf8.encode(RAW)); Expect.equals(RAW, utf8.decode(ENCODED)); @@ -40,10 +40,13 @@ Expect.listEquals(["122ç", 50, 50, 231], json.decode(JSON_ENCODED)); // Test that the reviver is passed to the decoder. - var decoded = json.decode('{"p": 5}', reviver: (dynamic k, dynamic v) { - if (k == null) return v; - return v * 2; - }); + var decoded = json.decode( + '{"p": 5}', + reviver: (dynamic k, dynamic v) { + if (k == null) return v; + return v * 2; + }, + ); Expect.equals(10, decoded["p"]); var jsonWithReviver = new JsonCodec.withReviver((dynamic k, dynamic v) { if (k == null) return v;
diff --git a/tests/lib/convert/html_escape_test.dart b/tests/lib/convert/html_escape_test.dart index f40c18d..0be8cd0 100644 --- a/tests/lib/convert/html_escape_test.dart +++ b/tests/lib/convert/html_escape_test.dart
@@ -10,7 +10,8 @@ const _TEST_INPUT = """<A </test> of \xA0 "double" & 'single' values>"""; -const _OUTPUT_UNKNOWN = '<A </test> of \xA0 "double" ' +const _OUTPUT_UNKNOWN = + '<A </test> of \xA0 "double" ' '& 'single' values>'; const _OUTPUT_ATTRIBUTE = @@ -78,12 +79,24 @@ _testMode(htmlEscape, _TEST_INPUT, _OUTPUT_UNKNOWN); _testMode(const HtmlEscape(), _TEST_INPUT, _OUTPUT_UNKNOWN); _testMode( - const HtmlEscape(HtmlEscapeMode.unknown), _TEST_INPUT, _OUTPUT_UNKNOWN); - _testMode(const HtmlEscape(HtmlEscapeMode.attribute), _TEST_INPUT, - _OUTPUT_ATTRIBUTE); - _testMode(const HtmlEscape(HtmlEscapeMode.sqAttribute), _TEST_INPUT, - _OUTPUT_SQ_ATTRIBUTE); + const HtmlEscape(HtmlEscapeMode.unknown), + _TEST_INPUT, + _OUTPUT_UNKNOWN, + ); _testMode( - const HtmlEscape(HtmlEscapeMode.element), _TEST_INPUT, _OUTPUT_ELEMENT); + const HtmlEscape(HtmlEscapeMode.attribute), + _TEST_INPUT, + _OUTPUT_ATTRIBUTE, + ); + _testMode( + const HtmlEscape(HtmlEscapeMode.sqAttribute), + _TEST_INPUT, + _OUTPUT_SQ_ATTRIBUTE, + ); + _testMode( + const HtmlEscape(HtmlEscapeMode.element), + _TEST_INPUT, + _OUTPUT_ELEMENT, + ); _testMode(htmlEscape, _NOOP, _NOOP); }
diff --git a/tests/lib/convert/json_lib_test.dart b/tests/lib/convert/json_lib_test.dart index faad0cf..6c63ae2 100644 --- a/tests/lib/convert/json_lib_test.dart +++ b/tests/lib/convert/json_lib_test.dart
@@ -27,37 +27,61 @@ // Lists. Expect.deepEquals([], json.decode(' [] ')); Expect.deepEquals([], json.decode('[ ]')); - Expect.deepEquals([3, -4.5, true, 'hi', false], - json.decode(' [3, -4.5, true, "hi", false] ')); + Expect.deepEquals([ + 3, + -4.5, + true, + 'hi', + false, + ], json.decode(' [3, -4.5, true, "hi", false] ')); // Nulls are tricky. Expect.deepEquals([null], json.decode('[null]')); - Expect.deepEquals([3, -4.5, null, true, 'hi', false], - json.decode(' [3, -4.5, null, true, "hi", false] ')); Expect.deepEquals([ - [null] + 3, + -4.5, + null, + true, + 'hi', + false, + ], json.decode(' [3, -4.5, null, true, "hi", false] ')); + Expect.deepEquals([ + [null], ], json.decode('[[null]]')); Expect.deepEquals([ [3], [], [null], - ['hi', true] + ['hi', true], ], json.decode(' [ [3], [], [null], ["hi", true]] ')); // Maps. Expect.deepEquals({}, json.decode(' {} ')); Expect.deepEquals({}, json.decode('{ }')); - Expect.deepEquals({"x": 3, "y": -4.5, "z": "hi", "u": true, "v": false}, - json.decode(' {"x":3, "y": -4.5, "z" : "hi","u" : true, "v": false } ')); + Expect.deepEquals({ + "x": 3, + "y": -4.5, + "z": "hi", + "u": true, + "v": false, + }, json.decode(' {"x":3, "y": -4.5, "z" : "hi","u" : true, "v": false } ')); - Expect.deepEquals({"x": 3, "y": -4.5, "z": "hi"}, - json.decode(' {"x":3, "y": -4.5, "z" : "hi" } ')); + Expect.deepEquals({ + "x": 3, + "y": -4.5, + "z": "hi", + }, json.decode(' {"x":3, "y": -4.5, "z" : "hi" } ')); - Expect.deepEquals({"y": -4.5, "z": "hi", "x": 3}, - json.decode(' {"y": -4.5, "z" : "hi" ,"x":3 } ')); + Expect.deepEquals({ + "y": -4.5, + "z": "hi", + "x": 3, + }, json.decode(' {"y": -4.5, "z" : "hi" ,"x":3 } ')); - Expect.deepEquals( - {" hi bob ": 3, "": 4.5}, json.decode('{ " hi bob " :3, "": 4.5}')); + Expect.deepEquals({ + " hi bob ": 3, + "": 4.5, + }, json.decode('{ " hi bob " :3, "": 4.5}')); Expect.deepEquals({'x': {}}, json.decode(' { "x" : { } } ')); Expect.deepEquals({'x': {}}, json.decode('{"x":{}}')); @@ -66,24 +90,30 @@ Expect.deepEquals({'w': null}, json.decode('{"w":null}')); Expect.deepEquals({ - "x": {"w": null} + "x": {"w": null}, }, json.decode('{"x":{"w":null}}')); Expect.deepEquals( - {"x": 3, "y": -4.5, "z": "hi", "w": null, "u": true, "v": false}, - json.decode(' {"x":3, "y": -4.5, "z" : "hi",' - '"w":null, "u" : true, "v": false } ')); + {"x": 3, "y": -4.5, "z": "hi", "w": null, "u": true, "v": false}, + json.decode( + ' {"x":3, "y": -4.5, "z" : "hi",' + '"w":null, "u" : true, "v": false } ', + ), + ); Expect.deepEquals( - { - "x": {"a": 3, "b": -4.5}, - "y": [{}], - "z": "hi", - "w": {"c": null, "d": true}, - "v": null - }, - json.decode('{"x": {"a":3, "b": -4.5}, "y":[{}], ' - '"z":"hi","w":{"c":null,"d":true}, "v":null}')); + { + "x": {"a": 3, "b": -4.5}, + "y": [{}], + "z": "hi", + "w": {"c": null, "d": true}, + "v": null, + }, + json.decode( + '{"x": {"a":3, "b": -4.5}, "y":[{}], ' + '"z":"hi","w":{"c":null,"d":true}, "v":null}', + ), + ); } void testStringify() { @@ -108,28 +138,36 @@ Expect.equals('[null,null,null]', json.encode(new List.filled(3, null))); validateRoundTrip([3, -4.5, null, true, 'hi', false]); Expect.equals( - '[[3],[],[null],["hi",true]]', - json.encode([ - [3], - [], - [null], - ['hi', true] - ])); + '[[3],[],[null],["hi",true]]', + json.encode([ + [3], + [], + [null], + ['hi', true], + ]), + ); // Maps. Expect.equals('{}', json.encode({})); Expect.equals('{}', json.encode(new Map())); Expect.equals('{"x":{}}', json.encode({'x': {}})); Expect.equals( - '{"x":{"a":3}}', - json.encode({ - 'x': {'a': 3} - })); + '{"x":{"a":3}}', + json.encode({ + 'x': {'a': 3}, + }), + ); // Dart does not guarantee an order on the keys // of a map literal, so reparse and compare to the original Map. - validateRoundTrip( - {'x': 3, 'y': -4.5, 'z': 'hi', 'w': null, 'u': true, 'v': false}); + validateRoundTrip({ + 'x': 3, + 'y': -4.5, + 'z': 'hi', + 'w': null, + 'u': true, + 'v': false, + }); validateRoundTrip({"x": 3, "y": -4.5, "z": 'hi'}); validateRoundTrip({' hi bob ': 3, '': 4.5}); validateRoundTrip({ @@ -137,17 +175,20 @@ 'y': [{}], 'z': 'hi', 'w': {'c': null, 'd': true}, - 'v': null + 'v': null, }); Expect.equals("4", json.encode(new ToJson(4))); Expect.equals('[4,"a"]', json.encode(new ToJson([4, "a"]))); Expect.equals( - '[4,{"x":42}]', - json.encode(new ToJson([ + '[4,{"x":42}]', + json.encode( + new ToJson([ 4, - new ToJson({"x": 42}) - ]))); + new ToJson({"x": 42}), + ]), + ), + ); expectThrowsJsonError(() => json.encode([new ToJson(new ToJson(4))])); expectThrowsJsonError(() => json.encode([new Object()])); @@ -161,8 +202,7 @@ expectThrowsJsonError(() => json.encode(new ToJsoner("bad", throws: true))); // Throws if toJson returns non-serializable value. - expectThrowsJsonError( - () => json.encode(new ToJsoner(new TestClass()))); + expectThrowsJsonError(() => json.encode(new ToJsoner(new TestClass()))); // Throws on cyclic values. var a = []; @@ -182,9 +222,7 @@ int x; String y; - TestClass() - : x = 3, - y = 'joe' {} + TestClass() : x = 3, y = 'joe' {} } class ToJsoner {
diff --git a/tests/lib/convert/json_pretty_test.dart b/tests/lib/convert/json_pretty_test.dart index 78a4752..cc8d39d 100644 --- a/tests/lib/convert/json_pretty_test.dart +++ b/tests/lib/convert/json_pretty_test.dart
@@ -15,7 +15,7 @@ var encoder = const JsonEncoder.withIndent('\x00'); var encoded = encoder.convert([ [], - [[]] + [[]], ]); Expect.equals("[\n\x00[],\n\x00[\n\x00\x00[]\n\x00]\n]", encoded); } @@ -25,57 +25,71 @@ _expect(null, 'null'); - _expect([ - [], - [[]] - ], ''' + _expect( + [ + [], + [[]], + ], + ''' [ [], [ [] ] -]'''); +]''', + ); - _expect([1, 2, 3, 4], ''' + _expect( + [1, 2, 3, 4], + ''' [ 1, 2, 3, 4 -]'''); +]''', + ); - _expect([true, null, 'hello', 42.42], ''' + _expect( + [true, null, 'hello', 42.42], + ''' [ true, null, "hello", 42.42 -]'''); +]''', + ); - _expect({"hello": [], "goodbye": {}}, '''{ + _expect( + {"hello": [], "goodbye": {}}, + '''{ "hello": [], "goodbye": {} -}'''); +}''', + ); - _expect([ - "test", - 1, - 2, - 33234.324, - true, - false, - null, - { - "test1": "test2", - "test3": "test4", - "grace": 5, - "shanna": [0, 1, 2] - }, - { - "lib": "app.dart", - "src": ["foo.dart", "bar.dart"] - } - ], '''[ + _expect( + [ + "test", + 1, + 2, + 33234.324, + true, + false, + null, + { + "test1": "test2", + "test3": "test4", + "grace": 5, + "shanna": [0, 1, 2], + }, + { + "lib": "app.dart", + "src": ["foo.dart", "bar.dart"], + }, + ], + '''[ "test", 1, 2, @@ -100,7 +114,8 @@ "bar.dart" ] } -]'''); +]''', + ); } void _expect(Object? object, String expected) {
diff --git a/tests/lib/convert/json_test.dart b/tests/lib/convert/json_test.dart index 7190a7b..4763781 100644 --- a/tests/lib/convert/json_test.dart +++ b/tests/lib/convert/json_test.dart
@@ -19,17 +19,25 @@ } } else if (expected is Map) { Expect.isTrue(actual is Map); - Expect.equals(expected.length, actual.length, - "$path: Map size in $jsonText"); + Expect.equals( + expected.length, + actual.length, + "$path: Map size in $jsonText", + ); expected.forEach((key, value) { Expect.isTrue(actual.containsKey(key)); compare(value, actual[key], "$path[$key] in $jsonText"); }); } else if (expected is num) { - Expect.equals(expected is int, actual is int, - "$path: not same number type in $jsonText"); - Expect.isTrue(expected.compareTo(actual) == 0, - "$path: Expected: $expected, was: $actual in $jsonText"); + Expect.equals( + expected is int, + actual is int, + "$path: not same number type in $jsonText", + ); + Expect.isTrue( + expected.compareTo(actual) == 0, + "$path: Expected: $expected, was: $actual in $jsonText", + ); } else { // String, bool, null. Expect.equals(expected, actual, "$path in $jsonText"); @@ -99,7 +107,10 @@ sb.writeCharCode(code); else { String hex = '000${code.toRadixString(16)}'; - sb.write(r'\u' '${hex.substring(hex.length - 4)}'); + sb.write( + r'\u' + '${hex.substring(hex.length - 4)}', + ); } } return '$sb'; @@ -107,15 +118,22 @@ void testThrows(jsonText) { var message = "json = '${escape(jsonText)}'"; - Expect.throwsFormatException(() => json.decode(jsonText), - "json.decode, $message"); - Expect.throwsFormatException(() => jsonDecode(jsonText), - "jsonDecode, $message"); - Expect.throwsFormatException(() => json.decoder.convert(jsonText), - "json.decoder.convert, $message"); - Expect.throwsFormatException(() => - utf8.decoder.fuse(json.decoder).convert(utf8.encode(jsonText)), - "utf8.decoder.fuse(json.decoder) o utf.encode, $message"); + Expect.throwsFormatException( + () => json.decode(jsonText), + "json.decode, $message", + ); + Expect.throwsFormatException( + () => jsonDecode(jsonText), + "jsonDecode, $message", + ); + Expect.throwsFormatException( + () => json.decoder.convert(jsonText), + "json.decoder.convert, $message", + ); + Expect.throwsFormatException( + () => utf8.decoder.fuse(json.decoder).convert(utf8.encode(jsonText)), + "utf8.decoder.fuse(json.decoder) o utf.encode, $message", + ); } testNumbers() { @@ -255,7 +273,9 @@ testStrings() { // String parser accepts and understands escapes. - var input = r'"\u0000\uffff\n\r\f\t\b\/\\\"' '\x20\ufffd\uffff"'; + var input = + r'"\u0000\uffff\n\r\f\t\b\/\\\"' + '\x20\ufffd\uffff"'; var expected = "\u0000\uffff\n\r\f\t\b\/\\\"\x20\ufffd\uffff"; testJson(input, expected); // Empty string. @@ -314,8 +334,8 @@ testJson(r'{"x":42}', {"x": 42}); testJson(r'{"x":{"x":{"x":42}}}', { "x": { - "x": {"x": 42} - } + "x": {"x": 42}, + }, }); testJson(r'{"x":10,"x":42}', {"x": 42}); testJson(r'{"":42}', {"": 42}); @@ -334,25 +354,31 @@ testArrays() { testJson(r'[]', []); - testJson(r'[1.1e1,"string",true,false,null,{}]', - [1.1e1, "string", true, false, null, {}]); + testJson(r'[1.1e1,"string",true,false,null,{}]', [ + 1.1e1, + "string", + true, + false, + null, + {}, + ]); testJson(r'[[[[[[]]]],[[[]]],[[]]]]', [ [ [ [ - [[]] - ] + [[]], + ], ], [ - [[]] + [[]], ], - [[]] - ] + [[]], + ], ]); testJson(r'[{},[{}],{"x":[]}]', [ {}, [{}], - {"x": []} + {"x": []}, ]); testThrows(r'[1,,2]'); @@ -389,7 +415,7 @@ testJson('$v[${v}-2.2e2$v,$v{$v"key"$v:${v}true$v}$v,$v"ab"$v]$v', [ -2.2e2, {"key": true}, - "ab" + "ab", ]); // IE9 accepts invalid characters at the end, so some of these tests have been
diff --git a/tests/lib/convert/json_toEncodable_reviver_test.dart b/tests/lib/convert/json_toEncodable_reviver_test.dart index 584300d..e86803d 100644 --- a/tests/lib/convert/json_toEncodable_reviver_test.dart +++ b/tests/lib/convert/json_toEncodable_reviver_test.dart
@@ -20,13 +20,15 @@ return value; } -const extendedJson = - const JsonCodec(toEncodable: toEncodable, reviver: reviver); +const extendedJson = const JsonCodec( + toEncodable: toEncodable, + reviver: reviver, +); main() { var encoded = extendedJson.encode([ new A(0), - {"2": new A(1)} + {"2": new A(1)}, ]); Expect.equals('[{"A":0},{"2":{"A":1}}]', encoded); var decoded = extendedJson.decode(encoded);
diff --git a/tests/lib/convert/json_unicode_tests.dart b/tests/lib/convert/json_unicode_tests.dart index 5403c61..331b1b9 100644 --- a/tests/lib/convert/json_unicode_tests.dart +++ b/tests/lib/convert/json_unicode_tests.dart
@@ -39,8 +39,8 @@ // For example: 'abcd' -> '[[["abcd"]]]'. var listExpected = [ [ - [string] - ] + [string], + ], ]; var inListBytes = <int>[]; inListBytes.addAll([_bracketOpen, _bracketOpen, _bracketOpen]);
diff --git a/tests/lib/convert/json_utf8_chunk_test.dart b/tests/lib/convert/json_utf8_chunk_test.dart index e75019d..589fa59 100644 --- a/tests/lib/convert/json_utf8_chunk_test.dart +++ b/tests/lib/convert/json_utf8_chunk_test.dart
@@ -20,9 +20,14 @@ // Create an UTF-8 sink from a chunked JSON decoder, then let [action] // put data into it, and check that what comes out is equal to [expect]. void jsonTest(testName, expect, action(sink), [bool allowMalformed = false]) { - jsonParse(testName, (value) { - Expect.equals(expect, value, "$testName:$value"); - }, action, allowMalformed); + jsonParse( + testName, + (value) { + Expect.equals(expect, value, "$testName:$value"); + }, + action, + allowMalformed, + ); } void jsonParse(testName, check, action, [bool allowMalformed = false]) { @@ -30,8 +35,9 @@ var value = values[0]; check(value); }); - var decoderSink = - json.decoder.startChunkedConversion(sink).asUtf8Sink(allowMalformed); + var decoderSink = json.decoder + .startChunkedConversion(sink) + .asUtf8Sink(allowMalformed); try { action(decoderSink); } on FormatException catch (e, s) { @@ -43,10 +49,12 @@ void testStrings() { // String literal containing characters, all escape types, // and a number of UTF-8 encoded characters. - var s = r'"abc\f\ndef\r\t\b\"\/\\\u0001\u9999\uffff' + var s = + r'"abc\f\ndef\r\t\b\"\/\\\u0001\u9999\uffff' '\x7f\xc2\x80\xdf\xbf\xe0\xa0\x80\xef\xbf\xbf' '\xf0\x90\x80\x80\xf4\x8f\xbf\xbf"'; // UTF-8. - var expected = "abc\f\ndef\r\t\b\"\/\\\u0001\u9999\uffff" + var expected = + "abc\f\ndef\r\t\b\"\/\\\u0001\u9999\uffff" "\x7f\x80\u07ff\u0800\uffff" "\u{10000}\u{10ffff}"; for (var i = 1; i < s.length - 1; i++) { @@ -84,7 +92,7 @@ "9", "1234.56789123456701418035663664340972900390625", "1.2345678912345671e-14", - "9223372036854775807" + "9223372036854775807", ]) { var expected = num.parse(number); for (int i = 1; i < number.length - 1; i++) { @@ -200,8 +208,9 @@ var value = values[0]; Expect.equals(expect, value, tag); }); - var decoderSink = - json.decoder.startChunkedConversion(sink).asUtf8Sink(true); + var decoderSink = json.decoder + .startChunkedConversion(sink) + .asUtf8Sink(true); try { action(decoderSink); } catch (e, s) { @@ -213,11 +222,16 @@ var sink = new ChunkedConversionSink.withCallback((values) { Expect.fail(tag); }); - var decoderSink = - json.decoder.startChunkedConversion(sink).asUtf8Sink(false); - Expect.throws(() { - action(decoderSink); - }, (_) => true, tag); + var decoderSink = json.decoder + .startChunkedConversion(sink) + .asUtf8Sink(false); + Expect.throws( + () { + action(decoderSink); + }, + (_) => true, + tag, + ); } } @@ -251,11 +265,16 @@ var sink = new ChunkedConversionSink.withCallback((values) { Expect.fail(tag); }); - var decoderSink = - json.decoder.startChunkedConversion(sink).asUtf8Sink(true); - Expect.throws(() { - action(decoderSink); - }, (_) => true, tag); + var decoderSink = json.decoder + .startChunkedConversion(sink) + .asUtf8Sink(true); + Expect.throws( + () { + action(decoderSink); + }, + (_) => true, + tag, + ); } var codes = codeString.codeUnits; @@ -283,103 +302,350 @@ // Malformed UTF-8 encodings. void testMalformed() { // Overlong encodings. - jsonMalformedTest( - "overlong-0-2", "@\uFFFD\uFFFD@", [0x22, 0x40, 0xc0, 0x80, 0x40, 0x22]); - jsonMalformedTest("overlong-0-3", "@\uFFFD\uFFFD\uFFFD@", - [0x22, 0x40, 0xe0, 0x80, 0x80, 0x40, 0x22]); - jsonMalformedTest("overlong-0-4", "@\uFFFD\uFFFD\uFFFD\uFFFD@", - [0x22, 0x40, 0xf0, 0x80, 0x80, 0x80, 0x40, 0x22]); + jsonMalformedTest("overlong-0-2", "@\uFFFD\uFFFD@", [ + 0x22, + 0x40, + 0xc0, + 0x80, + 0x40, + 0x22, + ]); + jsonMalformedTest("overlong-0-3", "@\uFFFD\uFFFD\uFFFD@", [ + 0x22, + 0x40, + 0xe0, + 0x80, + 0x80, + 0x40, + 0x22, + ]); + jsonMalformedTest("overlong-0-4", "@\uFFFD\uFFFD\uFFFD\uFFFD@", [ + 0x22, + 0x40, + 0xf0, + 0x80, + 0x80, + 0x80, + 0x40, + 0x22, + ]); - jsonMalformedTest( - "overlong-7f-2", "@\uFFFD\uFFFD@", [0x22, 0x40, 0xc1, 0xbf, 0x40, 0x22]); - jsonMalformedTest("overlong-7f-3", "@\uFFFD\uFFFD\uFFFD@", - [0x22, 0x40, 0xe0, 0x81, 0xbf, 0x40, 0x22]); - jsonMalformedTest("overlong-7f-4", "@\uFFFD\uFFFD\uFFFD\uFFFD@", - [0x22, 0x40, 0xf0, 0x80, 0x81, 0xbf, 0x40, 0x22]); + jsonMalformedTest("overlong-7f-2", "@\uFFFD\uFFFD@", [ + 0x22, + 0x40, + 0xc1, + 0xbf, + 0x40, + 0x22, + ]); + jsonMalformedTest("overlong-7f-3", "@\uFFFD\uFFFD\uFFFD@", [ + 0x22, + 0x40, + 0xe0, + 0x81, + 0xbf, + 0x40, + 0x22, + ]); + jsonMalformedTest("overlong-7f-4", "@\uFFFD\uFFFD\uFFFD\uFFFD@", [ + 0x22, + 0x40, + 0xf0, + 0x80, + 0x81, + 0xbf, + 0x40, + 0x22, + ]); - jsonMalformedTest("overlong-80-3", "@\uFFFD\uFFFD\uFFFD@", - [0x22, 0x40, 0xe0, 0x82, 0x80, 0x40, 0x22]); - jsonMalformedTest("overlong-80-4", "@\uFFFD\uFFFD\uFFFD\uFFFD@", - [0x22, 0x40, 0xf0, 0x80, 0x82, 0x80, 0x40, 0x22]); + jsonMalformedTest("overlong-80-3", "@\uFFFD\uFFFD\uFFFD@", [ + 0x22, + 0x40, + 0xe0, + 0x82, + 0x80, + 0x40, + 0x22, + ]); + jsonMalformedTest("overlong-80-4", "@\uFFFD\uFFFD\uFFFD\uFFFD@", [ + 0x22, + 0x40, + 0xf0, + 0x80, + 0x82, + 0x80, + 0x40, + 0x22, + ]); - jsonMalformedTest("overlong-7ff-3", "@\uFFFD\uFFFD\uFFFD@", - [0x22, 0x40, 0xe0, 0x9f, 0xbf, 0x40, 0x22]); - jsonMalformedTest("overlong-7ff-4", "@\uFFFD\uFFFD\uFFFD\uFFFD@", - [0x22, 0x40, 0xf0, 0x80, 0x9f, 0xbf, 0x40, 0x22]); + jsonMalformedTest("overlong-7ff-3", "@\uFFFD\uFFFD\uFFFD@", [ + 0x22, + 0x40, + 0xe0, + 0x9f, + 0xbf, + 0x40, + 0x22, + ]); + jsonMalformedTest("overlong-7ff-4", "@\uFFFD\uFFFD\uFFFD\uFFFD@", [ + 0x22, + 0x40, + 0xf0, + 0x80, + 0x9f, + 0xbf, + 0x40, + 0x22, + ]); - jsonMalformedTest("overlong-800-4", "@\uFFFD\uFFFD\uFFFD\uFFFD@", - [0x22, 0x40, 0xf0, 0x80, 0xa0, 0x80, 0x40, 0x22]); - jsonMalformedTest("overlong-ffff-4", "@\uFFFD\uFFFD\uFFFD\uFFFD@", - [0x22, 0x40, 0xf0, 0x8f, 0xbf, 0xbf, 0x40, 0x22]); + jsonMalformedTest("overlong-800-4", "@\uFFFD\uFFFD\uFFFD\uFFFD@", [ + 0x22, + 0x40, + 0xf0, + 0x80, + 0xa0, + 0x80, + 0x40, + 0x22, + ]); + jsonMalformedTest("overlong-ffff-4", "@\uFFFD\uFFFD\uFFFD\uFFFD@", [ + 0x22, + 0x40, + 0xf0, + 0x8f, + 0xbf, + 0xbf, + 0x40, + 0x22, + ]); // Unterminated multibyte sequences. - jsonMalformedTest( - "unterminated-2-normal", "@\uFFFD@", [0x22, 0x40, 0xc0, 0x40, 0x22]); + jsonMalformedTest("unterminated-2-normal", "@\uFFFD@", [ + 0x22, + 0x40, + 0xc0, + 0x40, + 0x22, + ]); - jsonMalformedTest("unterminated-3-normal", "@\uFFFD\uFFFD@", - [0x22, 0x40, 0xe0, 0x80, 0x40, 0x22]); + jsonMalformedTest("unterminated-3-normal", "@\uFFFD\uFFFD@", [ + 0x22, + 0x40, + 0xe0, + 0x80, + 0x40, + 0x22, + ]); - jsonMalformedTest("unterminated-4-normal", "@\uFFFD\uFFFD\uFFFD@", - [0x22, 0x40, 0xf0, 0x80, 0x80, 0x40, 0x22]); + jsonMalformedTest("unterminated-4-normal", "@\uFFFD\uFFFD\uFFFD@", [ + 0x22, + 0x40, + 0xf0, + 0x80, + 0x80, + 0x40, + 0x22, + ]); - jsonMalformedTest("unterminated-2-multi", "@\uFFFD\x80@", - [0x22, 0x40, 0xc0, 0xc2, 0x80, 0x40, 0x22]); + jsonMalformedTest("unterminated-2-multi", "@\uFFFD\x80@", [ + 0x22, + 0x40, + 0xc0, + 0xc2, + 0x80, + 0x40, + 0x22, + ]); - jsonMalformedTest("unterminated-3-multi", "@\uFFFD\uFFFD\x80@", - [0x22, 0x40, 0xe0, 0x80, 0xc2, 0x80, 0x40, 0x22]); + jsonMalformedTest("unterminated-3-multi", "@\uFFFD\uFFFD\x80@", [ + 0x22, + 0x40, + 0xe0, + 0x80, + 0xc2, + 0x80, + 0x40, + 0x22, + ]); - jsonMalformedTest("unterminated-4-multi", "@\uFFFD\uFFFD\uFFFD\x80@", - [0x22, 0x40, 0xf0, 0x80, 0x80, 0xc2, 0x80, 0x40, 0x22]); + jsonMalformedTest("unterminated-4-multi", "@\uFFFD\uFFFD\uFFFD\x80@", [ + 0x22, + 0x40, + 0xf0, + 0x80, + 0x80, + 0xc2, + 0x80, + 0x40, + 0x22, + ]); - jsonMalformedTest("unterminated-2-escape", "@\uFFFD\n@", - [0x22, 0x40, 0xc0, 0x5c, 0x6e, 0x40, 0x22]); + jsonMalformedTest("unterminated-2-escape", "@\uFFFD\n@", [ + 0x22, + 0x40, + 0xc0, + 0x5c, + 0x6e, + 0x40, + 0x22, + ]); - jsonMalformedTest("unterminated-3-escape", "@\uFFFD\uFFFD\n@", - [0x22, 0x40, 0xe0, 0x80, 0x5c, 0x6e, 0x40, 0x22]); + jsonMalformedTest("unterminated-3-escape", "@\uFFFD\uFFFD\n@", [ + 0x22, + 0x40, + 0xe0, + 0x80, + 0x5c, + 0x6e, + 0x40, + 0x22, + ]); - jsonMalformedTest("unterminated-4-escape", "@\uFFFD\uFFFD\uFFFD\n@", - [0x22, 0x40, 0xf0, 0x80, 0x80, 0x5c, 0x6e, 0x40, 0x22]); + jsonMalformedTest("unterminated-4-escape", "@\uFFFD\uFFFD\uFFFD\n@", [ + 0x22, + 0x40, + 0xf0, + 0x80, + 0x80, + 0x5c, + 0x6e, + 0x40, + 0x22, + ]); jsonMalformedTest("unterminated-2-end", "@\uFFFD", [0x22, 0x40, 0xc0, 0x22]); - jsonMalformedTest( - "unterminated-3-end", "@\uFFFD\uFFFD", [0x22, 0x40, 0xe0, 0x80, 0x22]); + jsonMalformedTest("unterminated-3-end", "@\uFFFD\uFFFD", [ + 0x22, + 0x40, + 0xe0, + 0x80, + 0x22, + ]); - jsonMalformedTest("unterminated-4-end", "@\uFFFD\uFFFD\uFFFD", - [0x22, 0x40, 0xf0, 0x80, 0x80, 0x22]); + jsonMalformedTest("unterminated-4-end", "@\uFFFD\uFFFD\uFFFD", [ + 0x22, + 0x40, + 0xf0, + 0x80, + 0x80, + 0x22, + ]); // Unexpected continuation byte // - after a normal character. - jsonMalformedTest( - "continuation-normal", "@\uFFFD@", [0x22, 0x40, 0x80, 0x40, 0x22]); + jsonMalformedTest("continuation-normal", "@\uFFFD@", [ + 0x22, + 0x40, + 0x80, + 0x40, + 0x22, + ]); // - after a valid continuation byte. - jsonMalformedTest("continuation-continuation-2", "@\x80\uFFFD@", - [0x22, 0x40, 0xc2, 0x80, 0x80, 0x40, 0x22]); - jsonMalformedTest("continuation-continuation-3", "@\u0800\uFFFD@", - [0x22, 0x40, 0xe0, 0xa0, 0x80, 0x80, 0x40, 0x22]); - jsonMalformedTest("continuation-continuation-4", "@\u{10000}\uFFFD@", - [0x22, 0x40, 0xf0, 0x90, 0x80, 0x80, 0x80, 0x40, 0x22]); + jsonMalformedTest("continuation-continuation-2", "@\x80\uFFFD@", [ + 0x22, + 0x40, + 0xc2, + 0x80, + 0x80, + 0x40, + 0x22, + ]); + jsonMalformedTest("continuation-continuation-3", "@\u0800\uFFFD@", [ + 0x22, + 0x40, + 0xe0, + 0xa0, + 0x80, + 0x80, + 0x40, + 0x22, + ]); + jsonMalformedTest("continuation-continuation-4", "@\u{10000}\uFFFD@", [ + 0x22, + 0x40, + 0xf0, + 0x90, + 0x80, + 0x80, + 0x80, + 0x40, + 0x22, + ]); // - after another invalid continuation byte - jsonMalformedTest("continuation-twice", "@\uFFFD\uFFFD\uFFFD@", - [0x22, 0x40, 0x80, 0x80, 0x80, 0x40, 0x22]); + jsonMalformedTest("continuation-twice", "@\uFFFD\uFFFD\uFFFD@", [ + 0x22, + 0x40, + 0x80, + 0x80, + 0x80, + 0x40, + 0x22, + ]); // - at start. jsonMalformedTest("continuation-start", "\uFFFD@", [0x22, 0x80, 0x40, 0x22]); // Unexpected leading byte where continuation byte expected. - jsonMalformedTest( - "leading-2", "@\uFFFD\x80@", [0x22, 0x40, 0xc0, 0xc2, 0x80, 0x40, 0x22]); - jsonMalformedTest("leading-3-1", "@\uFFFD\x80@", - [0x22, 0x40, 0xe0, 0xc2, 0x80, 0x40, 0x22]); - jsonMalformedTest("leading-3-2", "@\uFFFD\uFFFD\x80@", - [0x22, 0x40, 0xe0, 0x80, 0xc2, 0x80, 0x40, 0x22]); - jsonMalformedTest("leading-4-1", "@\uFFFD\x80@", - [0x22, 0x40, 0xf0, 0xc2, 0x80, 0x40, 0x22]); - jsonMalformedTest("leading-4-2", "@\uFFFD\uFFFD\x80@", - [0x22, 0x40, 0xf0, 0x80, 0xc2, 0x80, 0x40, 0x22]); - jsonMalformedTest("leading-4-3", "@\uFFFD\uFFFD\uFFFD\x80@", - [0x22, 0x40, 0xf0, 0x80, 0x80, 0xc2, 0x80, 0x40, 0x22]); + jsonMalformedTest("leading-2", "@\uFFFD\x80@", [ + 0x22, + 0x40, + 0xc0, + 0xc2, + 0x80, + 0x40, + 0x22, + ]); + jsonMalformedTest("leading-3-1", "@\uFFFD\x80@", [ + 0x22, + 0x40, + 0xe0, + 0xc2, + 0x80, + 0x40, + 0x22, + ]); + jsonMalformedTest("leading-3-2", "@\uFFFD\uFFFD\x80@", [ + 0x22, + 0x40, + 0xe0, + 0x80, + 0xc2, + 0x80, + 0x40, + 0x22, + ]); + jsonMalformedTest("leading-4-1", "@\uFFFD\x80@", [ + 0x22, + 0x40, + 0xf0, + 0xc2, + 0x80, + 0x40, + 0x22, + ]); + jsonMalformedTest("leading-4-2", "@\uFFFD\uFFFD\x80@", [ + 0x22, + 0x40, + 0xf0, + 0x80, + 0xc2, + 0x80, + 0x40, + 0x22, + ]); + jsonMalformedTest("leading-4-3", "@\uFFFD\uFFFD\uFFFD\x80@", [ + 0x22, + 0x40, + 0xf0, + 0x80, + 0x80, + 0xc2, + 0x80, + 0x40, + 0x22, + ]); // Overlong encodings of ASCII outside of strings always fail. // Use Latin-1 strings as argument since most chars are correct,
diff --git a/tests/lib/convert/json_utf8_test.dart b/tests/lib/convert/json_utf8_test.dart index beb6c99..9610f3cb 100644 --- a/tests/lib/convert/json_utf8_test.dart +++ b/tests/lib/convert/json_utf8_test.dart
@@ -19,21 +19,22 @@ // String (0x22 = ") with UTF-8 encoded Unicode characters. Expect.equals( - "A\xff\u1234\u{65555}", - parse([ - 0x22, - 0x41, - 0xc3, - 0xbf, - 0xe1, - 0x88, - 0xb4, - 0xf1, - 0xa5, - 0x95, - 0x95, - 0x22 - ])); + "A\xff\u1234\u{65555}", + parse([ + 0x22, + 0x41, + 0xc3, + 0xbf, + 0xe1, + 0x88, + 0xb4, + 0xf1, + 0xa5, + 0x95, + 0x95, + 0x22, + ]), + ); // BOM followed by true. Expect.isTrue(parse([0xEF, 0xBB, 0xBF, 0x74, 0x72, 0x75, 0x65])); @@ -41,18 +42,22 @@ // Do not accept BOM in non-UTF-8 decoder. Expect.throws<FormatException>( - () => new JsonDecoder().convert("\xEF\xBB\xBFtrue")); + () => new JsonDecoder().convert("\xEF\xBB\xBFtrue"), + ); Expect.throws<FormatException>(() => new JsonDecoder().convert("\uFEFFtrue")); // Only accept BOM first. Expect.throws<FormatException>( - () => parseFuse(" \xEF\xBB\xBFtrue".codeUnits.toList())); + () => parseFuse(" \xEF\xBB\xBFtrue".codeUnits.toList()), + ); // Only accept BOM first. Expect.throws<FormatException>( - () => parseFuse(" true\xEF\xBB\xBF".codeUnits.toList())); + () => parseFuse(" true\xEF\xBB\xBF".codeUnits.toList()), + ); Expect.throws<FormatException>( - () => parseFuse(" [\xEF\xBB\xBF]".codeUnits.toList())); + () => parseFuse(" [\xEF\xBB\xBF]".codeUnits.toList()), + ); // Regression test for dartbug.com/46205 // Bug occurs in sound null safe mode only. @@ -69,10 +74,13 @@ Object? parseChunked(List<int> text) { var result; - var sink = new Utf8Decoder().fuse(new JsonDecoder()).startChunkedConversion( - new ChunkedConversionSink.withCallback((List<Object?> values) { - result = values[0]; - })); + var sink = new Utf8Decoder() + .fuse(new JsonDecoder()) + .startChunkedConversion( + new ChunkedConversionSink.withCallback((List<Object?> values) { + result = values[0]; + }), + ); for (var i = 0; i < text.length; i++) { sink.add([text[i]]); }
diff --git a/tests/lib/convert/json_util_test.dart b/tests/lib/convert/json_util_test.dart index bf945f9..210e8bd 100644 --- a/tests/lib/convert/json_util_test.dart +++ b/tests/lib/convert/json_util_test.dart
@@ -82,8 +82,10 @@ // Maps. Expect.mapEquals({}, json.decode(' {} ')); Expect.mapEquals({"key": "value"}, json.decode(' {"key": "value" } ')); - Expect.mapEquals( - {"key1": 1, "key2": 2}, json.decode(' {"key1": 1, "key2": 2} ')); + Expect.mapEquals({ + "key1": 1, + "key2": 2, + }, json.decode(' {"key1": 1, "key2": 2} ')); Expect.mapEquals({"key1": 1}, json.decode(' { "key1" : 1 } ')); } @@ -171,8 +173,12 @@ Expect.stringEquals('"\\u001f"', json.encode('\u001f')); Expect.stringEquals('"\\\""', json.encode('"')); Expect.stringEquals('"\\\\"', json.encode('\\')); - Expect.stringEquals('"Got \\b, \\f, \\n, \\r, \\t, \\u0000, \\\\, and \\"."', - json.encode('Got \b, \f, \n, \r, \t, \u0000, \\, and ".')); - Expect.stringEquals('"Got \\b\\f\\n\\r\\t\\u0000\\\\\\"."', - json.encode('Got \b\f\n\r\t\u0000\\".')); + Expect.stringEquals( + '"Got \\b, \\f, \\n, \\r, \\t, \\u0000, \\\\, and \\"."', + json.encode('Got \b, \f, \n, \r, \t, \u0000, \\, and ".'), + ); + Expect.stringEquals( + '"Got \\b\\f\\n\\r\\t\\u0000\\\\\\"."', + json.encode('Got \b\f\n\r\t\u0000\\".'), + ); }
diff --git a/tests/lib/convert/latin1_test.dart b/tests/lib/convert/latin1_test.dart index 3ca055b..21fb1fc 100644 --- a/tests/lib/convert/latin1_test.dart +++ b/tests/lib/convert/latin1_test.dart
@@ -41,9 +41,13 @@ } for (var nonLatin1String in nonLatin1Strings) { - Expect.throws(() { - print(codec.encoder.convert(nonLatin1String)); - }, (_) => true, nonLatin1String); + Expect.throws( + () { + print(codec.encoder.convert(nonLatin1String)); + }, + (_) => true, + nonLatin1String, + ); } var encode = codec.encoder.convert; @@ -104,7 +108,10 @@ } List<int> encode( - String str, int chunkSize, Converter<String, List<int>> converter) { + String str, + int chunkSize, + Converter<String, List<int>> converter, +) { List<int> bytes = <int>[]; var byteSink = new ByteConversionSink.withCallback(bytes.addAll); var stringConversionSink = converter.startChunkedConversion(byteSink); @@ -120,7 +127,10 @@ } String decode( - List<int> bytes, int chunkSize, Converter<List<int>, String> converter) { + List<int> bytes, + int chunkSize, + Converter<List<int>, String> converter, +) { StringBuffer buf = new StringBuffer(); var stringSink = new StringConversionSink.fromStringSink(buf); var byteConversionSink = converter.startChunkedConversion(stringSink); @@ -140,7 +150,7 @@ for (var converter in [ latin1.encoder, new Latin1Codec().encoder, - new Latin1Encoder() + new Latin1Encoder(), ]) { for (int chunkSize in [1, 2, 5, 50]) { for (var latin1String in latin1Strings) { @@ -159,7 +169,7 @@ for (var converter in [ latin1.decoder, new Latin1Codec().decoder, - new Latin1Decoder() + new Latin1Decoder(), ]) { for (int chunkSize in [1, 2, 5, 50]) { for (var latin1String in latin1Strings) {
diff --git a/tests/lib/convert/line_splitter_performance_test.dart b/tests/lib/convert/line_splitter_performance_test.dart index 7d23f8e..6f88ac8 100644 --- a/tests/lib/convert/line_splitter_performance_test.dart +++ b/tests/lib/convert/line_splitter_performance_test.dart
@@ -22,15 +22,16 @@ // Before fix, with N = 100000, took 25 seconds. const N = 1000000; String result = ""; // Starts empty, set once. - var sink = LineSplitter() - .startChunkedConversion(ChunkedConversionSink.withCallback((lines) { - // Gets called only once with exactly one line. - Expect.equals("", result); - Expect.equals(1, lines.length); - var line = lines.first; - Expect.notEquals("", line); - result = line; - })); + var sink = LineSplitter().startChunkedConversion( + ChunkedConversionSink.withCallback((lines) { + // Gets called only once with exactly one line. + Expect.equals("", result); + Expect.equals(1, lines.length); + var line = lines.first; + Expect.notEquals("", line); + result = line; + }), + ); for (var i = 0; i < N; i++) { sink.add("xy"); }
diff --git a/tests/lib/convert/line_splitter_test.dart b/tests/lib/convert/line_splitter_test.dart index 18b466c..261467e 100644 --- a/tests/lib/convert/line_splitter_test.dart +++ b/tests/lib/convert/line_splitter_test.dart
@@ -44,8 +44,9 @@ String _getLinesSliced(String str) { late String lines; - var stringSink = - new StringConversionSink.withCallback((result) => lines = result); + var stringSink = new StringConversionSink.withCallback( + (result) => lines = result, + ); var sink = new LineSplitter().startChunkedConversion(stringSink); const chunkSize = 3; @@ -74,14 +75,25 @@ var test = "Line1\nLine2\r\nLine3\rLine4\n\n\n\r\n\r\n\r\r"; var result = decoder.convert(test); - Expect.listEquals( - ['Line1', 'Line2', 'Line3', 'Line4', '', '', '', '', '', ''], result); + Expect.listEquals([ + 'Line1', + 'Line2', + 'Line3', + 'Line4', + '', + '', + '', + '', + '', + '', + ], result); } void testReadLine1() { var controller = new StreamController<List<int>>(sync: true); - var stream = - controller.stream.transform(utf8.decoder).transform(const LineSplitter()); + var stream = controller.stream + .transform(utf8.decoder) + .transform(const LineSplitter()); var stage = 0; var done = false; @@ -108,8 +120,9 @@ void testReadLine2() { var controller = new StreamController<List<int>>(sync: true); - var stream = - controller.stream.transform(utf8.decoder).transform(const LineSplitter()); + var stream = controller.stream + .transform(utf8.decoder) + .transform(const LineSplitter()); var expectedLines = [ 'Line1', @@ -123,7 +136,7 @@ '', '', 'Line5', - 'Line6' + 'Line6', ]; var index = 0; @@ -152,8 +165,18 @@ var test = "Line1\nLine2\r\nLine3\rLine4\n\n\n\r\n\r\n\r\r"; var result = LineSplitter.split(test).toList(); - Expect.listEquals( - ['Line1', 'Line2', 'Line3', 'Line4', '', '', '', '', '', ''], result); + Expect.listEquals([ + 'Line1', + 'Line2', + 'Line3', + 'Line4', + '', + '', + '', + '', + '', + '', + ], result); } void testSplitWithOffsets() { @@ -182,8 +205,18 @@ var result = LineSplitter.split(test).toList(); - Expect.listEquals( - ['Line1', 'Line2', 'Line3', 'Line4', '', '', '', '', '', ''], result); + Expect.listEquals([ + 'Line1', + 'Line2', + 'Line3', + 'Line4', + '', + '', + '', + '', + '', + '', + ], result); test = "a\n\nb\r\nc\n\rd\r\re\r\n\nf\r\n"; result = LineSplitter.split(test).toList(); @@ -210,8 +243,9 @@ for (int j = i; j < test.length; j++) { var output = []; var splitter = new LineSplitter(); - var outSink = - new ChunkedConversionSink<String>.withCallback(output.addAll); + var outSink = new ChunkedConversionSink<String>.withCallback( + output.addAll, + ); var sink = splitter.startChunkedConversion(outSink); sink.addSlice(test, 0, i, false); sink.addSlice(test, i, j, false);
diff --git a/tests/lib/convert/negative_utf8_codeunit_test.dart b/tests/lib/convert/negative_utf8_codeunit_test.dart index bfa3dff..6f5e735 100644 --- a/tests/lib/convert/negative_utf8_codeunit_test.dart +++ b/tests/lib/convert/negative_utf8_codeunit_test.dart
@@ -43,9 +43,10 @@ final stringSink = StringSink(); Expect.throwsFormatException( - () => utf8.decoder.startChunkedConversion(stringSink) - ..add(bytes) - ..close()); + () => utf8.decoder.startChunkedConversion(stringSink) + ..add(bytes) + ..close(), + ); } }
diff --git a/tests/lib/convert/streamed_conversion_json_decode1_test.dart b/tests/lib/convert/streamed_conversion_json_decode1_test.dart index 68a8a6b..d83ed45 100644 --- a/tests/lib/convert/streamed_conversion_json_decode1_test.dart +++ b/tests/lib/convert/streamed_conversion_json_decode1_test.dart
@@ -19,42 +19,42 @@ [[], "[]"], [ [3, -4.5, true, "hi", false], - '[3,-4.5,true,"hi",false]' + '[3,-4.5,true,"hi",false]', ], [ [null], - "[null]" + "[null]", ], [ [ - [null] + [null], ], - "[[null]]" + "[[null]]", ], [ [ - [3] + [3], ], - "[[3]]" + "[[3]]", ], [{}, "{}"], [ {"x": 3, "y": 4.5, "z": "hi", "u": true, "v": false}, - '{"x":3,"y":4.5,"z":"hi","u":true,"v":false}' + '{"x":3,"y":4.5,"z":"hi","u":true,"v":false}', ], [ {"x": null}, - '{"x":null}' + '{"x":null}', ], [ {"x": {}}, - '{"x":{}}' + '{"x":{}}', ], // Note that -0.0 won't be treated the same in JS. The Json spec seems to // allow it, though. [ {"hi there": 499, "'": -0.0}, - '{"hi there":499,"\'":-0.0}' + '{"hi there":499,"\'":-0.0}', ], [r'\foo', r'"\\foo"'], ]; @@ -83,10 +83,12 @@ Stream<Object?> createStream(List<String> chunks) { var decoder = new JsonDecoder(null); var controller; - controller = new StreamController<String>(onListen: () { - chunks.forEach(controller.add); - controller.close(); - }); + controller = new StreamController<String>( + onListen: () { + chunks.forEach(controller.add); + controller.close(); + }, + ); return controller.stream.transform(decoder); } @@ -110,14 +112,15 @@ var tests = TESTS.expand((test) { var object = test[0]; var string = test[1]; - var longString = " " + var longString = + " " " " "$string" " " " "; return [ test, - [object, longString] + [object, longString], ]; }); for (var test in tests) {
diff --git a/tests/lib/convert/streamed_conversion_json_encode1_test.dart b/tests/lib/convert/streamed_conversion_json_encode1_test.dart index 8653e3b..b925ce7 100644 --- a/tests/lib/convert/streamed_conversion_json_encode1_test.dart +++ b/tests/lib/convert/streamed_conversion_json_encode1_test.dart
@@ -19,42 +19,42 @@ [[], "[]"], [ [3, -4.5, true, "hi", false], - '[3,-4.5,true,"hi",false]' + '[3,-4.5,true,"hi",false]', ], [ [null], - "[null]" + "[null]", ], [ [ - [null] + [null], ], - "[[null]]" + "[[null]]", ], [ [ - [3] + [3], ], - "[[3]]" + "[[3]]", ], [{}, "{}"], [ {"x": 3, "y": 4.5, "z": "hi", "u": true, "v": false}, - '{"x":3,"y":4.5,"z":"hi","u":true,"v":false}' + '{"x":3,"y":4.5,"z":"hi","u":true,"v":false}', ], [ {"x": null}, - '{"x":null}' + '{"x":null}', ], [ {"x": {}}, - '{"x":{}}' + '{"x":{}}', ], // Note that -0.0 won't be treated the same in JS. The Json spec seems to // allow it, though. [ {"hi there": 499, "'": -0.0}, - '{"hi there":499,"\'":-0.0}' + '{"hi there":499,"\'":-0.0}', ], [r'\foo', r'"\\foo"'], ]; @@ -62,10 +62,12 @@ Stream<String> encode(Object? o) { var encoder = new JsonEncoder(); late StreamController controller; - controller = new StreamController(onListen: () { - controller.add(o); - controller.close(); - }); + controller = new StreamController( + onListen: () { + controller.add(o); + controller.close(); + }, + ); return controller.stream.transform(encoder); } @@ -85,13 +87,16 @@ Stream stream = encode(o); StringBuffer buffer = new StringBuffer(); var sub; - sub = stream.listen((x) { - buffer.write(x); - sub.pause(new Future.delayed(Duration.zero)); - }, onDone: () { - Expect.stringEquals(expected, buffer.toString()); - asyncEnd(); - }); + sub = stream.listen( + (x) { + buffer.write(x); + sub.pause(new Future.delayed(Duration.zero)); + }, + onDone: () { + Expect.stringEquals(expected, buffer.toString()); + asyncEnd(); + }, + ); } void main() {
diff --git a/tests/lib/convert/streamed_conversion_json_utf8_decode_test.dart b/tests/lib/convert/streamed_conversion_json_utf8_decode_test.dart index 6cdcdad..758e69c 100644 --- a/tests/lib/convert/streamed_conversion_json_utf8_decode_test.dart +++ b/tests/lib/convert/streamed_conversion_json_utf8_decode_test.dart
@@ -40,10 +40,12 @@ Stream<Object?> createStream(List<List<int>> chunks) { var controller; - controller = new StreamController<List<int>>(onListen: () { - chunks.forEach(controller.add); - controller.close(); - }); + controller = new StreamController<List<int>>( + onListen: () { + chunks.forEach(controller.add); + controller.close(); + }, + ); return controller.stream.transform(jsonUtf8.decoder); }
diff --git a/tests/lib/convert/streamed_conversion_json_utf8_encode_test.dart b/tests/lib/convert/streamed_conversion_json_utf8_encode_test.dart index f905ae9..f3a2c5e 100644 --- a/tests/lib/convert/streamed_conversion_json_utf8_encode_test.dart +++ b/tests/lib/convert/streamed_conversion_json_utf8_encode_test.dart
@@ -12,10 +12,12 @@ Stream<List<int>> encode(Object o) { var controller; - controller = new StreamController(onListen: () { - controller.add(o); - controller.close(); - }); + controller = new StreamController( + onListen: () { + controller.add(o); + controller.close(); + }, + ); return controller.stream.transform(jsonUtf8.encoder); } @@ -33,13 +35,16 @@ asyncStart(); var accumulated = <int>[]; var sub; - sub = stream.listen((x) { - accumulated.addAll(x); - sub.pause(new Future.delayed(Duration.zero)); - }, onDone: () { - Expect.listEquals(expected, accumulated); - asyncEnd(); - }); + sub = stream.listen( + (x) { + accumulated.addAll(x); + sub.pause(new Future.delayed(Duration.zero)); + }, + onDone: () { + Expect.listEquals(expected, accumulated); + asyncEnd(); + }, + ); } void main() {
diff --git a/tests/lib/convert/streamed_conversion_utf8_decode_test.dart b/tests/lib/convert/streamed_conversion_utf8_decode_test.dart index c319d09..20b0ee1 100644 --- a/tests/lib/convert/streamed_conversion_utf8_decode_test.dart +++ b/tests/lib/convert/streamed_conversion_utf8_decode_test.dart
@@ -10,20 +10,22 @@ Stream<String> decode(List<int> bytes, int chunkSize) { var controller; - controller = new StreamController<List<int>>(onListen: () { - int i = 0; - while (i < bytes.length) { - List nextChunk = <int>[]; - for (int j = 0; j < chunkSize; j++) { - if (i < bytes.length) { - nextChunk.add(bytes[i]); - i++; + controller = new StreamController<List<int>>( + onListen: () { + int i = 0; + while (i < bytes.length) { + List nextChunk = <int>[]; + for (int j = 0; j < chunkSize; j++) { + if (i < bytes.length) { + nextChunk.add(bytes[i]); + i++; + } } + controller.add(nextChunk); } - controller.add(nextChunk); - } - controller.close(); - }); + controller.close(); + }, + ); return controller.stream.transform(utf8.decoder); } @@ -41,13 +43,16 @@ asyncStart(); StringBuffer buffer = new StringBuffer(); var sub; - sub = stream.listen((x) { - buffer.write(x); - sub.pause(new Future.delayed(Duration.zero)); - }, onDone: () { - Expect.stringEquals(expected, buffer.toString()); - asyncEnd(); - }); + sub = stream.listen( + (x) { + buffer.write(x); + sub.pause(new Future.delayed(Duration.zero)); + }, + onDone: () { + Expect.stringEquals(expected, buffer.toString()); + asyncEnd(); + }, + ); } main() {
diff --git a/tests/lib/convert/streamed_conversion_utf8_encode_test.dart b/tests/lib/convert/streamed_conversion_utf8_encode_test.dart index 04d19cf..1677527 100644 --- a/tests/lib/convert/streamed_conversion_utf8_encode_test.dart +++ b/tests/lib/convert/streamed_conversion_utf8_encode_test.dart
@@ -10,18 +10,20 @@ Stream<List<int>> encode(String string, int chunkSize) { var controller; - controller = new StreamController<String>(onListen: () { - int i = 0; - while (i < string.length) { - if (i + chunkSize <= string.length) { - controller.add(string.substring(i, i + chunkSize)); - } else { - controller.add(string.substring(i)); + controller = new StreamController<String>( + onListen: () { + int i = 0; + while (i < string.length) { + if (i + chunkSize <= string.length) { + controller.add(string.substring(i, i + chunkSize)); + } else { + controller.add(string.substring(i)); + } + i += chunkSize; } - i += chunkSize; - } - controller.close(); - }); + controller.close(); + }, + ); return controller.stream.transform(utf8.encoder); } @@ -40,13 +42,16 @@ asyncStart(); var combined = <int>[]; var sub; - sub = stream.listen((x) { - combined.addAll(x); - sub.pause(new Future.delayed(Duration.zero)); - }, onDone: () { - Expect.listEquals(expected, combined); - asyncEnd(); - }); + sub = stream.listen( + (x) { + combined.addAll(x); + sub.pause(new Future.delayed(Duration.zero)); + }, + onDone: () { + Expect.listEquals(expected, combined); + asyncEnd(); + }, + ); } main() {
diff --git a/tests/lib/convert/unicode_tests.dart b/tests/lib/convert/unicode_tests.dart index 82d7f17b..acfea00 100644 --- a/tests/lib/convert/unicode_tests.dart +++ b/tests/lib/convert/unicode_tests.dart
@@ -45,7 +45,7 @@ 0xbb, 0x9d, 0xc3, - 0xb1 + 0xb1, ]; const INTER_STRING = "Îñţérñåţîöñåļîžåţîờñ"; @@ -63,7 +63,7 @@ 0x72, 0xc3, 0xb8, - 0x64 + 0x64, ]; const BLUEBERRY_STRING = "blåbærgrød"; @@ -102,7 +102,7 @@ 0x88, 0xe0, 0xae, - 0xb2 + 0xb2, ]; const SIVA_STRING1 = "சிவா அணாமாைல"; @@ -141,7 +141,7 @@ 0xb2, 0xe0, 0xa5, - 0x88 + 0x88, ]; const SIVA_STRING2 = "िसवा अणामालै"; @@ -179,7 +179,7 @@ 0x77, 0x78, 0x79, - 0x7A + 0x7A, ]; const ASCII_STRING = "abcdefghijklmnopqrstuvwxyz"; @@ -226,17 +226,19 @@ assert(2 == BEE_STRING.length); var tests = <List>[]; tests.addAll(_TEST_PAIRS); - tests.addAll(_TEST_PAIRS.map((test) { - var bytes = test[0] as List<int>; - var string = test[1] as String; - var longBytes = <int>[]; - var longString = ""; - for (int i = 0; i < 100; i++) { - longBytes.addAll(bytes); - longString += string; - } - return [longBytes, longString]; - })); + tests.addAll( + _TEST_PAIRS.map((test) { + var bytes = test[0] as List<int>; + var string = test[1] as String; + var longBytes = <int>[]; + var longString = ""; + for (int i = 0; i < 100; i++) { + longBytes.addAll(bytes); + longString += string; + } + return [longBytes, longString]; + }), + ); return tests; }
diff --git a/tests/lib/convert/utf82_test.dart b/tests/lib/convert/utf82_test.dart index cf0c2b0..6b0ac1c 100644 --- a/tests/lib/convert/utf82_test.dart +++ b/tests/lib/convert/utf82_test.dart
@@ -32,7 +32,7 @@ // Unfinished UTF-8 sequences. [0xc3], [0xE2, 0x82], - [0xF0, 0xA4, 0xAD] + [0xF0, 0xA4, 0xAD], ]; final TESTS1 = [ @@ -67,146 +67,146 @@ // Test that 0xC0|1, 0x80 does not eat the next character. [ [0xC0, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xC1, 0x80, 0x61], - "XXa" + "XXa", ], // 0xF5 .. 0xFF never appear in valid UTF-8 sequences. [ [0xF5, 0x80], - "XX" + "XX", ], [ [0xF6, 0x80], - "XX" + "XX", ], [ [0xF7, 0x80], - "XX" + "XX", ], [ [0xF8, 0x80], - "XX" + "XX", ], [ [0xF9, 0x80], - "XX" + "XX", ], [ [0xFA, 0x80], - "XX" + "XX", ], [ [0xFB, 0x80], - "XX" + "XX", ], [ [0xFC, 0x80], - "XX" + "XX", ], [ [0xFD, 0x80], - "XX" + "XX", ], [ [0xFE, 0x80], - "XX" + "XX", ], [ [0xFF, 0x80], - "XX" + "XX", ], [ [0xF5, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xF6, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xF7, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xF8, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xF9, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFA, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFB, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFC, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFD, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFE, 0x80, 0x61], - "XXa" + "XXa", ], [ [0xFF, 0x80, 0x61], - "XXa" + "XXa", ], // Characters outside the valid range. [ [0xF5, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xF6, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xF7, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xF8, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xF9, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFA, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFB, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFC, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFD, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFE, 0x80, 0x80, 0x61], - "XXXa" + "XXXa", ], [ [0xFF, 0x80, 0x80, 0x61], - "XXXa" - ] + "XXXa", + ], ]; main() { @@ -214,46 +214,47 @@ // Pairs of test and expected string output when malformed strings are // allowed. Replacement character: U+FFFD, one per unfinished sequence or // undecodable byte. - String replacement = - TESTS0.contains(test) ? "\u{FFFD}" : "\u{FFFD}" * test.length; + String replacement = TESTS0.contains(test) + ? "\u{FFFD}" + : "\u{FFFD}" * test.length; return [ [test, "${replacement}"], [ [0x61, ...test], - "a${replacement}" + "a${replacement}", ], [ [0x61, ...test, 0x61], - "a${replacement}a" + "a${replacement}a", ], [ [...test, 0x61], - "${replacement}a" + "${replacement}a", ], [ [...test, ...test], - "${replacement}${replacement}" + "${replacement}${replacement}", ], [ [...test, 0x61, ...test], - "${replacement}a${replacement}" + "${replacement}a${replacement}", ], [ [0xc3, 0xa5, ...test], - "å${replacement}" + "å${replacement}", ], [ [0xc3, 0xa5, ...test, 0xc3, 0xa5], - "å${replacement}å" + "å${replacement}å", ], [ [...test, 0xc3, 0xa5], - "${replacement}å" + "${replacement}å", ], [ [...test, 0xc3, 0xa5, ...test], - "${replacement}å${replacement}" - ] + "${replacement}å${replacement}", + ], ]; }); @@ -276,7 +277,10 @@ Expect.equals(expected, decodeAllowMalformed4(bytes)); } - for (var test in []..addAll(allTests)..addAll(allTests2)) { + for (var test + in [] + ..addAll(allTests) + ..addAll(allTests2)) { List<int> bytes = test[0]; String expected = test[1]; check(expected, bytes, 'plain list');
diff --git a/tests/lib/convert/utf83_test.dart b/tests/lib/convert/utf83_test.dart index 6972c11..baea4ab 100644 --- a/tests/lib/convert/utf83_test.dart +++ b/tests/lib/convert/utf83_test.dart
@@ -15,56 +15,79 @@ Expect.equals("a", utf8.decode(bytes([0xEF, 0xBB, 0xBF, 0x61]))); Expect.equals("a", utf8.decoder.convert(bytes([0xEF, 0xBB, 0xBF, 0x61]))); Expect.equals( - "a", new Utf8Decoder().convert(bytes([0xEF, 0xBB, 0xBF, 0x61]))); + "a", + new Utf8Decoder().convert(bytes([0xEF, 0xBB, 0xBF, 0x61])), + ); Expect.equals( - "a", utf8.decode(bytes([0xEF, 0xBB, 0xBF, 0x61]), allowMalformed: true)); + "a", + utf8.decode(bytes([0xEF, 0xBB, 0xBF, 0x61]), allowMalformed: true), + ); Expect.equals( - "a", - new Utf8Codec(allowMalformed: true) - .decode(bytes([0xEF, 0xBB, 0xBF, 0x61]))); + "a", + new Utf8Codec(allowMalformed: true).decode(bytes([0xEF, 0xBB, 0xBF, 0x61])), + ); Expect.equals( - "a", - new Utf8Codec(allowMalformed: true) - .decoder - .convert(bytes([0xEF, 0xBB, 0xBF, 0x61]))); + "a", + new Utf8Codec( + allowMalformed: true, + ).decoder.convert(bytes([0xEF, 0xBB, 0xBF, 0x61])), + ); Expect.equals( - "a", - new Utf8Decoder(allowMalformed: true) - .convert(bytes([0xEF, 0xBB, 0xBF, 0x61]))); + "a", + new Utf8Decoder( + allowMalformed: true, + ).convert(bytes([0xEF, 0xBB, 0xBF, 0x61])), + ); Expect.equals("", utf8.decode(bytes([0xEF, 0xBB, 0xBF]))); Expect.equals("", utf8.decoder.convert(bytes([0xEF, 0xBB, 0xBF]))); Expect.equals("", new Utf8Decoder().convert(bytes([0xEF, 0xBB, 0xBF]))); Expect.equals( - "", utf8.decode(bytes([0xEF, 0xBB, 0xBF]), allowMalformed: true)); - Expect.equals("", - new Utf8Codec(allowMalformed: true).decode(bytes([0xEF, 0xBB, 0xBF]))); + "", + utf8.decode(bytes([0xEF, 0xBB, 0xBF]), allowMalformed: true), + ); Expect.equals( - "", - new Utf8Codec(allowMalformed: true) - .decoder - .convert(bytes([0xEF, 0xBB, 0xBF]))); - Expect.equals("", - new Utf8Decoder(allowMalformed: true).convert(bytes([0xEF, 0xBB, 0xBF]))); + "", + new Utf8Codec(allowMalformed: true).decode(bytes([0xEF, 0xBB, 0xBF])), + ); + Expect.equals( + "", + new Utf8Codec( + allowMalformed: true, + ).decoder.convert(bytes([0xEF, 0xBB, 0xBF])), + ); + Expect.equals( + "", + new Utf8Decoder(allowMalformed: true).convert(bytes([0xEF, 0xBB, 0xBF])), + ); Expect.equals("a\u{FEFF}", utf8.decode(bytes([0x61, 0xEF, 0xBB, 0xBF]))); Expect.equals( - "a\u{FEFF}", utf8.decoder.convert(bytes([0x61, 0xEF, 0xBB, 0xBF]))); + "a\u{FEFF}", + utf8.decoder.convert(bytes([0x61, 0xEF, 0xBB, 0xBF])), + ); Expect.equals( - "a\u{FEFF}", new Utf8Decoder().convert(bytes([0x61, 0xEF, 0xBB, 0xBF]))); - Expect.equals("a\u{FEFF}", - utf8.decode(bytes([0x61, 0xEF, 0xBB, 0xBF]), allowMalformed: true)); + "a\u{FEFF}", + new Utf8Decoder().convert(bytes([0x61, 0xEF, 0xBB, 0xBF])), + ); Expect.equals( - "a\u{FEFF}", - new Utf8Codec(allowMalformed: true) - .decode(bytes([0x61, 0xEF, 0xBB, 0xBF]))); + "a\u{FEFF}", + utf8.decode(bytes([0x61, 0xEF, 0xBB, 0xBF]), allowMalformed: true), + ); Expect.equals( - "a\u{FEFF}", - new Utf8Codec(allowMalformed: true) - .decoder - .convert(bytes([0x61, 0xEF, 0xBB, 0xBF]))); + "a\u{FEFF}", + new Utf8Codec(allowMalformed: true).decode(bytes([0x61, 0xEF, 0xBB, 0xBF])), + ); Expect.equals( - "a\u{FEFF}", - new Utf8Decoder(allowMalformed: true) - .convert(bytes([0x61, 0xEF, 0xBB, 0xBF]))); + "a\u{FEFF}", + new Utf8Codec( + allowMalformed: true, + ).decoder.convert(bytes([0x61, 0xEF, 0xBB, 0xBF])), + ); + Expect.equals( + "a\u{FEFF}", + new Utf8Decoder( + allowMalformed: true, + ).convert(bytes([0x61, 0xEF, 0xBB, 0xBF])), + ); } main() {
diff --git a/tests/lib/convert/utf84_test.dart b/tests/lib/convert/utf84_test.dart index 566b1fa..444a0b3 100755 --- a/tests/lib/convert/utf84_test.dart +++ b/tests/lib/convert/utf84_test.dart
@@ -52,10 +52,11 @@ 0x64, 0x6f, 0x67, - 0x2e + 0x2e, ]; -const String testDanishPhrase = "Quizdeltagerne spiste jordbær med " +const String testDanishPhrase = + "Quizdeltagerne spiste jordbær med " "fløde mens cirkusklovnen Wolther spillede på xylofon."; const List<int> testDanishUtf8 = const <int>[ @@ -148,7 +149,7 @@ 0x66, 0x6f, 0x6e, - 0x2e + 0x2e, ]; // unusual formatting due to strange editor interaction w/ text direction. @@ -245,10 +246,11 @@ 0xd7, 0x98, 0xd7, - 0x94 + 0x94, ]; -const String testRussianPhrase = "Съешь же ещё этих мягких " +const String testRussianPhrase = + "Съешь же ещё этих мягких " "французских булок да выпей чаю"; const List<int> testRussianUtf8 = const <int>[ @@ -352,10 +354,11 @@ 0xd0, 0xb0, 0xd1, - 0x8e + 0x8e, ]; -const String testGreekPhrase = "Γαζέες καὶ μυρτιὲς δὲν θὰ βρῶ πιὰ " +const String testGreekPhrase = + "Γαζέες καὶ μυρτιὲς δὲν θὰ βρῶ πιὰ " "στὸ χρυσαφὶ ξέφωτο"; const List<int> testGreekUtf8 = const <int>[ @@ -461,10 +464,11 @@ 0xcf, 0x84, 0xce, - 0xbf + 0xbf, ]; -const String testKatakanaPhrase = "イロハニホヘト チリヌルヲ ワカヨタレソ " +const String testKatakanaPhrase = + "イロハニホヘト チリヌルヲ ワカヨタレソ " "ツネナラム ウヰノオクヤマ ケフコエテ アサキユメミシ ヱヒモセスン"; const List<int> testKatakanaUtf8 = const <int>[ @@ -618,7 +622,7 @@ 0xb9, 0xe3, 0x83, - 0xb3 + 0xb3, ]; void main() { @@ -650,29 +654,48 @@ List<int> encodeUtf8(String str) => utf8.encode(str); Expect.listEquals( - testEnglishUtf8, encodeUtf8(testEnglishPhrase), "english to utf8"); + testEnglishUtf8, + encodeUtf8(testEnglishPhrase), + "english to utf8", + ); Expect.listEquals( - testDanishUtf8, encodeUtf8(testDanishPhrase), "encode danish to utf8"); + testDanishUtf8, + encodeUtf8(testDanishPhrase), + "encode danish to utf8", + ); Expect.listEquals( - testHebrewUtf8, encodeUtf8(testHebrewPhrase), "Hebrew to utf8"); + testHebrewUtf8, + encodeUtf8(testHebrewPhrase), + "Hebrew to utf8", + ); Expect.listEquals( - testRussianUtf8, encodeUtf8(testRussianPhrase), "Russian to utf8"); + testRussianUtf8, + encodeUtf8(testRussianPhrase), + "Russian to utf8", + ); Expect.listEquals( - testGreekUtf8, encodeUtf8(testGreekPhrase), "Greek to utf8"); + testGreekUtf8, + encodeUtf8(testGreekPhrase), + "Greek to utf8", + ); Expect.listEquals( - testKatakanaUtf8, encodeUtf8(testKatakanaPhrase), "Katakana to utf8"); + testKatakanaUtf8, + encodeUtf8(testKatakanaPhrase), + "Katakana to utf8", + ); } void testUtf8bytesToCodepoints(List<int> utf8ToRunes(List<int> utf8)) { Expect.listEquals( - [954, 972, 963, 956, 949], - utf8ToRunes([0xce, 0xba, 0xcf, 0x8c, 0xcf, 0x83, 0xce, 0xbc, 0xce, 0xb5]), - "κόσμε"); + [954, 972, 963, 956, 949], + utf8ToRunes([0xce, 0xba, 0xcf, 0x8c, 0xcf, 0x83, 0xce, 0xbc, 0xce, 0xb5]), + "κόσμε", + ); // boundary conditions: First possible sequence of a certain length Expect.listEquals([], utf8ToRunes([]), "no input"); @@ -680,67 +703,103 @@ Expect.listEquals([0x80], utf8ToRunes([0xc2, 0x80]), "80"); Expect.listEquals([0x800], utf8ToRunes([0xe0, 0xa0, 0x80]), "800"); Expect.listEquals([0x10000], utf8ToRunes([0xf0, 0x90, 0x80, 0x80]), "10000"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xf8, 0x88, 0x80, 0x80, 0x80]), "200000"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xfc, 0x84, 0x80, 0x80, 0x80, 0x80]), "4000000"); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xf8, 0x88, 0x80, 0x80, 0x80]), + "200000", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xfc, 0x84, 0x80, 0x80, 0x80, 0x80]), + "4000000", + ); // boundary conditions: Last possible sequence of a certain length Expect.listEquals([0x7f], utf8ToRunes([0x7f]), "7f"); Expect.listEquals([0x7ff], utf8ToRunes([0xdf, 0xbf]), "7ff"); Expect.listEquals([0xffff], utf8ToRunes([0xef, 0xbf, 0xbf]), "ffff"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xf7, 0xbf, 0xbf, 0xbf]), "1fffff"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xfb, 0xbf, 0xbf, 0xbf, 0xbf]), "3ffffff"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xfd, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf]), "4000000"); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xf7, 0xbf, 0xbf, 0xbf]), + "1fffff", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xfb, 0xbf, 0xbf, 0xbf, 0xbf]), + "3ffffff", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xfd, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf]), + "4000000", + ); // other boundary conditions Expect.listEquals([0xd7ff], utf8ToRunes([0xed, 0x9f, 0xbf]), "d7ff"); Expect.listEquals([0xe000], utf8ToRunes([0xee, 0x80, 0x80]), "e000"); - Expect.listEquals([unicodeReplacementCharacterRune], - utf8ToRunes([0xef, 0xbf, 0xbd]), "fffd"); Expect.listEquals( - [0x10ffff], utf8ToRunes([0xf4, 0x8f, 0xbf, 0xbf]), "10ffff"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xf4, 0x90, 0x80, 0x80]), "110000"); + [unicodeReplacementCharacterRune], + utf8ToRunes([0xef, 0xbf, 0xbd]), + "fffd", + ); + Expect.listEquals( + [0x10ffff], + utf8ToRunes([0xf4, 0x8f, 0xbf, 0xbf]), + "10ffff", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xf4, 0x90, 0x80, 0x80]), + "110000", + ); // unexpected continuation bytes - Expect.listEquals([unicodeReplacementCharacterRune], utf8ToRunes([0x80]), - "80 => replacement character"); - Expect.listEquals([unicodeReplacementCharacterRune], utf8ToRunes([0xbf]), - "bf => replacement character"); + Expect.listEquals( + [unicodeReplacementCharacterRune], + utf8ToRunes([0x80]), + "80 => replacement character", + ); + Expect.listEquals( + [unicodeReplacementCharacterRune], + utf8ToRunes([0xbf]), + "bf => replacement character", + ); List<int> allContinuationBytes = <int>[]; List<int> matchingReplacementChars = <int>[]; @@ -748,8 +807,11 @@ allContinuationBytes.add(i); matchingReplacementChars.add(unicodeReplacementCharacterRune); } - Expect.listEquals(matchingReplacementChars, utf8ToRunes(allContinuationBytes), - "80 - bf => replacement character x 64"); + Expect.listEquals( + matchingReplacementChars, + utf8ToRunes(allContinuationBytes), + "80 - bf => replacement character x 64", + ); List<int> allFirstTwoByteSeq = <int>[]; matchingReplacementChars = <int>[]; @@ -757,8 +819,11 @@ allFirstTwoByteSeq.addAll([i, 0x20]); matchingReplacementChars.addAll([unicodeReplacementCharacterRune, 0x20]); } - Expect.listEquals(matchingReplacementChars, utf8ToRunes(allFirstTwoByteSeq), - "c0 - df + space => replacement character + space x 32"); + Expect.listEquals( + matchingReplacementChars, + utf8ToRunes(allFirstTwoByteSeq), + "c0 - df + space => replacement character + space x 32", + ); List<int> allFirstThreeByteSeq = <int>[]; matchingReplacementChars = <int>[]; @@ -766,8 +831,11 @@ allFirstThreeByteSeq.addAll([i, 0x20]); matchingReplacementChars.addAll([unicodeReplacementCharacterRune, 0x20]); } - Expect.listEquals(matchingReplacementChars, utf8ToRunes(allFirstThreeByteSeq), - "e0 - ef + space => replacement character x 16"); + Expect.listEquals( + matchingReplacementChars, + utf8ToRunes(allFirstThreeByteSeq), + "e0 - ef + space => replacement character x 16", + ); List<int> allFirstFourByteSeq = <int>[]; matchingReplacementChars = <int>[]; @@ -775,8 +843,11 @@ allFirstFourByteSeq.addAll([i, 0x20]); matchingReplacementChars.addAll([unicodeReplacementCharacterRune, 0x20]); } - Expect.listEquals(matchingReplacementChars, utf8ToRunes(allFirstFourByteSeq), - "f0 - f7 + space => replacement character x 8"); + Expect.listEquals( + matchingReplacementChars, + utf8ToRunes(allFirstFourByteSeq), + "f0 - f7 + space => replacement character x 8", + ); List<int> allFirstFiveByteSeq = <int>[]; matchingReplacementChars = <int>[]; @@ -784,8 +855,11 @@ allFirstFiveByteSeq.addAll([i, 0x20]); matchingReplacementChars.addAll([unicodeReplacementCharacterRune, 0x20]); } - Expect.listEquals(matchingReplacementChars, utf8ToRunes(allFirstFiveByteSeq), - "f8 - fb + space => replacement character x 4"); + Expect.listEquals( + matchingReplacementChars, + utf8ToRunes(allFirstFiveByteSeq), + "f8 - fb + space => replacement character x 4", + ); List<int> allFirstSixByteSeq = <int>[]; matchingReplacementChars = <int>[]; @@ -793,235 +867,329 @@ allFirstSixByteSeq.addAll([i, 0x20]); matchingReplacementChars.addAll([unicodeReplacementCharacterRune, 0x20]); } - Expect.listEquals(matchingReplacementChars, utf8ToRunes(allFirstSixByteSeq), - "fc - fd + space => replacement character x 2"); + Expect.listEquals( + matchingReplacementChars, + utf8ToRunes(allFirstSixByteSeq), + "fc - fd + space => replacement character x 2", + ); // Sequences with last continuation byte missing - Expect.listEquals([unicodeReplacementCharacterRune], utf8ToRunes([0xc2]), - "2-byte sequence with last byte missing"); Expect.listEquals( - [unicodeReplacementCharacterRune, unicodeReplacementCharacterRune], - utf8ToRunes([0xe0, 0x80]), - "3-byte sequence with last byte missing"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xf0, 0x80, 0x80]), "4-byte sequence with last byte missing"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xf8, 0x88, 0x80, 0x80]), - "5-byte sequence with last byte missing"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xfc, 0x80, 0x80, 0x80, 0x80]), - "6-byte sequence with last byte missing"); + [unicodeReplacementCharacterRune], + utf8ToRunes([0xc2]), + "2-byte sequence with last byte missing", + ); + Expect.listEquals( + [unicodeReplacementCharacterRune, unicodeReplacementCharacterRune], + utf8ToRunes([0xe0, 0x80]), + "3-byte sequence with last byte missing", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xf0, 0x80, 0x80]), + "4-byte sequence with last byte missing", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xf8, 0x88, 0x80, 0x80]), + "5-byte sequence with last byte missing", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xfc, 0x80, 0x80, 0x80, 0x80]), + "6-byte sequence with last byte missing", + ); - Expect.listEquals([unicodeReplacementCharacterRune], utf8ToRunes([0xdf]), - "2-byte sequence with last byte missing (hi)"); - Expect.listEquals([unicodeReplacementCharacterRune], - utf8ToRunes([0xef, 0xbf]), "3-byte sequence with last byte missing (hi)"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xf7, 0xbf, 0xbf]), - "4-byte sequence with last byte missing (hi)"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xfb, 0xbf, 0xbf, 0xbf]), - "5-byte sequence with last byte missing (hi)"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xfd, 0xbf, 0xbf, 0xbf, 0xbf]), - "6-byte sequence with last byte missing (hi)"); + Expect.listEquals( + [unicodeReplacementCharacterRune], + utf8ToRunes([0xdf]), + "2-byte sequence with last byte missing (hi)", + ); + Expect.listEquals( + [unicodeReplacementCharacterRune], + utf8ToRunes([0xef, 0xbf]), + "3-byte sequence with last byte missing (hi)", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xf7, 0xbf, 0xbf]), + "4-byte sequence with last byte missing (hi)", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xfb, 0xbf, 0xbf, 0xbf]), + "5-byte sequence with last byte missing (hi)", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xfd, 0xbf, 0xbf, 0xbf, 0xbf]), + "6-byte sequence with last byte missing (hi)", + ); // Concatenation of incomplete sequences Expect.listEquals( - [ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], - utf8ToRunes([ - 0xc2, - 0xe0, - 0x80, - 0xf0, - 0x80, - 0x80, - 0xf8, - 0x88, - 0x80, - 0x80, - 0xfc, - 0x80, - 0x80, - 0x80, - 0x80, - 0xdf, - 0xef, // These two bytes form one incomplete sequence. - 0xbf, // All others form one per byte. - 0xf7, - 0xbf, - 0xbf, - 0xfb, - 0xbf, - 0xbf, - 0xbf, - 0xfd, - 0xbf, - 0xbf, - 0xbf, - 0xbf - ]), - "Concatenation of incomplete sequences"); + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([ + 0xc2, + 0xe0, + 0x80, + 0xf0, + 0x80, + 0x80, + 0xf8, + 0x88, + 0x80, + 0x80, + 0xfc, + 0x80, + 0x80, + 0x80, + 0x80, + 0xdf, + 0xef, // These two bytes form one incomplete sequence. + 0xbf, // All others form one per byte. + 0xf7, + 0xbf, + 0xbf, + 0xfb, + 0xbf, + 0xbf, + 0xbf, + 0xfd, + 0xbf, + 0xbf, + 0xbf, + 0xbf, + ]), + "Concatenation of incomplete sequences", + ); // Impossible bytes Expect.listEquals( - [unicodeReplacementCharacterRune], utf8ToRunes([0xfe]), "fe"); + [unicodeReplacementCharacterRune], + utf8ToRunes([0xfe]), + "fe", + ); Expect.listEquals( - [unicodeReplacementCharacterRune], utf8ToRunes([0xff]), "ff"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xfe, 0xfe, 0xff, 0xff]), "fe fe ff ff"); + [unicodeReplacementCharacterRune], + utf8ToRunes([0xff]), + "ff", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xfe, 0xfe, 0xff, 0xff]), + "fe fe ff ff", + ); // Overlong sequences Expect.listEquals( - [unicodeReplacementCharacterRune, unicodeReplacementCharacterRune], - utf8ToRunes([0xc0, 0xaf]), - "c0 af"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xe0, 0x80, 0xaf]), "e0 80 af"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xf0, 0x80, 0x80, 0xaf]), "f0 80 80 af"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xf8, 0x80, 0x80, 0x80, 0xaf]), "f8 80 80 80 af"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xfc, 0x80, 0x80, 0x80, 0x80, 0xaf]), "fc 80 80 80 80 af"); + [unicodeReplacementCharacterRune, unicodeReplacementCharacterRune], + utf8ToRunes([0xc0, 0xaf]), + "c0 af", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xe0, 0x80, 0xaf]), + "e0 80 af", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xf0, 0x80, 0x80, 0xaf]), + "f0 80 80 af", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xf8, 0x80, 0x80, 0x80, 0xaf]), + "f8 80 80 80 af", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xfc, 0x80, 0x80, 0x80, 0x80, 0xaf]), + "fc 80 80 80 80 af", + ); Expect.listEquals( - [unicodeReplacementCharacterRune, unicodeReplacementCharacterRune], - utf8ToRunes([0xc1, 0xbf]), - "c1 bf"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xe0, 0x9f, 0xbf]), "e0 9f bf"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xf0, 0x8f, 0xbf, 0xbf]), "f0 8f bf bf"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xf8, 0x87, 0xbf, 0xbf, 0xbf]), "f8 87 bf bf bf"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xfc, 0x83, 0xbf, 0xbf, 0xbf, 0xbf]), "fc 83 bf bf bf bf"); + [unicodeReplacementCharacterRune, unicodeReplacementCharacterRune], + utf8ToRunes([0xc1, 0xbf]), + "c1 bf", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xe0, 0x9f, 0xbf]), + "e0 9f bf", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xf0, 0x8f, 0xbf, 0xbf]), + "f0 8f bf bf", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xf8, 0x87, 0xbf, 0xbf, 0xbf]), + "f8 87 bf bf bf", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xfc, 0x83, 0xbf, 0xbf, 0xbf, 0xbf]), + "fc 83 bf bf bf bf", + ); Expect.listEquals( - [unicodeReplacementCharacterRune, unicodeReplacementCharacterRune], - utf8ToRunes([0xc0, 0x80]), - "c0 80"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xe0, 0x80, 0x80]), "e0 80 80"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xf0, 0x80, 0x80, 0x80]), "f0 80 80 80"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xf8, 0x80, 0x80, 0x80, 0x80]), "f8 80 80 80 80"); - Expect.listEquals([ - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune, - unicodeReplacementCharacterRune - ], utf8ToRunes([0xfc, 0x80, 0x80, 0x80, 0x80, 0x80]), "fc 80 80 80 80 80"); + [unicodeReplacementCharacterRune, unicodeReplacementCharacterRune], + utf8ToRunes([0xc0, 0x80]), + "c0 80", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xe0, 0x80, 0x80]), + "e0 80 80", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xf0, 0x80, 0x80, 0x80]), + "f0 80 80 80", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xf8, 0x80, 0x80, 0x80, 0x80]), + "f8 80 80 80 80", + ); + Expect.listEquals( + [ + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + unicodeReplacementCharacterRune, + ], + utf8ToRunes([0xfc, 0x80, 0x80, 0x80, 0x80, 0x80]), + "fc 80 80 80 80 80", + ); // Other illegal code positions (???) Expect.listEquals([0xfffe], utf8ToRunes([0xef, 0xbf, 0xbe]), "U+FFFE"); @@ -1030,17 +1198,26 @@ void testUtf8BytesToString(String decodeUtf8(List<int> input)) { Expect.stringEquals( - testEnglishPhrase, decodeUtf8(testEnglishUtf8), "English"); + testEnglishPhrase, + decodeUtf8(testEnglishUtf8), + "English", + ); Expect.stringEquals(testDanishPhrase, decodeUtf8(testDanishUtf8), "Danish"); Expect.stringEquals(testHebrewPhrase, decodeUtf8(testHebrewUtf8), "Hebrew"); Expect.stringEquals( - testRussianPhrase, decodeUtf8(testRussianUtf8), "Russian"); + testRussianPhrase, + decodeUtf8(testRussianUtf8), + "Russian", + ); Expect.stringEquals(testGreekPhrase, decodeUtf8(testGreekUtf8), "Greek"); Expect.stringEquals( - testKatakanaPhrase, decodeUtf8(testKatakanaUtf8), "Katakana"); + testKatakanaPhrase, + decodeUtf8(testKatakanaUtf8), + "Katakana", + ); }
diff --git a/tests/lib/convert/utf85_test.dart b/tests/lib/convert/utf85_test.dart index a380991..ccb4eb7 100644 --- a/tests/lib/convert/utf85_test.dart +++ b/tests/lib/convert/utf85_test.dart
@@ -11,6 +11,8 @@ for (int i = 0; i <= 0x10FFFF; i++) { if (i == unicodeBomCharacterRune || (i & 0x1FF800) == 0xD800) continue; Expect.equals( - i, utf8.decode(utf8.encode(new String.fromCharCode(i))).runes.first); + i, + utf8.decode(utf8.encode(new String.fromCharCode(i))).runes.first, + ); } }
diff --git a/tests/lib/convert/utf8_encode_test.dart b/tests/lib/convert/utf8_encode_test.dart index 0a43e14..ad508ef 100644 --- a/tests/lib/convert/utf8_encode_test.dart +++ b/tests/lib/convert/utf8_encode_test.dart
@@ -25,8 +25,13 @@ String ascii = "ABCDE"; Expect.listEquals([0x41, 0x42, 0x43, 0x44, 0x45], encoder.convert(ascii)); Expect.listEquals([0x41, 0x42, 0x43, 0x44, 0x45], encoder.convert(ascii, 0)); - Expect.listEquals( - [0x41, 0x42, 0x43, 0x44, 0x45], encoder.convert(ascii, 0, 5)); + Expect.listEquals([ + 0x41, + 0x42, + 0x43, + 0x44, + 0x45, + ], encoder.convert(ascii, 0, 5)); Expect.listEquals([0x42, 0x43, 0x44, 0x45], encoder.convert(ascii, 1)); Expect.listEquals([0x41, 0x42, 0x43, 0x44], encoder.convert(ascii, 0, 4)); Expect.listEquals([0x42, 0x43, 0x44], encoder.convert(ascii, 1, 4)); @@ -39,17 +44,59 @@ var unicode = "\u0081\u0082\u1041\u{10101}"; - Expect.listEquals( - [0xc2, 0x81, 0xc2, 0x82, 0xe1, 0x81, 0x81, 0xf0, 0x90, 0x84, 0x81], - encoder.convert(unicode)); - Expect.listEquals( - [0xc2, 0x81, 0xc2, 0x82, 0xe1, 0x81, 0x81, 0xf0, 0x90, 0x84, 0x81], - encoder.convert(unicode, 0, unicode.length)); - Expect.listEquals([0xc2, 0x82, 0xe1, 0x81, 0x81, 0xf0, 0x90, 0x84, 0x81], - encoder.convert(unicode, 1)); - Expect.listEquals( - [0xc2, 0x82, 0xe1, 0x81, 0x81], encoder.convert(unicode, 1, 3)); + Expect.listEquals([ + 0xc2, + 0x81, + 0xc2, + 0x82, + 0xe1, + 0x81, + 0x81, + 0xf0, + 0x90, + 0x84, + 0x81, + ], encoder.convert(unicode)); + Expect.listEquals([ + 0xc2, + 0x81, + 0xc2, + 0x82, + 0xe1, + 0x81, + 0x81, + 0xf0, + 0x90, + 0x84, + 0x81, + ], encoder.convert(unicode, 0, unicode.length)); + Expect.listEquals([ + 0xc2, + 0x82, + 0xe1, + 0x81, + 0x81, + 0xf0, + 0x90, + 0x84, + 0x81, + ], encoder.convert(unicode, 1)); + Expect.listEquals([ + 0xc2, + 0x82, + 0xe1, + 0x81, + 0x81, + ], encoder.convert(unicode, 1, 3)); // Split in the middle of a surrogate pair. - Expect.listEquals([0xc2, 0x82, 0xe1, 0x81, 0x81, 0xef, 0xbf, 0xbd], - encoder.convert(unicode, 1, 4)); + Expect.listEquals([ + 0xc2, + 0x82, + 0xe1, + 0x81, + 0x81, + 0xef, + 0xbf, + 0xbd, + ], encoder.convert(unicode, 1, 4)); }
diff --git a/tests/lib/convert/utf8_test.dart b/tests/lib/convert/utf8_test.dart index 9897a9d..d509057 100644 --- a/tests/lib/convert/utf8_test.dart +++ b/tests/lib/convert/utf8_test.dart
@@ -34,12 +34,16 @@ if (ascii is Uint8List) { Expect.equals("ABCDE", decoder.convert(Uint8List.sublistView(ascii, 0))); - Expect.equals("ABCDE", - decoder.convert(Uint8List.sublistView(ascii, 0, ascii.length))); + Expect.equals( + "ABCDE", + decoder.convert(Uint8List.sublistView(ascii, 0, ascii.length)), + ); Expect.equals("CDE", decoder.convert(Uint8List.sublistView(ascii, 2))); Expect.equals("BCD", decoder.convert(Uint8List.sublistView(ascii, 1, 4))); Expect.equals( - "ABCD", decoder.convert(Uint8List.sublistView(ascii, 0, 4))); + "ABCD", + decoder.convert(Uint8List.sublistView(ascii, 0, 4)), + ); } Expect.throws(() => decoder.convert(ascii, -1)); // start < 0. @@ -60,14 +64,22 @@ Expect.equals("\u0082", decoder.convert(utf8, 2, 4)); if (utf8 is Uint8List) { - Expect.equals("\u0081\u0082\u1041", - decoder.convert(Uint8List.sublistView(utf8, 0))); Expect.equals( - "\u0082\u1041", decoder.convert(Uint8List.sublistView(utf8, 2))); + "\u0081\u0082\u1041", + decoder.convert(Uint8List.sublistView(utf8, 0)), + ); Expect.equals( - "\u0081\u0082", decoder.convert(Uint8List.sublistView(utf8, 0, 4))); + "\u0082\u1041", + decoder.convert(Uint8List.sublistView(utf8, 2)), + ); Expect.equals( - "\u0082", decoder.convert(Uint8List.sublistView(utf8, 2, 4))); + "\u0081\u0082", + decoder.convert(Uint8List.sublistView(utf8, 0, 4)), + ); + Expect.equals( + "\u0082", + decoder.convert(Uint8List.sublistView(utf8, 2, 4)), + ); } Expect.throws(() => decoder.convert(utf8, 1));
diff --git a/tests/lib/developer/post_event_test.dart b/tests/lib/developer/post_event_test.dart index 612d7e6..f5f7c1d 100644 --- a/tests/lib/developer/post_event_test.dart +++ b/tests/lib/developer/post_event_test.dart
@@ -17,7 +17,7 @@ 'Logging', 'Timeline', 'Profiler', - '_aStreamThatStartsWithAnUnderScore' + '_aStreamThatStartsWithAnUnderScore', ]; main() {
diff --git a/tests/lib/isolate/deeply_immutable_no_ffi_test.dart b/tests/lib/isolate/deeply_immutable_no_ffi_test.dart index 81ad735..cb921d7 100644 --- a/tests/lib/isolate/deeply_immutable_no_ffi_test.dart +++ b/tests/lib/isolate/deeply_immutable_no_ffi_test.dart
@@ -13,8 +13,8 @@ final class Foo { dynamic myMutableField; // ^ - // [cfe] Deeply immutable classes must only have final non-late instance fields. // [cfe] Deeply immutable classes must only have deeply immutable instance fields. Deeply immutable types include 'int', 'double', 'bool', 'String', 'Pointer', 'Float32x4', 'Float64x2', 'Int32x4', and classes annotated with `@pragma('vm:deeply-immutable')`. + // [cfe] Deeply immutable classes must only have final non-late instance fields. } Future<T> sendReceive<T>(T o) async {
diff --git a/tests/lib/isolate/deeply_immutable_test.dart b/tests/lib/isolate/deeply_immutable_test.dart index a5f9b7e..0418b84 100644 --- a/tests/lib/isolate/deeply_immutable_test.dart +++ b/tests/lib/isolate/deeply_immutable_test.dart
@@ -129,56 +129,36 @@ } void testInstantiateImmutableHierarchy() { - Class8( - animal: Cat( - numberOfLegs: 4, - averageNumberOfMeowsPerDay: 42.0, - ), - ); - Class8( - animal: Dog( - numberOfLegs: 4, - averageNumberOfWoofsPerDay: 1337.0, - ), - ); + Class8(animal: Cat(numberOfLegs: 4, averageNumberOfMeowsPerDay: 42.0)); + Class8(animal: Dog(numberOfLegs: 4, averageNumberOfWoofsPerDay: 1337.0)); } @pragma('vm:deeply-immutable') final class Animal { final int numberOfLegs; - Animal({ - required this.numberOfLegs, - }); + Animal({required this.numberOfLegs}); } @pragma('vm:deeply-immutable') final class Cat extends Animal { final double averageNumberOfMeowsPerDay; - Cat({ - required super.numberOfLegs, - required this.averageNumberOfMeowsPerDay, - }); + Cat({required super.numberOfLegs, required this.averageNumberOfMeowsPerDay}); } @pragma('vm:deeply-immutable') final class Dog extends Animal { final double averageNumberOfWoofsPerDay; - Dog({ - required super.numberOfLegs, - required this.averageNumberOfWoofsPerDay, - }); + Dog({required super.numberOfLegs, required this.averageNumberOfWoofsPerDay}); } @pragma('vm:deeply-immutable') final class Class8 { final Animal animal; - Class8({ - required this.animal, - }); + Class8({required this.animal}); } @pragma('vm:deeply-immutable') @@ -195,16 +175,16 @@ @pragma('vm:deeply-immutable') class NotSealedOrFinalClass {} -// ^^^^^^^^^^^^^^^^^^^^^ +// ^ // [cfe] Deeply immutable classes must be final or sealed. final class Class12 extends DeeplyImmutableInterface {} -// ^^^^^^^ +// ^ // [cfe] Subtypes of deeply immutable classes must be deeply immutable. final class Class13 implements DeeplyImmutableInterface { -// ^^^^^^^ -// [cfe] Subtypes of deeply immutable classes must be deeply immutable. + // ^ + // [cfe] Subtypes of deeply immutable classes must be deeply immutable. } @pragma('vm:deeply-immutable') @@ -217,7 +197,7 @@ @pragma('vm:deeply-immutable') final class Class15<T extends NotDeeplyImmutable> { final T notDeeplyImmutable; - // ^^^^^^^^^^^^^^^^^^ + // ^ // [cfe] Deeply immutable classes must only have deeply immutable instance fields. Deeply immutable types include 'int', 'double', 'bool', 'String', 'Pointer', 'Float32x4', 'Float64x2', 'Int32x4', and classes annotated with `@pragma('vm:deeply-immutable')`. Class15({required this.notDeeplyImmutable}); @@ -225,5 +205,6 @@ @pragma('vm:deeply-immutable') abstract mixin class Class17 {} -// ^^^^^^^ +// ^ // [cfe] Deeply immutable classes must be final or sealed. +
diff --git a/tests/lib/isolate/error_at_spawn_test.dart b/tests/lib/isolate/error_at_spawn_test.dart index a19075d..205d695 100644 --- a/tests/lib/isolate/error_at_spawn_test.dart +++ b/tests/lib/isolate/error_at_spawn_test.dart
@@ -26,8 +26,11 @@ asyncEnd(); }; - Isolate.spawn(isomain, null, - // Setup handler as part of spawn. - errorsAreFatal: false, - onError: errorPort.sendPort); + Isolate.spawn( + isomain, + null, + // Setup handler as part of spawn. + errorsAreFatal: false, + onError: errorPort.sendPort, + ); }
diff --git a/tests/lib/isolate/error_at_spawnuri_test.dart b/tests/lib/isolate/error_at_spawnuri_test.dart index f124fa8..c821885 100644 --- a/tests/lib/isolate/error_at_spawnuri_test.dart +++ b/tests/lib/isolate/error_at_spawnuri_test.dart
@@ -21,8 +21,12 @@ asyncEnd(); }; - Isolate.spawnUri(Uri.parse("error_at_spawnuri_iso.dart"), [], null, - // Setup handler as part of spawn. - errorsAreFatal: false, - onError: errorPort.sendPort); + Isolate.spawnUri( + Uri.parse("error_at_spawnuri_iso.dart"), + [], + null, + // Setup handler as part of spawn. + errorsAreFatal: false, + onError: errorPort.sendPort, + ); }
diff --git a/tests/lib/isolate/error_exit_at_spawn_test.dart b/tests/lib/isolate/error_exit_at_spawn_test.dart index 603bcb6..5bfbdd4 100644 --- a/tests/lib/isolate/error_exit_at_spawn_test.dart +++ b/tests/lib/isolate/error_exit_at_spawn_test.dart
@@ -10,10 +10,13 @@ main() { testIsolate((SendPort replyPort, SendPort errorPort, SendPort exitPort) { - Isolate.spawn(isomain, replyPort, - // Setup handlers as part of spawn. - errorsAreFatal: false, - onError: errorPort, - onExit: exitPort); + Isolate.spawn( + isomain, + replyPort, + // Setup handlers as part of spawn. + errorsAreFatal: false, + onError: errorPort, + onExit: exitPort, + ); }); }
diff --git a/tests/lib/isolate/error_exit_at_spawning_shared.dart b/tests/lib/isolate/error_exit_at_spawning_shared.dart index c14168f..6e20b3d 100644 --- a/tests/lib/isolate/error_exit_at_spawning_shared.dart +++ b/tests/lib/isolate/error_exit_at_spawning_shared.dart
@@ -32,7 +32,8 @@ } testIsolate( - void spawnIsolate(SendPort reply, SendPort errorPort, SendPort exitPort)) { + void spawnIsolate(SendPort reply, SendPort errorPort, SendPort exitPort), +) { asyncStart(); // Setup the port for communication with the newly spawned isolate. RawReceivePort reply = new RawReceivePort(null);
diff --git a/tests/lib/isolate/error_exit_at_spawnuri_test.dart b/tests/lib/isolate/error_exit_at_spawnuri_test.dart index 6e9a5a8..6b72eb6 100644 --- a/tests/lib/isolate/error_exit_at_spawnuri_test.dart +++ b/tests/lib/isolate/error_exit_at_spawnuri_test.dart
@@ -11,10 +11,13 @@ main() { testIsolate((SendPort replyPort, SendPort errorPort, SendPort exitPort) { Isolate.spawnUri( - Uri.parse("error_exit_at_spawning_shared.dart"), [], replyPort, - // Setup handlers as part of spawn. - errorsAreFatal: false, - onError: errorPort, - onExit: exitPort); + Uri.parse("error_exit_at_spawning_shared.dart"), + [], + replyPort, + // Setup handlers as part of spawn. + errorsAreFatal: false, + onError: errorPort, + onExit: exitPort, + ); }); }
diff --git a/tests/lib/isolate/exit_at_spawn_test.dart b/tests/lib/isolate/exit_at_spawn_test.dart index 985a967..caf0ca2 100644 --- a/tests/lib/isolate/exit_at_spawn_test.dart +++ b/tests/lib/isolate/exit_at_spawn_test.dart
@@ -43,8 +43,11 @@ }; // Ignore returned Future. - Isolate.spawn(mainFunction, null, - // Setup handler as part of spawn. - errorsAreFatal: false, - onExit: exitPort.sendPort); + Isolate.spawn( + mainFunction, + null, + // Setup handler as part of spawn. + errorsAreFatal: false, + onExit: exitPort.sendPort, + ); }
diff --git a/tests/lib/isolate/exit_at_spawnuri_test.dart b/tests/lib/isolate/exit_at_spawnuri_test.dart index 68b02a8..f6e2873 100644 --- a/tests/lib/isolate/exit_at_spawnuri_test.dart +++ b/tests/lib/isolate/exit_at_spawnuri_test.dart
@@ -19,8 +19,12 @@ }; // Ignore returned Future. - Isolate.spawnUri(Uri.parse("exit_at_spawnuri_iso.dart"), [], null, - // Setup handler as part of spawn. - errorsAreFatal: false, - onExit: exitPort.sendPort); + Isolate.spawnUri( + Uri.parse("exit_at_spawnuri_iso.dart"), + [], + null, + // Setup handler as part of spawn. + errorsAreFatal: false, + onExit: exitPort.sendPort, + ); }
diff --git a/tests/lib/isolate/function_send1_test.dart b/tests/lib/isolate/function_send1_test.dart index 314e7b7..5ae1869 100644 --- a/tests/lib/isolate/function_send1_test.dart +++ b/tests/lib/isolate/function_send1_test.dart
@@ -12,33 +12,33 @@ } Function createFuncToplevel() => (p, m) { - p.send(m); - }; + p.send(m); +}; class C { Function initializer; Function body; C() - : initializer = ((p, m) { - throw "initializer"; - }), - body = ((p, m) { - throw "body"; - }) {} + : initializer = ((p, m) { + throw "initializer"; + }), + body = ((p, m) { + throw "body"; + }) {} static void staticFunc(port, message) { port.send("static:$message"); } static Function createFuncStatic() => (p, m) { - throw "static expr"; - }; + throw "static expr"; + }; void instanceMethod(p, m) { throw "instanceMethod"; } Function createFuncMember() => (p, m) { - throw "instance expr"; - }; + throw "instance expr"; + }; void call(n, p) { throw "C"; } @@ -103,8 +103,10 @@ completer.complete(p); initPort.close(); }); - return Isolate.spawn(_echo, [replyPort, initPort.sendPort]) - .then((isolate) => completer.future); + return Isolate.spawn(_echo, [ + replyPort, + initPort.sendPort, + ]).then((isolate) => completer.future); } void _echo(msg) { @@ -131,15 +133,19 @@ void testUnsendable(name, func) { asyncStart(); - Isolate.spawnUri(Uri.parse("function_send_test.dart"), [], func) - .then<void>((v) => throw "allowed spawn direct?", onError: (e, s) { - asyncEnd(); - }); + Isolate.spawnUri(Uri.parse("function_send_test.dart"), [], func).then<void>( + (v) => throw "allowed spawn direct?", + onError: (e, s) { + asyncEnd(); + }, + ); asyncStart(); - Isolate.spawnUri(Uri.parse("function_send_test.dart"), [], [func]) - .then<void>((v) => throw "allowed spawn wrapped?", onError: (e, s) { - asyncEnd(); - }); + Isolate.spawnUri(Uri.parse("function_send_test.dart"), [], [func]).then<void>( + (v) => throw "allowed spawn wrapped?", + onError: (e, s) { + asyncEnd(); + }, + ); } void callFunc(message) {
diff --git a/tests/lib/isolate/function_send_test.dart b/tests/lib/isolate/function_send_test.dart index dbefc70..3865c08 100644 --- a/tests/lib/isolate/function_send_test.dart +++ b/tests/lib/isolate/function_send_test.dart
@@ -16,33 +16,33 @@ } Function createFuncToplevel() => (p, m) { - p.send(m); - }; + p.send(m); +}; class C { Function initializer; Function body; C() - : initializer = ((p, m) { - throw "initializer"; - }), - body = ((p, m) { - throw "body"; - }) {} + : initializer = ((p, m) { + throw "initializer"; + }), + body = ((p, m) { + throw "body"; + }) {} static void staticFunc(port, message) { port.send("static:$message"); } static Function createFuncStatic() => (p, m) { - throw "static expr"; - }; + throw "static expr"; + }; void instanceMethod(p, m) { throw "instanceMethod"; } Function createFuncMember() => (p, m) { - throw "instance expr"; - }; + throw "instance expr"; + }; void call(n, p) { throw "C"; } @@ -127,8 +127,10 @@ completer.complete(p); initPort.close(); }); - return Isolate.spawn(_echo, [replyPort, initPort.sendPort]) - .then((isolate) => completer.future); + return Isolate.spawn(_echo, [ + replyPort, + initPort.sendPort, + ]).then((isolate) => completer.future); } void _echo(msg) {
diff --git a/tests/lib/isolate/handle_error2_test.dart b/tests/lib/isolate/handle_error2_test.dart index fc0b204..b754baf 100644 --- a/tests/lib/isolate/handle_error2_test.dart +++ b/tests/lib/isolate/handle_error2_test.dart
@@ -58,23 +58,26 @@ Stream errors = isolate1.errors; // Broadcast stream, never a done message. int state = 1; var subscription; - subscription = errors.listen(null, onError: (error, stack) { - switch (state) { - case 1: - Expect.equals(new ArgumentError("whoops").toString(), "$error"); - state++; - break; - case 2: - Expect.equals(new RangeError.value(37).toString(), "$error"); - state++; - reply.close(); - subscription.cancel(); - asyncEnd(); - break; - default: - throw "Bad state for error: $state: $error"; - } - }); + subscription = errors.listen( + null, + onError: (error, stack) { + switch (state) { + case 1: + Expect.equals(new ArgumentError("whoops").toString(), "$error"); + state++; + break; + case 2: + Expect.equals(new RangeError.value(37).toString(), "$error"); + state++; + reply.close(); + subscription.cancel(); + asyncEnd(); + break; + default: + throw "Bad state for error: $state: $error"; + } + }, + ); sendPort1.send(0); sendPort2.send(0); sendPort1.send(1);
diff --git a/tests/lib/isolate/handle_error3_test.dart b/tests/lib/isolate/handle_error3_test.dart index 486c534..bc450ed 100644 --- a/tests/lib/isolate/handle_error3_test.dart +++ b/tests/lib/isolate/handle_error3_test.dart
@@ -61,23 +61,26 @@ Stream errors = isolate1.errors; // Broadcast stream, never a done message. int state = 1; var subscription; - subscription = errors.listen(null, onError: (error, stack) { - switch (state) { - case 1: - Expect.equals(new ArgumentError("whoops").toString(), "$error"); - state++; - break; - case 2: - Expect.equals(new RangeError.value(37).toString(), "$error"); - state++; - reply.close(); - subscription.cancel(); - asyncEnd(); - break; - default: - throw "Bad state for error: $state: $error"; - } - }); + subscription = errors.listen( + null, + onError: (error, stack) { + switch (state) { + case 1: + Expect.equals(new ArgumentError("whoops").toString(), "$error"); + state++; + break; + case 2: + Expect.equals(new RangeError.value(37).toString(), "$error"); + state++; + reply.close(); + subscription.cancel(); + asyncEnd(); + break; + default: + throw "Bad state for error: $state: $error"; + } + }, + ); // Capture errors from other isolate as raw messages. RawReceivePort errorPort2 = new RawReceivePort(); int state2 = 1;
diff --git a/tests/lib/isolate/handle_error_test.dart b/tests/lib/isolate/handle_error_test.dart index 54d30ba..33d83ba 100644 --- a/tests/lib/isolate/handle_error_test.dart +++ b/tests/lib/isolate/handle_error_test.dart
@@ -47,25 +47,28 @@ sendPort.send(state); }; }; - subscription = errors.listen(null, onError: (error, stack) { - switch (state) { - case 1: - Expect.equals(new ArgumentError("whoops").toString(), "$error"); - state++; - sendPort.send(state); - break; - case 2: - Expect.equals(new RangeError.value(37).toString(), "$error"); - state++; - sendPort.send(state); - reply.close(); - subscription.cancel(); - asyncEnd(); - break; - default: - throw "Bad state for error: $state: $error"; - } - }); + subscription = errors.listen( + null, + onError: (error, stack) { + switch (state) { + case 1: + Expect.equals(new ArgumentError("whoops").toString(), "$error"); + state++; + sendPort.send(state); + break; + case 2: + Expect.equals(new RangeError.value(37).toString(), "$error"); + state++; + sendPort.send(state); + reply.close(); + subscription.cancel(); + asyncEnd(); + break; + default: + throw "Bad state for error: $state: $error"; + } + }, + ); isolate.resume(isolate.pauseCapability!); }); }
diff --git a/tests/lib/isolate/int_from_environment_default_value_test.dart b/tests/lib/isolate/int_from_environment_default_value_test.dart index 96dec31..e2360a3 100644 --- a/tests/lib/isolate/int_from_environment_default_value_test.dart +++ b/tests/lib/isolate/int_from_environment_default_value_test.dart
@@ -10,7 +10,9 @@ void test(port) { Expect.equals(0, const int.fromEnvironment('NOT_FOUND')); Expect.equals( - 12345, const int.fromEnvironment('NOT_FOUND', defaultValue: 12345)); + 12345, + const int.fromEnvironment('NOT_FOUND', defaultValue: 12345), + ); if (port != null) port.send(null); }
diff --git a/tests/lib/isolate/isolate_current_test.dart b/tests/lib/isolate/isolate_current_test.dart index 621995a..81e761c 100644 --- a/tests/lib/isolate/isolate_current_test.dart +++ b/tests/lib/isolate/isolate_current_test.dart
@@ -122,11 +122,17 @@ } /** Convert isolate to list (of control port and capabilities). */ -i2l(Isolate isolate) => - [isolate.controlPort, isolate.pauseCapability, isolate.terminateCapability]; +i2l(Isolate isolate) => [ + isolate.controlPort, + isolate.pauseCapability, + isolate.terminateCapability, +]; /** Convert list to isolate. */ -l2i(List list) => new Isolate(list[0], - pauseCapability: list[1], terminateCapability: list[2]); +l2i(List list) => new Isolate( + list[0], + pauseCapability: list[1], + terminateCapability: list[2], +); /** Identity transformation. */ id(Isolate isolate) => isolate;
diff --git a/tests/lib/isolate/isolate_run_test.dart b/tests/lib/isolate/isolate_run_test.dart index 91ca221..83275b7 100644 --- a/tests/lib/isolate/isolate_run_test.dart +++ b/tests/lib/isolate/isolate_run_test.dart
@@ -51,32 +51,38 @@ } Future<void> testError() async { - var e = await asyncExpectThrows<ArgumentError>(Isolate.run<int>(() { - variable = 1; - Error.throwWithStackTrace(error, stack); - })); + var e = await asyncExpectThrows<ArgumentError>( + Isolate.run<int>(() { + variable = 1; + Error.throwWithStackTrace(error, stack); + }), + ); Expect.equals(42, e.invalidValue); Expect.equals("name", e.name); Expect.equals(0, variable); } Future<void> testAsyncError() async { - var e = await asyncExpectThrows<ArgumentError>(Isolate.run<int>(() async { - variable = 1; - Error.throwWithStackTrace(error, stack); - })); + var e = await asyncExpectThrows<ArgumentError>( + Isolate.run<int>(() async { + variable = 1; + Error.throwWithStackTrace(error, stack); + }), + ); Expect.equals(42, e.invalidValue); Expect.equals("name", e.name); Expect.equals(0, variable); } Future<void> testUncaughtError() async { - var e = await asyncExpectThrows<RemoteError>(Isolate.run<int>(() async { - variable = 1; - unawaited(Future.error(error, stack)); // Uncaught error - await Completer().future; // Never completes. - return -1; - })); + var e = await asyncExpectThrows<RemoteError>( + Isolate.run<int>(() async { + variable = 1; + unawaited(Future.error(error, stack)); // Uncaught error + await Completer().future; // Never completes. + return -1; + }), + ); Expect.type<RemoteError>(e); Expect.equals(error.toString(), e.toString()); @@ -84,33 +90,39 @@ } Future<void> testIsolateHangs() async { - var e = await asyncExpectThrows<RemoteError>(Isolate.run<int>(() async { - variable = 1; - await Completer<Never>().future; // Never completes. - // Isolate should end while hanging here, because its event loop is empty. - })); + var e = await asyncExpectThrows<RemoteError>( + Isolate.run<int>(() async { + variable = 1; + await Completer<Never>().future; // Never completes. + // Isolate should end while hanging here, because its event loop is empty. + }), + ); Expect.type<RemoteError>(e); Expect.equals("Computation ended without result", e.toString()); Expect.equals(0, variable); } Future<void> testIsolateKilled() async { - var e = await asyncExpectThrows<RemoteError>(Isolate.run<int>(() async { - variable = 1; - Isolate.current.kill(); // Send kill request. - await Completer<Never>().future; // Never completes. - // Isolate should get killed while hanging here. - })); + var e = await asyncExpectThrows<RemoteError>( + Isolate.run<int>(() async { + variable = 1; + Isolate.current.kill(); // Send kill request. + await Completer<Never>().future; // Never completes. + // Isolate should get killed while hanging here. + }), + ); Expect.type<RemoteError>(e); Expect.equals("Computation ended without result", e.toString()); Expect.equals(0, variable); } Future<void> testIsolateExits() async { - var e = await asyncExpectThrows<RemoteError>(Isolate.run<int>(() async { - variable = 1; - Isolate.exit(); // Dies here without sending anything back. - })); + var e = await asyncExpectThrows<RemoteError>( + Isolate.run<int>(() async { + variable = 1; + Isolate.exit(); // Dies here without sending anything back. + }), + ); Expect.type<RemoteError>(e); Expect.equals("Computation ended without result", e.toString()); Expect.equals(0, variable);
diff --git a/tests/lib/isolate/issue_21398_parent_isolate1_test.dart b/tests/lib/isolate/issue_21398_parent_isolate1_test.dart index d9ca0f3..f872407 100644 --- a/tests/lib/isolate/issue_21398_parent_isolate1_test.dart +++ b/tests/lib/isolate/issue_21398_parent_isolate1_test.dart
@@ -64,8 +64,10 @@ // Now spawn an isolate using spawnUri and send these send // ports over to it. This isolate will send one of the // sendports over to the other. - Isolate.spawnUri(Uri.parse('issue_21398_child_isolate1.dart'), [], - [spawnFunctionIsolate1SendPort, spawnFunctionIsolate2SendPort]); + Isolate.spawnUri(Uri.parse('issue_21398_child_isolate1.dart'), [], [ + spawnFunctionIsolate1SendPort, + spawnFunctionIsolate2SendPort, + ]); }, onError: (e) => print('$e')); }); } else if (msg == "done") { @@ -112,9 +114,11 @@ // wait for the third isolate spawned using spawnUri to send it // a sendPort to which it will try and send a non "literal-like" // object. - Isolate.spawnUri(Uri.parse('issue_21398_child_isolate11.dart'), [], - receive2.sendPort) - .then((isolate) { + Isolate.spawnUri( + Uri.parse('issue_21398_child_isolate11.dart'), + [], + receive2.sendPort, + ).then((isolate) { receive2.listen((msg) { spawnUriIsolateSendPort = msg; receive2.close(); @@ -122,8 +126,10 @@ // Now spawn an isolate using spawnUri and send these send // ports over to it. This isolate will send one of the // sendports over to the other. - Isolate.spawnUri(Uri.parse('issue_21398_child_isolate1.dart'), [], - [spawnFunctionIsolateSendPort, spawnUriIsolateSendPort]); + Isolate.spawnUri(Uri.parse('issue_21398_child_isolate1.dart'), [], [ + spawnFunctionIsolateSendPort, + spawnUriIsolateSendPort, + ]); }, onError: (e) => print('$e')); }); } else if (msg == "done") {
diff --git a/tests/lib/isolate/issue_21398_parent_isolate_test.dart b/tests/lib/isolate/issue_21398_parent_isolate_test.dart index cc714ac..74f5366 100644 --- a/tests/lib/isolate/issue_21398_parent_isolate_test.dart +++ b/tests/lib/isolate/issue_21398_parent_isolate_test.dart
@@ -26,17 +26,21 @@ // First spawn an isolate using spawnURI and have it // send back a "non-literal" like object. asyncStart(); - Future<Isolate?>.value(Isolate.spawnUri( - Uri.parse('issue_21398_child_isolate.dart'), - [], - [new FromMainIsolate(), receive1.sendPort])).catchError((error) { + Future<Isolate?>.value( + Isolate.spawnUri(Uri.parse('issue_21398_child_isolate.dart'), [], [ + new FromMainIsolate(), + receive1.sendPort, + ]), + ).catchError((error) { Expect.isTrue(error is ArgumentError); asyncEnd(); }); asyncStart(); Isolate.spawnUri( - Uri.parse('issue_21398_child_isolate.dart'), [], receive1.sendPort) - .then((isolate) { + Uri.parse('issue_21398_child_isolate.dart'), + [], + receive1.sendPort, + ).then((isolate) { receive1.listen((msg) { Expect.stringEquals(msg, "Invalid Argument(s)."); receive1.close(); @@ -48,8 +52,9 @@ // like object and also have the child isolate send back a "non-literal" // like object. asyncStart(); - Isolate.spawn(funcChild, [new FromMainIsolate(), receive2.sendPort]) - .then((isolate) { + Isolate.spawn(funcChild, [new FromMainIsolate(), receive2.sendPort]).then(( + isolate, + ) { receive2.listen((msg) { Expect.isTrue(msg is FromMainIsolate); Expect.equals(10, msg.fld);
diff --git a/tests/lib/isolate/issue_24243_parent_isolate_test.dart b/tests/lib/isolate/issue_24243_parent_isolate_test.dart index 4c20a16..a80bc6d 100644 --- a/tests/lib/isolate/issue_24243_parent_isolate_test.dart +++ b/tests/lib/isolate/issue_24243_parent_isolate_test.dart
@@ -12,8 +12,10 @@ // send back a "literal" like list object. var receive1 = new ReceivePort(); Isolate.spawnUri( - Uri.parse('issue_24243_child1_isolate.dart'), [], receive1.sendPort) - .then((isolate) { + Uri.parse('issue_24243_child1_isolate.dart'), + [], + receive1.sendPort, + ).then((isolate) { receive1.listen((msg) { var list0 = <int>[1, 2, 3]; var list1 = <int>[4, 5, 6]; @@ -31,8 +33,10 @@ // send back a "literal" like map object. var receive2 = new ReceivePort(); Isolate.spawnUri( - Uri.parse('issue_24243_child2_isolate.dart'), [], receive2.sendPort) - .then((isolate) { + Uri.parse('issue_24243_child2_isolate.dart'), + [], + receive2.sendPort, + ).then((isolate) { receive2.listen((msg) { var map0 = <int, String>{1: 'one', 2: 'two', 3: 'three'}; var map1 = <int, String>{4: 'four', 5: 'five', 6: 'six'};
diff --git a/tests/lib/isolate/issue_6610_test.dart b/tests/lib/isolate/issue_6610_test.dart index 11482e0..a8b6aa1 100644 --- a/tests/lib/isolate/issue_6610_test.dart +++ b/tests/lib/isolate/issue_6610_test.dart
@@ -67,8 +67,14 @@ }); Isolate.spawnUri( - Uri.parse("http://127.0.0.1:${server.port}"), [], port.sendPort); + Uri.parse("http://127.0.0.1:${server.port}"), + [], + port.sendPort, + ); Isolate.spawnUri( - Uri.parse("http://127.0.0.1:${server.port}"), [], port.sendPort); + Uri.parse("http://127.0.0.1:${server.port}"), + [], + port.sendPort, + ); }); }
diff --git a/tests/lib/isolate/large_byte_data_leak_test.dart b/tests/lib/isolate/large_byte_data_leak_test.dart index ee19255..3c19911 100644 --- a/tests/lib/isolate/large_byte_data_leak_test.dart +++ b/tests/lib/isolate/large_byte_data_leak_test.dart
@@ -16,16 +16,19 @@ void child(replyPort) { print("Child start"); - Expect.throws(() { - replyPort.send([ - new ByteData(large), - new UserTag("User tags are not allowed in isolate messages"), - new ByteData(large), - ]); - replyPort.send("Not reached"); - }, (e) { - return e.toString().contains("Illegal argument in isolate message"); - }); + Expect.throws( + () { + replyPort.send([ + new ByteData(large), + new UserTag("User tags are not allowed in isolate messages"), + new ByteData(large), + ]); + replyPort.send("Not reached"); + }, + (e) { + return e.toString().contains("Illegal argument in isolate message"); + }, + ); replyPort.send("Done");
diff --git a/tests/lib/isolate/message4_test.dart b/tests/lib/isolate/message4_test.dart index 5d4cfe0..16dd6a2 100644 --- a/tests/lib/isolate/message4_test.dart +++ b/tests/lib/isolate/message4_test.dart
@@ -58,8 +58,10 @@ ReceivePort initialReplyPort = new ReceivePort(); - Isolate i = await Isolate.spawn( - echoMain, [initialReplyPort.sendPort, testPort.sendPort]); + Isolate i = await Isolate.spawn(echoMain, [ + initialReplyPort.sendPort, + testPort.sendPort, + ]); SendPort ping = await initialReplyPort.first; runTests(ping, checks); Expect.isTrue(checks.length > 0);
diff --git a/tests/lib/isolate/message_test.dart b/tests/lib/isolate/message_test.dart index b875bcd..854c328 100644 --- a/tests/lib/isolate/message_test.dart +++ b/tests/lib/isolate/message_test.dart
@@ -21,23 +21,14 @@ static const List list1 = const ["Hello", "World", "Hello", 0xfffffffffff]; static const List list2 = const [null, list1, list1, list1, list1]; static const List list3 = const [list2, 2.0, true, false, 0xfffffffffff]; - static const Map map1 = const { - "a=1": 1, - "b=2": 2, - "c=3": 3, - }; + static const Map map1 = const {"a=1": 1, "b=2": 2, "c=3": 3}; static const Map map2 = const { "list1": list1, "list2": list2, "list3": list3, }; static const List list4 = const [map1, map2]; - static const List elms = const [ - list1, - list2, - list3, - list4, - ]; + static const List elms = const [list1, list2, list3, list4]; static void VerifyMap(Map expected, Map actual) { Expect.equals(actual.length, expected.length);
diff --git a/tests/lib/isolate/mint_maker_test.dart b/tests/lib/isolate/mint_maker_test.dart index 76112c2..ae64554 100644 --- a/tests/lib/isolate/mint_maker_test.dart +++ b/tests/lib/isolate/mint_maker_test.dart
@@ -138,8 +138,10 @@ static Future<MintMakerWrapper> create() { ReceivePort reply = new ReceivePort(); - return Isolate.spawn(mintMakerWrapper, reply.sendPort) - .then((_) => reply.first.then((port) => new MintMakerWrapper._(port))); + return Isolate.spawn( + mintMakerWrapper, + reply.sendPort, + ).then((_) => reply.first.then((port) => new MintMakerWrapper._(port))); } MintMakerWrapper._(this._port);
diff --git a/tests/lib/isolate/ondone_test.dart b/tests/lib/isolate/ondone_test.dart index 27ff3f1..96d09ac 100644 --- a/tests/lib/isolate/ondone_test.dart +++ b/tests/lib/isolate/ondone_test.dart
@@ -39,20 +39,22 @@ if (!mayComplete) throw "COMPLETED EARLY"; asyncEnd(); }); - Isolate.spawn(isomain, reply.sendPort).then((Isolate isolate) { - isolate.addOnExitListener(onExitPort.sendPort, response: "RESPONSE"); - return completer.future; - }).then((echoPort) { - int counter = 4; - reply.handler = (v) { - if (v != counter) throw "WRONG REPLY"; - if (v == 0) throw "REPLY INSTEAD OF SHUTDOWN"; - counter--; - mayComplete = (counter == 0); - echoPort.send(counter); - }; - echoPort.send(counter); - }); + Isolate.spawn(isomain, reply.sendPort) + .then((Isolate isolate) { + isolate.addOnExitListener(onExitPort.sendPort, response: "RESPONSE"); + return completer.future; + }) + .then((echoPort) { + int counter = 4; + reply.handler = (v) { + if (v != counter) throw "WRONG REPLY"; + if (v == 0) throw "REPLY INSTEAD OF SHUTDOWN"; + counter--; + mayComplete = (counter == 0); + echoPort.send(counter); + }; + echoPort.send(counter); + }); } void testCancelExit() { @@ -107,19 +109,21 @@ if (!mayComplete) throw "COMPLETED EARLY"; asyncEnd(); }); - Isolate.spawn(isomain, reply.sendPort).then((Isolate isolate) { - isolate.addOnExitListener(onExitPort.sendPort, response: "RESPONSE"); - isolate.addOnExitListener(onExitPort.sendPort, response: "RESPONSE2"); - return completer.future; - }).then((echoPort) { - int counter = 4; - reply.handler = (v) { - if (v != counter) throw "WRONG REPLY"; - if (v == 0) throw "REPLY INSTEAD OF SHUTDOWN"; - counter--; - mayComplete = (counter == 0); - echoPort.send(counter); - }; - echoPort.send(counter); - }); + Isolate.spawn(isomain, reply.sendPort) + .then((Isolate isolate) { + isolate.addOnExitListener(onExitPort.sendPort, response: "RESPONSE"); + isolate.addOnExitListener(onExitPort.sendPort, response: "RESPONSE2"); + return completer.future; + }) + .then((echoPort) { + int counter = 4; + reply.handler = (v) { + if (v != counter) throw "WRONG REPLY"; + if (v == 0) throw "REPLY INSTEAD OF SHUTDOWN"; + counter--; + mayComplete = (counter == 0); + echoPort.send(counter); + }; + echoPort.send(counter); + }); }
diff --git a/tests/lib/isolate/package_config_getter_test.dart b/tests/lib/isolate/package_config_getter_test.dart index 89b347a..2ee9e90 100644 --- a/tests/lib/isolate/package_config_getter_test.dart +++ b/tests/lib/isolate/package_config_getter_test.dart
@@ -22,8 +22,10 @@ // Setup ".dart_tool/package_config.json". final dotDartToolDir = path.join(tempDir, '.dart_tool'); await Directory(dotDartToolDir).create(); - final packageConfigJsonPath = - path.join(dotDartToolDir, 'package_config.json'); + final packageConfigJsonPath = path.join( + dotDartToolDir, + 'package_config.json', + ); final packageConfigJsonFile = File(packageConfigJsonPath); await packageConfigJsonFile.writeAsString(buildPackageConfig('foo', true));
diff --git a/tests/lib/isolate/package_config_test.dart b/tests/lib/isolate/package_config_test.dart index faffc35..54b77f4 100644 --- a/tests/lib/isolate/package_config_test.dart +++ b/tests/lib/isolate/package_config_test.dart
@@ -17,8 +17,12 @@ } dynamic error; try { - await Isolate.spawnUri(Platform.script, [], 'msg', - packageConfig: Uri.parse('foobar:///no/such/file/')); + await Isolate.spawnUri( + Platform.script, + [], + 'msg', + packageConfig: Uri.parse('foobar:///no/such/file/'), + ); } catch (e) { error = e; }
diff --git a/tests/lib/isolate/package_resolve_test.dart b/tests/lib/isolate/package_resolve_test.dart index ceec284..79df6da 100644 --- a/tests/lib/isolate/package_resolve_test.dart +++ b/tests/lib/isolate/package_resolve_test.dart
@@ -33,8 +33,12 @@ Future runTest(String packageConfig) async { final data = Uri.dataFromString(packageConfig); final port = ReceivePort(); - await Isolate.spawnUri(Platform.script, [], port.sendPort, - packageConfig: data); + await Isolate.spawnUri( + Platform.script, + [], + port.sendPort, + packageConfig: data, + ); final msg = await port.first; if (msg is! List) { print(msg.runtimeType);
diff --git a/tests/lib/isolate/pause_test.dart b/tests/lib/isolate/pause_test.dart index 8bfeaef..b83534f 100644 --- a/tests/lib/isolate/pause_test.dart +++ b/tests/lib/isolate/pause_test.dart
@@ -22,23 +22,26 @@ late Capability resume; var completer = new Completer(); // Completed by first reply from isolate. reply.handler = completer.complete; - Isolate.spawn(isomain1, reply.sendPort).then((Isolate iso) { - isolate = iso; - return completer.future; - }).then((echoPort) { - // Isolate has been created, and first response has been returned. - resume = isolate.pause(); - echoPort.send(24); - reply.handler = (v) { - throw "RESPONSE WHILE PAUSED?!?"; - }; - return new Future.delayed(const Duration(milliseconds: 250)); - }).then((_) { - reply.handler = (v) { - if (v != 24) throw "WRONG ANSWER!"; - reply.close(); - asyncEnd(); - }; - isolate.resume(resume); - }); + Isolate.spawn(isomain1, reply.sendPort) + .then((Isolate iso) { + isolate = iso; + return completer.future; + }) + .then((echoPort) { + // Isolate has been created, and first response has been returned. + resume = isolate.pause(); + echoPort.send(24); + reply.handler = (v) { + throw "RESPONSE WHILE PAUSED?!?"; + }; + return new Future.delayed(const Duration(milliseconds: 250)); + }) + .then((_) { + reply.handler = (v) { + if (v != 24) throw "WRONG ANSWER!"; + reply.close(); + asyncEnd(); + }; + isolate.resume(resume); + }); }
diff --git a/tests/lib/isolate/ping_test.dart b/tests/lib/isolate/ping_test.dart index 2f13a78..69ffe50 100644 --- a/tests/lib/isolate/ping_test.dart +++ b/tests/lib/isolate/ping_test.dart
@@ -26,14 +26,24 @@ reply.handler = (v) { result.add(v); if (v == 0) { - Expect.listEquals(["alive", "control"], - result.where((x) => x is String).toList(), "control events"); - Expect.listEquals([3, 2, 1, 0], - result.where((x) => x is int).toList(), "data events"); + Expect.listEquals( + ["alive", "control"], + result.where((x) => x is String).toList(), + "control events", + ); + Expect.listEquals( + [3, 2, 1, 0], + result.where((x) => x is int).toList(), + "data events", + ); Expect.isTrue( - result.indexOf("alive") < result.indexOf(2), "alive index < 2"); - Expect.isTrue(result.indexOf("control") < result.indexOf(1), - "control index < 1"); + result.indexOf("alive") < result.indexOf(2), + "alive index < 2", + ); + Expect.isTrue( + result.indexOf("control") < result.indexOf(1), + "control index < 1", + ); reply.close(); asyncEnd(); }
diff --git a/tests/lib/isolate/raw_port_test.dart b/tests/lib/isolate/raw_port_test.dart index e6f1246..6830c01 100644 --- a/tests/lib/isolate/raw_port_test.dart +++ b/tests/lib/isolate/raw_port_test.dart
@@ -68,14 +68,11 @@ Isolate.spawn(remote, rawPort.sendPort); Isolate.spawn(remote, port.sendPort); int ctr = 2; - port.listen( - (v) { - Expect.equals(v, "reply"); - ctr--; - if (ctr == 0) port.close(); - }, - onDone: () => completer.complete(), - ); + port.listen((v) { + Expect.equals(v, "reply"); + ctr--; + if (ctr == 0) port.close(); + }, onDone: () => completer.complete()); }; return completer.future; }); @@ -86,14 +83,18 @@ final onExit = ReceivePort(); final parentSendPort = parentPort.sendPort; - await Isolate.spawn((_) async { - final weakPort = RawReceivePort(); - parentSendPort.send(weakPort.sendPort); - weakPort.handler = (message) { - weakPort.keepIsolateAlive = false; - parentSendPort.send(1000 + message); - }; - }, null, onExit: onExit.sendPort); + await Isolate.spawn( + (_) async { + final weakPort = RawReceivePort(); + parentSendPort.send(weakPort.sendPort); + weakPort.handler = (message) { + weakPort.keepIsolateAlive = false; + parentSendPort.send(1000 + message); + }; + }, + null, + onExit: onExit.sendPort, + ); final si = StreamIterator(parentPort);
diff --git a/tests/lib/isolate/regress_flutter_22796_test.dart b/tests/lib/isolate/regress_flutter_22796_test.dart index c58a07a..001bfc9 100644 --- a/tests/lib/isolate/regress_flutter_22796_test.dart +++ b/tests/lib/isolate/regress_flutter_22796_test.dart
@@ -18,7 +18,10 @@ final _int32Array = new Int32List(5 * 1024); A() { _int32Array.setRange( - 0, _int32Array.length, Iterable.generate(_int32Array.length)); + 0, + _int32Array.length, + Iterable.generate(_int32Array.length), + ); verify(); }
diff --git a/tests/lib/isolate/remove_error_listener_test.dart b/tests/lib/isolate/remove_error_listener_test.dart index f2599d8..6ee1659 100644 --- a/tests/lib/isolate/remove_error_listener_test.dart +++ b/tests/lib/isolate/remove_error_listener_test.dart
@@ -14,10 +14,13 @@ final result = Process.runSync(Platform.executable, [ ...Platform.executableArguments, Platform.script.toFilePath(), - 'child' + 'child', ]); - Expect.isTrue(result.stderr.contains( - "Unhandled exception:${Platform.lineTerminator}Exception: Oops!")); + Expect.isTrue( + result.stderr.contains( + "Unhandled exception:${Platform.lineTerminator}Exception: Oops!", + ), + ); return; } {
diff --git a/tests/lib/isolate/scenarios/automatic_resolution_spec/package_resolve_test.dart b/tests/lib/isolate/scenarios/automatic_resolution_spec/package_resolve_test.dart index 236d920..2901008 100644 --- a/tests/lib/isolate/scenarios/automatic_resolution_spec/package_resolve_test.dart +++ b/tests/lib/isolate/scenarios/automatic_resolution_spec/package_resolve_test.dart
@@ -14,8 +14,12 @@ return; } var p = new RawReceivePort(); - Isolate.spawnUri(Platform.script, [], p.sendPort, - automaticPackageResolution: true); + Isolate.spawnUri( + Platform.script, + [], + p.sendPort, + automaticPackageResolution: true, + ); p.handler = (msg) { p.close(); if (msg is! List) {
diff --git a/tests/lib/isolate/scenarios/package_data_uri_spec/package_resolve_test.dart b/tests/lib/isolate/scenarios/package_data_uri_spec/package_resolve_test.dart index 22740d9..0583bff 100644 --- a/tests/lib/isolate/scenarios/package_data_uri_spec/package_resolve_test.dart +++ b/tests/lib/isolate/scenarios/package_data_uri_spec/package_resolve_test.dart
@@ -33,8 +33,12 @@ Future runTest(String packageConfig) async { final data = Uri.dataFromString(packageConfig); final port = ReceivePort(); - await Isolate.spawnUri(Platform.script, [], port.sendPort, - packageConfig: data); + await Isolate.spawnUri( + Platform.script, + [], + port.sendPort, + packageConfig: data, + ); final msg = await port.first; if (msg is! List) { print(msg.runtimeType); @@ -54,8 +58,9 @@ try { var packageConfigStr = Platform.packageConfig; var packageConfig = await Isolate.packageConfig; - var resolvedPkg = - await Isolate.resolvePackageUri(Uri.parse(packageUriToResolve)); + var resolvedPkg = await Isolate.resolvePackageUri( + Uri.parse(packageUriToResolve), + ); print("Spawned isolate's package config flag: $packageConfigStr"); print("Spawned isolate's loaded package config: $packageConfig"); print("Spawned isolate's resolved package path: $resolvedPkg");
diff --git a/tests/lib/isolate/scenarios/package_relative_root/package_relative_root_test.dart b/tests/lib/isolate/scenarios/package_relative_root/package_relative_root_test.dart index 47f4d3d..861f0a9 100644 --- a/tests/lib/isolate/scenarios/package_relative_root/package_relative_root_test.dart +++ b/tests/lib/isolate/scenarios/package_relative_root/package_relative_root_test.dart
@@ -38,8 +38,10 @@ if (Bar.value != "Bar1") { throw "Spawning isolate package:bar invalid."; } - print("Spawned isolate resolved $CONFIG_URI to: " - "${await Isolate.resolvePackageUri(Uri.parse(CONFIG_URI))}"); + print( + "Spawned isolate resolved $CONFIG_URI to: " + "${await Isolate.resolvePackageUri(Uri.parse(CONFIG_URI))}", + ); } testCorrectBarPackage(port) async {
diff --git a/tests/lib/isolate/scenarios/package_relative_spec/package_relative_spec_test.dart b/tests/lib/isolate/scenarios/package_relative_spec/package_relative_spec_test.dart index 6118d26..60fd163 100644 --- a/tests/lib/isolate/scenarios/package_relative_spec/package_relative_spec_test.dart +++ b/tests/lib/isolate/scenarios/package_relative_spec/package_relative_spec_test.dart
@@ -18,8 +18,12 @@ return; } var p = new RawReceivePort(); - Isolate.spawnUri(Platform.script, [], p.sendPort, - packageConfig: Uri.parse(CONFIG_URI)); + Isolate.spawnUri( + Platform.script, + [], + p.sendPort, + packageConfig: Uri.parse(CONFIG_URI), + ); p.handler = (msg) { p.close(); if (msg is! List) { @@ -39,8 +43,10 @@ if (Bar.value != "Bar1") { throw "Spawning isolate package:bar invalid."; } - print("Spawned isolate resolved $CONFIG_URI to: " - "${await Isolate.resolvePackageUri(Uri.parse(CONFIG_URI))}"); + print( + "Spawned isolate resolved $CONFIG_URI to: " + "${await Isolate.resolvePackageUri(Uri.parse(CONFIG_URI))}", + ); } testCorrectBarPackage(port) async {
diff --git a/tests/lib/isolate/scenarios/short_package/short_package_test.dart b/tests/lib/isolate/scenarios/short_package/short_package_test.dart index 62dfb8c..b5c7b42 100644 --- a/tests/lib/isolate/scenarios/short_package/short_package_test.dart +++ b/tests/lib/isolate/scenarios/short_package/short_package_test.dart
@@ -33,7 +33,7 @@ if (Flu.value != "Flu") { throw "Import of wrong Flu package."; } -// await testShortResolution(PACKAGE_FLU); + // await testShortResolution(PACKAGE_FLU); await testShortResolution(PACKAGE_FLU + "/"); await testShortResolution(PACKAGE_FLU + "/abc.def"); print("SUCCESS");
diff --git a/tests/lib/isolate/spawn_function_custom_class_test.dart b/tests/lib/isolate/spawn_function_custom_class_test.dart index 0fa9156..5c292ac 100644 --- a/tests/lib/isolate/spawn_function_custom_class_test.dart +++ b/tests/lib/isolate/spawn_function_custom_class_test.dart
@@ -30,8 +30,10 @@ final exitPort = ReceivePort(); final replyPort = ReceivePort(); - Isolate.spawn(isolateEntryPoint, ['hi', replyPort.sendPort], - onExit: exitPort.sendPort); + Isolate.spawn(isolateEntryPoint, [ + 'hi', + replyPort.sendPort, + ], onExit: exitPort.sendPort); replyPort.listen((msg) { replyPort.close();
diff --git a/tests/lib/isolate/spawn_function_test.dart b/tests/lib/isolate/spawn_function_test.dart index f23f1e6..66d9324 100644 --- a/tests/lib/isolate/spawn_function_test.dart +++ b/tests/lib/isolate/spawn_function_test.dart
@@ -30,8 +30,12 @@ // Start new isolate; paused so it's alive till we read the debugName. // If the isolate runs to completion, the isolate might get cleaned up // and debugName might be null. - final isolate = await Isolate.spawn(isolateEntryPoint, ['hi', port.sendPort], - paused: true, debugName: debugName); + final isolate = await Isolate.spawn( + isolateEntryPoint, + ['hi', port.sendPort], + paused: true, + debugName: debugName, + ); Expect.equals(isolate.debugName, debugName); isolate.resume(isolate.pauseCapability!);
diff --git a/tests/lib/isolate/spawn_uri__package_uri__test.dart b/tests/lib/isolate/spawn_uri__package_uri__test.dart index b502a5f..17fa476 100644 --- a/tests/lib/isolate/spawn_uri__package_uri__test.dart +++ b/tests/lib/isolate/spawn_uri__package_uri__test.dart
@@ -23,46 +23,67 @@ runWithPackagesArg || !spawnWithPackageConfig; for (final optionalPackageUri in const [true, false]) { print('TEST optionalPackageUri = $optionalPackageUri'); - futures.add(runPackageConfigTest(runWithPackagesArg, - spawnWithPackageConfig, optionalPackageUri, checkForResolveUri)); + futures.add( + runPackageConfigTest( + runWithPackagesArg, + spawnWithPackageConfig, + optionalPackageUri, + checkForResolveUri, + ), + ); } } } await Future.wait(futures); } -Future runPackageConfigTest(bool withPackagesArg, bool spawnWithArg, - bool optionalPackageUri, bool checkForResolveUri) async { +Future runPackageConfigTest( + bool withPackagesArg, + bool spawnWithArg, + bool optionalPackageUri, + bool checkForResolveUri, +) async { await withApplicationDirAndDotDartToolPackageConfig( - (String tempDir, String packageJson, String mainFile) async { - final args = [if (withPackagesArg) '--packages=$packageJson', mainFile]; - await run(executable, args); - }, spawnWithArg, optionalPackageUri, checkForResolveUri); + (String tempDir, String packageJson, String mainFile) async { + final args = [if (withPackagesArg) '--packages=$packageJson', mainFile]; + await run(executable, args); + }, + spawnWithArg, + optionalPackageUri, + checkForResolveUri, + ); } Future withApplicationDirAndDotDartToolPackageConfig( - Future fn(String tempDir, String packageJson, String mainFile), - bool spawnWithArg, - bool optionalPackageUri, - bool checkForResolveUri) async { + Future fn(String tempDir, String packageJson, String mainFile), + bool spawnWithArg, + bool optionalPackageUri, + bool checkForResolveUri, +) async { await withTempDir((String tempDir) async { // Setup ".dart_tool/package_config.json" final dotDartToolDir = path.join(tempDir, '.dart_tool'); await Directory(dotDartToolDir).create(); final packageConfigJsonFile = path.join( - dotDartToolDir, spawnWithArg ? 'baz.packages' : 'package_config.json'); - await File(packageConfigJsonFile) - .writeAsString(buildPackageConfig('foo', optionalPackageUri)); + dotDartToolDir, + spawnWithArg ? 'baz.packages' : 'package_config.json', + ); + await File( + packageConfigJsonFile, + ).writeAsString(buildPackageConfig('foo', optionalPackageUri)); // Setup actual application final mainFile = path.join(tempDir, 'main.dart'); final childIsolateFile = path.join(tempDir, 'child_isolate.dart'); final importUri = 'package:foo/child_isolate.dart'; await File(childIsolateFile).writeAsString(buildChildIsolate()); - await File(mainFile).writeAsString(buildMainIsolate( + await File(mainFile).writeAsString( + buildMainIsolate( importUri, spawnWithArg ? packageConfigJsonFile : null, - checkForResolveUri ? childIsolateFile : null)); + checkForResolveUri ? childIsolateFile : null, + ), + ); await fn(tempDir, packageConfigJsonFile, mainFile); }); @@ -77,12 +98,17 @@ } } -Future<ProcessResult> run(String executable, List<String> args, - {String? cwd}) async { +Future<ProcessResult> run( + String executable, + List<String> args, { + String? cwd, +}) async { print('Running $executable ${args.join(' ')}'); final String workingDirectory = cwd ?? Directory.current.absolute.path; - final result = await Process.run(executable, ['--trace-loading', ...args], - workingDirectory: workingDirectory); + final result = await Process.run(executable, [ + '--trace-loading', + ...args, + ], workingDirectory: workingDirectory); print('exitCode:\n${result.exitCode}'); print('stdout:\n${result.stdout}'); print('stdout:\n${result.stderr}'); @@ -92,7 +118,8 @@ String buildDotPackages(String packageName) => '$packageName:.'; -String buildPackageConfig(String packageName, bool optionalPackageUri) => ''' +String buildPackageConfig(String packageName, bool optionalPackageUri) => + ''' { "configVersion": 2, "packages": [ @@ -114,7 +141,10 @@ '''; String buildMainIsolate( - String spawnUri, String? packageConfigUri, String? childIsolatePath) => + String spawnUri, + String? packageConfigUri, + String? childIsolatePath, +) => ''' import 'dart:isolate'; import 'dart:io' as io;
diff --git a/tests/lib/isolate/spawn_uri_exported_main_test.dart b/tests/lib/isolate/spawn_uri_exported_main_test.dart index 1c3efe6..56c1df8 100644 --- a/tests/lib/isolate/spawn_uri_exported_main_test.dart +++ b/tests/lib/isolate/spawn_uri_exported_main_test.dart
@@ -19,8 +19,11 @@ Expect.equals(msg, 50); rp.close(); }; - Isolate.spawnUri(Uri.parse("spawn_uri_exported_main.dart"), [], rp.sendPort) - .then((_) { + Isolate.spawnUri( + Uri.parse("spawn_uri_exported_main.dart"), + [], + rp.sendPort, + ).then((_) { print("Loaded"); t.cancel(); });
diff --git a/tests/lib/isolate/spawn_uri_fail_test.dart b/tests/lib/isolate/spawn_uri_fail_test.dart index 8d46548..9efdbeb 100644 --- a/tests/lib/isolate/spawn_uri_fail_test.dart +++ b/tests/lib/isolate/spawn_uri_fail_test.dart
@@ -10,31 +10,50 @@ var pkgRoot = Uri.parse("file:///no/such/directory/"); var pkgConfig = Uri.parse("file:///no/such/.packages"); try { - var i = await Isolate.spawnUri(Platform.script, [], null, - packageRoot: pkgRoot, packageConfig: pkgConfig); + var i = await Isolate.spawnUri( + Platform.script, + [], + null, + packageRoot: pkgRoot, + packageConfig: pkgConfig, + ); } catch (e) { print(e); Expect.isTrue(e is ArgumentError); } try { - var i = await Isolate.spawnUri(Platform.script, [], null, - packageRoot: pkgRoot, automaticPackageResolution: true); + var i = await Isolate.spawnUri( + Platform.script, + [], + null, + packageRoot: pkgRoot, + automaticPackageResolution: true, + ); } catch (e) { print(e); Expect.isTrue(e is ArgumentError); } try { - var i = await Isolate.spawnUri(Platform.script, [], null, - packageConfig: pkgConfig, automaticPackageResolution: true); + var i = await Isolate.spawnUri( + Platform.script, + [], + null, + packageConfig: pkgConfig, + automaticPackageResolution: true, + ); } catch (e) { print(e); Expect.isTrue(e is ArgumentError); } try { - var i = await Isolate.spawnUri(Platform.script, [], null, - packageRoot: pkgRoot, - packageConfig: pkgConfig, - automaticPackageResolution: true); + var i = await Isolate.spawnUri( + Platform.script, + [], + null, + packageRoot: pkgRoot, + packageConfig: pkgConfig, + automaticPackageResolution: true, + ); } catch (e) { print(e); Expect.isTrue(e is ArgumentError);
diff --git a/tests/lib/isolate/spawn_uri_missing_from_isolate_test.dart b/tests/lib/isolate/spawn_uri_missing_from_isolate_test.dart index 004a428..9ecf8d2 100644 --- a/tests/lib/isolate/spawn_uri_missing_from_isolate_test.dart +++ b/tests/lib/isolate/spawn_uri_missing_from_isolate_test.dart
@@ -21,8 +21,10 @@ const String SUCCESS = 'Test worked.'; void isolate(SendPort port) { - doTest().then((_) => port.send(SUCCESS), - onError: (error, stack) => port.send('Test failed: $error\n$stack')); + doTest().then( + (_) => port.send(SUCCESS), + onError: (error, stack) => port.send('Test failed: $error\n$stack'), + ); } main() {
diff --git a/tests/lib/isolate/spawn_uri_missing_test.dart b/tests/lib/isolate/spawn_uri_missing_test.dart index 2fc998f..1a6bb4e 100644 --- a/tests/lib/isolate/spawn_uri_missing_test.dart +++ b/tests/lib/isolate/spawn_uri_missing_test.dart
@@ -17,12 +17,13 @@ Future doTest() { return Isolate.spawnUri(Uri.base.resolve('no_such_file'), [], null) .then<Null>((Isolate isolate) { - throw UNEXPECTED_MESSAGE; - }).catchError((error) { - if (error == UNEXPECTED_MESSAGE) throw error; - print('An error was thrown as expected'); - return null; - }); + throw UNEXPECTED_MESSAGE; + }) + .catchError((error) { + if (error == UNEXPECTED_MESSAGE) throw error; + print('An error was thrown as expected'); + return null; + }); } main() {
diff --git a/tests/lib/isolate/spawn_uri_nested_child1_vm_isolate.dart b/tests/lib/isolate/spawn_uri_nested_child1_vm_isolate.dart index 6008357..25b19e4 100644 --- a/tests/lib/isolate/spawn_uri_nested_child1_vm_isolate.dart +++ b/tests/lib/isolate/spawn_uri_nested_child1_vm_isolate.dart
@@ -16,8 +16,9 @@ port2.close(); }); - Isolate.spawnUri(Uri.parse('spawn_uri_nested_child2_vm_isolate.dart'), ['hi'], - port2.sendPort); + Isolate.spawnUri(Uri.parse('spawn_uri_nested_child2_vm_isolate.dart'), [ + 'hi', + ], port2.sendPort); var data = message[0]; var replyTo = message[1];
diff --git a/tests/lib/isolate/spawn_uri_type_prefix_optimization_test.dart b/tests/lib/isolate/spawn_uri_type_prefix_optimization_test.dart index 9ab9ce3..1730ce7 100644 --- a/tests/lib/isolate/spawn_uri_type_prefix_optimization_test.dart +++ b/tests/lib/isolate/spawn_uri_type_prefix_optimization_test.dart
@@ -29,6 +29,9 @@ if (msg == "done") receivePort.close(); }; await Isolate.spawnUri( - Platform.script, <String>["child"], receivePort.sendPort, - errorsAreFatal: true); + Platform.script, + <String>["child"], + receivePort.sendPort, + errorsAreFatal: true, + ); }
diff --git a/tests/lib/isolate/spawn_uri_types_test.dart b/tests/lib/isolate/spawn_uri_types_test.dart index 76294a5..d3b104e 100644 --- a/tests/lib/isolate/spawn_uri_types_test.dart +++ b/tests/lib/isolate/spawn_uri_types_test.dart
@@ -52,6 +52,9 @@ if (msg == "done") receivePort.close(); }; await Isolate.spawnUri( - Platform.script, <String>["child"], receivePort.sendPort, - errorsAreFatal: true); + Platform.script, + <String>["child"], + receivePort.sendPort, + errorsAreFatal: true, + ); }
diff --git a/tests/lib/isolate/static_function_test.dart b/tests/lib/isolate/static_function_test.dart index 3dc12d6..18e79b4 100644 --- a/tests/lib/isolate/static_function_test.dart +++ b/tests/lib/isolate/static_function_test.dart
@@ -28,8 +28,8 @@ // An unnamed closure created inside a function. get dynamicClosure => (SendPort port) { - port.send("WHAT??"); - }; + port.send("WHAT??"); +}; // A named closure created inside a function. get namedDynamicClosure { @@ -55,9 +55,9 @@ late Function namedConstructorBodyClosure; C() - : constructorInitializerClosure = ((SendPort port) { - port.send("Init?"); - }) { + : constructorInitializerClosure = ((SendPort port) { + port.send("Init?"); + }) { constructorBodyClosure = (SendPort port) { port.send("bodyClosure?"); }; @@ -137,11 +137,20 @@ spawnTest("named dynamic closure", namedDynamicClosure, "WHAT FOO??"); spawnTest("instance closure", new C().instanceClosure, "C WHAT?"); spawnTest( - "initializer closure", new C().constructorInitializerClosure, "Init?"); + "initializer closure", + new C().constructorInitializerClosure, + "Init?", + ); spawnTest( - "constructor closure", new C().constructorBodyClosure, "bodyClosure?"); - spawnTest("named constructor closure", new C().namedConstructorBodyClosure, - "namedBodyClosure?"); + "constructor closure", + new C().constructorBodyClosure, + "bodyClosure?", + ); + spawnTest( + "named constructor closure", + new C().namedConstructorBodyClosure, + "namedBodyClosure?", + ); spawnTest("instance method", new C().instanceMethod, "INSTANCE WHAT?"); asyncEnd();
diff --git a/tests/lib/isolate/string_from_environment_default_value_test.dart b/tests/lib/isolate/string_from_environment_default_value_test.dart index 165e044..abd5773 100644 --- a/tests/lib/isolate/string_from_environment_default_value_test.dart +++ b/tests/lib/isolate/string_from_environment_default_value_test.dart
@@ -9,7 +9,9 @@ void test(port) { Expect.equals('', const String.fromEnvironment('NOT_FOUND')); Expect.equals( - 'x', const String.fromEnvironment('NOT_FOUND', defaultValue: 'x')); + 'x', + const String.fromEnvironment('NOT_FOUND', defaultValue: 'x'), + ); if (port != null) port.send(null); }
diff --git a/tests/lib/isolate/transferable_failed_to_send_test.dart b/tests/lib/isolate/transferable_failed_to_send_test.dart index c55ae3c..c784d08 100644 --- a/tests/lib/isolate/transferable_failed_to_send_test.dart +++ b/tests/lib/isolate/transferable_failed_to_send_test.dart
@@ -24,7 +24,8 @@ { final transferableFirst = TransferableTypedData.fromList([x]); Expect.throwsArgumentError( - () => port.sendPort.send(<dynamic>[transferableFirst, socket])); + () => port.sendPort.send(<dynamic>[transferableFirst, socket]), + ); // Once TransferableTypedData was sent even if attempt failed, it can't be // materialized. // This need to be changed so that on failed send we should not detach the @@ -39,8 +40,13 @@ } { final transferableFirst = TransferableTypedData.fromList([x]); - Expect.throwsArgumentError(() => port.sendPort - .send(<dynamic>[transferableFirst, transferableFirst, socket])); + Expect.throwsArgumentError( + () => port.sendPort.send(<dynamic>[ + transferableFirst, + transferableFirst, + socket, + ]), + ); // Once TransferableTypedData was sent even if attempt failed, it can't be // materialized. // This need to be changed so that on failed send we should not detach the @@ -57,7 +63,8 @@ { final transferableSecond = TransferableTypedData.fromList([x]); Expect.throwsArgumentError( - () => port.sendPort.send(<dynamic>[socket, transferableSecond])); + () => port.sendPort.send(<dynamic>[socket, transferableSecond]), + ); // Once TransferableTypedData was sent even if attempt failed, it can't be // materialized. final data2 = transferableSecond.materialize().asUint8List(); @@ -69,8 +76,13 @@ { final transferableSecond = TransferableTypedData.fromList([x]); - Expect.throwsArgumentError(() => port.sendPort - .send(<dynamic>[socket, transferableSecond, transferableSecond])); + Expect.throwsArgumentError( + () => port.sendPort.send(<dynamic>[ + socket, + transferableSecond, + transferableSecond, + ]), + ); // Once TransferableTypedData was sent even if attempt failed, it can't be // materialized. final data2 = transferableSecond.materialize().asUint8List();
diff --git a/tests/lib/isolate/transferable_test.dart b/tests/lib/isolate/transferable_test.dart index 419c2b6..e262912 100644 --- a/tests/lib/isolate/transferable_test.dart +++ b/tests/lib/isolate/transferable_test.dart
@@ -90,7 +90,7 @@ } replyPort.send([ TransferableTypedData.fromList([x]), - TransferableTypedData.fromList([x]) + TransferableTypedData.fromList([x]), ]); print("Child same Uint8List twice - materialize first"); @@ -259,9 +259,9 @@ } final map = {list1: true, list2: true}; Iterable<Uint8List> iterable = map.keys; - final result = TransferableTypedData.fromList(iterable.toList()) - .materialize() - .asUint8List(); + final result = TransferableTypedData.fromList( + iterable.toList(), + ).materialize().asUint8List(); for (int i = 0; i < result.length; i++) { Expect.equals(i, result[i]); }
diff --git a/tests/lib/isolate/typed_message_test.dart b/tests/lib/isolate/typed_message_test.dart index 2ab1eef..3fe4923 100644 --- a/tests/lib/isolate/typed_message_test.dart +++ b/tests/lib/isolate/typed_message_test.dart
@@ -37,13 +37,16 @@ Future<Isolate> remote = Isolate.spawn(logMessages, receivePort.sendPort); var msg = <int>[0, 1, 2, 3, 4]; StreamIterator iterator = new StreamIterator(receivePort); - iterator.moveNext().then((b) { - SendPort sendPort = iterator.current; - sendPort.send(msg); - return iterator.moveNext(); - }).then((b) { - Expect.equals(1, iterator.current); - receivePort.close(); - asyncEnd(); - }); + iterator + .moveNext() + .then((b) { + SendPort sendPort = iterator.current; + sendPort.send(msg); + return iterator.moveNext(); + }) + .then((b) { + Expect.equals(1, iterator.current); + receivePort.close(); + asyncEnd(); + }); }
diff --git a/tests/lib/isolate/unresolved_ports_test.dart b/tests/lib/isolate/unresolved_ports_test.dart index 19227f5..91b18fc 100644 --- a/tests/lib/isolate/unresolved_ports_test.dart +++ b/tests/lib/isolate/unresolved_ports_test.dart
@@ -21,24 +21,31 @@ ReceivePort port = initIsolate(init); // TODO(sigmund): use expectAsync when it is OK to use it within an isolate // (issue #6856) - port.first.then((msg) => msg[1] - .send(['${msg[0]}\nBeth says: Tim are you coming? And Bob?', msg[2]])); + port.first.then( + (msg) => msg[1].send([ + '${msg[0]}\nBeth says: Tim are you coming? And Bob?', + msg[2], + ]), + ); } timIsolate(init) { ReceivePort port = initIsolate(init); spawnFunction(bobIsolate).then((bob) { - port.first.then((msg) => bob.send([ - '${msg[0]}\nTim says: Can you tell "main" that we are all coming?', - msg[1] - ])); + port.first.then( + (msg) => bob.send([ + '${msg[0]}\nTim says: Can you tell "main" that we are all coming?', + msg[1], + ]), + ); }); } bobIsolate(init) { ReceivePort port = initIsolate(init); - port.first - .then((msg) => msg[1].send('${msg[0]}\nBob says: we are all coming!')); + port.first.then( + (msg) => msg[1].send('${msg[0]}\nBob says: we are all coming!'), + ); } Future spawnFunction(function) { @@ -59,11 +66,12 @@ asyncStart(); port.listen((msg) { Expect.equals( - msg, - 'main says: Beth, find out if Tim is coming.' - '\nBeth says: Tim are you coming? And Bob?' - '\nTim says: Can you tell "main" that we are all coming?' - '\nBob says: we are all coming!'); + msg, + 'main says: Beth, find out if Tim is coming.' + '\nBeth says: Tim are you coming? And Bob?' + '\nTim says: Can you tell "main" that we are all coming?' + '\nBob says: we are all coming!', + ); Expect.isFalse(failForNegativeTest); port.close(); asyncEnd(); @@ -71,8 +79,11 @@ spawnFunction(timIsolate).then((tim) { spawnFunction(bethIsolate).then((beth) { - beth.send( - ['main says: Beth, find out if Tim is coming.', tim, port.sendPort]); + beth.send([ + 'main says: Beth, find out if Tim is coming.', + tim, + port.sendPort, + ]); }); }); }
diff --git a/tests/lib/isolate/weak_reference_message_2_test.dart b/tests/lib/isolate/weak_reference_message_2_test.dart index 6dc778c..a8532e4 100644 --- a/tests/lib/isolate/weak_reference_message_2_test.dart +++ b/tests/lib/isolate/weak_reference_message_2_test.dart
@@ -13,10 +13,7 @@ main() async { final port = ReceivePort(); - await Isolate.spawn( - runHelper, - port.sendPort, - ); + await Isolate.spawn(runHelper, port.sendPort); final message = await port.first; final weakRef1copy = message[0] as WeakReference<Uint8List>;
diff --git a/tools/VERSION b/tools/VERSION index 9d70334..e297c39 100644 --- a/tools/VERSION +++ b/tools/VERSION
@@ -27,5 +27,5 @@ MAJOR 3 MINOR 9 PATCH 0 -PRERELEASE 85 +PRERELEASE 86 PRERELEASE_PATCH 0