Add a few more tests for PART_OF_DIFFERENT_LIBRARY.

Change-Id: I685874502d49e4a6b4164bb25cf449423659514a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2022-10-21 18:25:08 +00:00 committed by Commit Queue
parent 90dac14e8f
commit 30c4cb00b8

View file

@ -15,13 +15,44 @@ main() {
@reflectiveTest
class PartOfDifferentLibraryTest extends PubPackageResolutionTest {
test_name() async {
newFile('$testPackageLibPath/part.dart', "part of lub;");
test_doesNotExist() async {
await assertErrorsInCode('''
library lib;
part 'part.dart';
''', [
error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 5, 11),
]);
}
test_doesNotExist_generated() async {
await assertErrorsInCode('''
part 'part.g.dart';
''', [
error(CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED, 5, 13),
]);
}
test_partOfName() async {
newFile('$testPackageLibPath/part.dart', '''
part of bar;
''');
await assertErrorsInCode('''
library foo;
part 'part.dart';
''', [
error(CompileTimeErrorCode.PART_OF_DIFFERENT_LIBRARY, 18, 11),
]);
}
test_partOfUri() async {
newFile('$testPackageLibPath/part.dart', '''
part of 'other.dart';
''');
await assertErrorsInCode('''
part 'part.dart';
''', [
error(CompileTimeErrorCode.PART_OF_DIFFERENT_LIBRARY, 5, 11),
]);
}
}