From e15ccdd9be5cd08bb7dde23ed1f25a7ef7ba8057 Mon Sep 17 00:00:00 2001 From: Konstantin Shcheglov Date: Tue, 9 Jun 2026 10:48:56 -0700 Subject: [PATCH] CQ. Remove not useful PubSuggestionCodeTest, tweak for encoding test. Change-Id: I08f5da69db285395566e71463e4e357ea4227ac2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510201 Reviewed-by: Johnni Winther Commit-Queue: Konstantin Shcheglov --- .../test/generated/invalid_code_test.dart | 3 +- .../test/generated/non_hint_code_test.dart | 77 ------------------- 2 files changed, 1 insertion(+), 79 deletions(-) diff --git a/pkg/analyzer/test/generated/invalid_code_test.dart b/pkg/analyzer/test/generated/invalid_code_test.dart index ef3e8f3cc1f..4926b3ae51c 100644 --- a/pkg/analyzer/test/generated/invalid_code_test.dart +++ b/pkg/analyzer/test/generated/invalid_code_test.dart @@ -3,7 +3,6 @@ // BSD-style license that can be found in the LICENSE file. import 'package:analyzer/dart/element/nullability_suffix.dart'; -import 'package:analyzer/src/diagnostic/diagnostic.dart' as diag; import 'package:test_reflective_loader/test_reflective_loader.dart'; import '../src/dart/resolution/context_collection_resolution.dart'; @@ -353,7 +352,7 @@ typedef void F([a = () { if (true) 0; }]); } test_invalid_unicode() async { - await assertErrorsInCode('\uFFFD', [error(diag.encoding, 0, 1)]); + await _assertCanBeAnalyzed('\uFFFD'); } test_invalidPart_withPart() async { diff --git a/pkg/analyzer/test/generated/non_hint_code_test.dart b/pkg/analyzer/test/generated/non_hint_code_test.dart index 65fe7d5cd2c..dd6e4225d1b 100644 --- a/pkg/analyzer/test/generated/non_hint_code_test.dart +++ b/pkg/analyzer/test/generated/non_hint_code_test.dart @@ -2,12 +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:analyzer/src/diagnostic/diagnostic.dart' as diag; import 'package:test_reflective_loader/test_reflective_loader.dart'; import '../src/dart/resolution/context_collection_resolution.dart'; import '../src/dart/resolution/node_text_expectations.dart'; -import 'test_support.dart'; main() { defineReflectiveSuite(() { @@ -141,78 +139,3 @@ f(A a, B b) { '''); } } - -class PubSuggestionCodeTest extends PubPackageResolutionTest { - // TODO(brianwilkerson): The tests in this class are not being run, and all but - // the first would fail. We should implement these checks and enable the - // tests. - test_import_package() async { - await assertErrorsInCode( - ''' -import 'package:somepackage/other.dart'; -''', - [error(diag.uriDoesNotExist, 0, 0)], - ); - } - - test_import_referenceIntoLibDirectory_no_pubspec() async { - newFile("/myproj/lib/other.dart", ''); - await _assertErrorsInCodeInFile( - "/myproj/web/test.dart", - "import '../lib/other.dart';", - [], - ); - } - - test_import_referenceOutOfLibDirectory_no_pubspec() async { - newFile("/myproj/web/other.dart", ''); - await _assertErrorsInCodeInFile( - "/myproj/lib/test.dart", - "import '../web/other.dart';", - [], - ); - } - - test_import_valid_inside_lib1() async { - newFile("/myproj/pubspec.yaml", ''); - newFile("/myproj/lib/other.dart", ''); - await _assertErrorsInCodeInFile( - "/myproj/lib/test.dart", - "import 'other.dart';", - [], - ); - } - - test_import_valid_inside_lib2() async { - newFile("/myproj/pubspec.yaml", ''); - newFile("/myproj/lib/bar/other.dart", ''); - await _assertErrorsInCodeInFile( - "/myproj/lib/foo/test.dart", - "import '../bar/other.dart';", - [], - ); - } - - test_import_valid_outside_lib() async { - newFile("/myproj/pubspec.yaml", ''); - newFile("/myproj/web/other.dart", ''); - await _assertErrorsInCodeInFile( - "/myproj/lib2/test.dart", - "import '../web/other.dart';", - [], - ); - } - - Future _assertErrorsInCodeInFile( - String path, - String content, - List expectedDiagnostics, - ) async { - var file = newFile(path, content); - var result = await resolveFile(file); - - var diagnosticListener = GatheringDiagnosticListener(); - diagnosticListener.addAll(result.diagnostics); - diagnosticListener.assertErrors(expectedDiagnostics); - } -}