-
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.
Merge 80057b9 into dev
- Loading branch information
Showing
24 changed files
with
2,057 additions
and
1,505 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
13 changes: 13 additions & 0 deletions
13
pkg/analysis_server/test/services/completion/dart/visibility/test_all.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,13 @@ | ||
// 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. | ||
|
||
import 'package:test_reflective_loader/test_reflective_loader.dart'; | ||
|
||
import 'types_test.dart' as types; | ||
|
||
void main() { | ||
defineReflectiveSuite(() { | ||
types.main(); | ||
}, name: 'visibility'); | ||
} |
120 changes: 120 additions & 0 deletions
120
pkg/analysis_server/test/services/completion/dart/visibility/types_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,120 @@ | ||
// 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. | ||
|
||
import 'package:test/test.dart'; | ||
import 'package:test_reflective_loader/test_reflective_loader.dart'; | ||
|
||
import '../../../../completion_test_support.dart'; | ||
|
||
void main() { | ||
defineReflectiveSuite(() { | ||
defineReflectiveTests(CompletionVisibilityTest); | ||
}); | ||
} | ||
|
||
@reflectiveTest | ||
class CompletionVisibilityTest extends CompletionTestCase { | ||
Future<void> test_imported() async { | ||
newFile(convertPath('$testPackageLibPath/lib.dart'), ''' | ||
class C {} | ||
'''); | ||
await getTestCodeSuggestions(''' | ||
import 'lib.dart'; | ||
C^ | ||
'''); | ||
assertHasCompletion('C'); | ||
} | ||
|
||
Future<void> test_imported_localAndMultiplePrefixes() async { | ||
newFile(convertPath('$testPackageLibPath/lib.dart'), ''' | ||
class C {} | ||
'''); | ||
await getTestCodeSuggestions(''' | ||
import 'lib.dart' as l1; | ||
import 'lib.dart' as l2; | ||
class C {} | ||
C^ | ||
'''); | ||
assertHasCompletion('C'); | ||
assertHasCompletion('l1.C'); | ||
assertHasCompletion('l2.C'); | ||
} | ||
|
||
Future<void> test_imported_localAndUnprefixed() async { | ||
newFile(convertPath('$testPackageLibPath/lib.dart'), ''' | ||
class C {} | ||
'''); | ||
await getTestCodeSuggestions(''' | ||
import 'lib.dart'; | ||
class C {} | ||
C^ | ||
'''); | ||
// Verify exactly one, and it was the local one. | ||
assertHasCompletion('C', libraryUri: isNull); | ||
} | ||
|
||
Future<void> test_imported_multiplePrefixes() async { | ||
newFile(convertPath('$testPackageLibPath/lib.dart'), ''' | ||
class C {} | ||
'''); | ||
await getTestCodeSuggestions(''' | ||
import 'lib.dart' as l1; | ||
import 'lib.dart' as l2; | ||
C^ | ||
'''); | ||
assertHasCompletion('l1.C'); | ||
assertHasCompletion('l2.C'); | ||
} | ||
|
||
Future<void> test_imported_prefix() async { | ||
newFile(convertPath('$testPackageLibPath/lib.dart'), ''' | ||
class C {} | ||
'''); | ||
await getTestCodeSuggestions(''' | ||
import 'lib.dart' as l; | ||
C^ | ||
'''); | ||
assertHasCompletion('l.C'); | ||
} | ||
|
||
Future<void> test_local() async { | ||
await getTestCodeSuggestions(''' | ||
class C {} | ||
C^ | ||
'''); | ||
assertHasCompletion('C'); | ||
} | ||
|
||
Future<void> test_localAndNotImported() async { | ||
newFile(convertPath('$testPackageLibPath/lib.dart'), ''' | ||
class C {} | ||
'''); | ||
await getTestCodeSuggestions(''' | ||
class C {} | ||
C^ | ||
'''); | ||
// This verifies exactly one, since we won't suggest the not-imported | ||
// when it matches a local name. | ||
assertHasCompletion('C'); | ||
} | ||
|
||
Future<void> test_notImported() async { | ||
newFile(convertPath('$testPackageLibPath/lib.dart'), ''' | ||
class C {} | ||
'''); | ||
await getTestCodeSuggestions(''' | ||
C^ | ||
'''); | ||
assertHasCompletion('C'); | ||
} | ||
} |
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
Oops, something went wrong.