diff --git a/pkg/test_runner/lib/src/test_file.dart b/pkg/test_runner/lib/src/test_file.dart index 25dc51078ee..34cc308dd6d 100644 --- a/pkg/test_runner/lib/src/test_file.dart +++ b/pkg/test_runner/lib/src/test_file.dart @@ -14,7 +14,7 @@ final _environmentRegExp = RegExp(r"// Environment=(.*)"); final _packagesRegExp = RegExp(r"// Packages=(.*)"); final _experimentRegExp = RegExp(r"^--enable-experiment=([a-z0-9,-]+)$"); final _localFileRegExp = RegExp( - r"""^\s*(?:import|part) ['"](?!package|dart)(.*)['"];""", + r"""^\s*(?:import(?: augment)?|part) ['"](?!package:|dart:)(.*)['"];""", multiLine: true); List _splitWords(String s) => diff --git a/tests/language/test_runner/impl/imported_augmentation_library.dart b/tests/language/test_runner/impl/imported_augmentation_library.dart new file mode 100644 index 00000000000..2b5cfe35b8f --- /dev/null +++ b/tests/language/test_runner/impl/imported_augmentation_library.dart @@ -0,0 +1,12 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// 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. +// SharedOptions=--enable-experiment=macros + +library augment '../imported_augmentation_library_failure_test.dart'; + +class A +// ^ +// [analyzer] SYNTACTIC_ERROR.EXPECTED_BODY +// [cfe] A class declaration must have a body, even if it is empty. + diff --git a/tests/language/test_runner/imported_augmentation_library_failure_test.dart b/tests/language/test_runner/imported_augmentation_library_failure_test.dart new file mode 100644 index 00000000000..2f90d8aeace --- /dev/null +++ b/tests/language/test_runner/imported_augmentation_library_failure_test.dart @@ -0,0 +1,8 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// 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. +// SharedOptions=--enable-experiment=macros + +// Static tests can assert on failures in imported augmentation libraries. + +import augment 'impl/imported_augmentation_library.dart';