-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[data driven] support moving symbols across packages
See: #48997 Change-Id: Iad16b9eae0523bc4bc14537af642b05efa75b6f7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246663 Commit-Queue: Phil Quitslund <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
- Loading branch information
Showing
6 changed files
with
211 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
pkg/analysis_server/test/src/services/correction/fix/data_driven/test_use_case_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
// Copyright (c) 2022, 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. | ||
|
||
import 'package:test_reflective_loader/test_reflective_loader.dart'; | ||
|
||
import '../fix_processor.dart'; | ||
import 'data_driven_test_support.dart'; | ||
|
||
void main() { | ||
defineReflectiveSuite(() { | ||
defineReflectiveTests(TestUseCaseTest); | ||
}); | ||
} | ||
|
||
@reflectiveTest | ||
class TestUseCaseTest extends DataDrivenFixProcessorTest { | ||
@FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/23067') | ||
Future<void> test_expect_export_deprecated() async { | ||
newFile('$workspaceRootPath/p/lib/lib.dart', ''' | ||
library p; | ||
@deprecated | ||
export 'package:matcher/expect.dart' show expect; | ||
'''); | ||
newFile('$workspaceRootPath/matcher/lib/expect.dart', ''' | ||
void expect(actual, matcher) {} | ||
'''); | ||
|
||
writeTestPackageConfig( | ||
config: PackageConfigFileBuilder() | ||
..add(name: 'matcher', rootPath: '$workspaceRootPath/matcher') | ||
..add(name: 'p', rootPath: '$workspaceRootPath/p'), | ||
); | ||
|
||
addPackageDataFile(''' | ||
version: 1 | ||
transforms: | ||
- title: 'Replace expect' | ||
date: 2022-05-12 | ||
bulkApply: false | ||
element: | ||
uris: ['$importUri'] | ||
function: 'expect' | ||
changes: | ||
- kind: 'replacedBy' | ||
newElement: | ||
uris: ['package:matcher/expect.dart'] | ||
function: 'expect' | ||
'''); | ||
await resolveTestCode(''' | ||
import '$importUri'; | ||
main() { | ||
expect(true, true); | ||
} | ||
'''); | ||
await assertHasFix(''' | ||
import 'package:matcher/expect.dart'; | ||
import '$importUri'; | ||
main() { | ||
expect(true, true); | ||
} | ||
'''); | ||
} | ||
|
||
Future<void> test_expect_removed() async { | ||
setPackageContent(''' | ||
'''); | ||
|
||
addPackageDataFile(''' | ||
version: 1 | ||
transforms: | ||
- title: 'Replace expect' | ||
date: 2022-05-12 | ||
bulkApply: false | ||
element: | ||
uris: ['$importUri'] | ||
function: 'expect' | ||
changes: | ||
- kind: 'replacedBy' | ||
newElement: | ||
uris: ['package:matcher/expect.dart'] | ||
function: 'expect' | ||
'''); | ||
await resolveTestCode(''' | ||
import '$importUri'; | ||
main() { | ||
expect(true, true); | ||
} | ||
'''); | ||
await assertHasFix(''' | ||
import 'package:matcher/expect.dart'; | ||
import '$importUri'; | ||
main() { | ||
expect(true, true); | ||
} | ||
''', errorFilter: ignoreUnusedImport); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters