Skip to content

Commit 6e17841

Browse files
scheglovCommit Queue
authored andcommitted
Macro. Remove tests from analyzer/ and analysis_server/.
Change-Id: Iabe04d7ff8fe0cc9b605d0c18fd47591fd02d6bd Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406681 Reviewed-by: Phil Quitslund <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent a11d2fe commit 6e17841

40 files changed

+9
-23133
lines changed

pkg/analysis_server/test/abstract_context.dart

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,9 @@ import 'package:meta/meta.dart';
2525
import 'package:test/test.dart';
2626

2727
import 'support/configuration_files.dart';
28-
import 'test_macros.dart';
2928

3029
class AbstractContextTest
31-
with
32-
MockPackagesMixin,
33-
ConfigurationFilesMixin,
34-
ResourceProviderMixin,
35-
TestMacros {
30+
with MockPackagesMixin, ConfigurationFilesMixin, ResourceProviderMixin {
3631
static bool _lintRulesAreRegistered = false;
3732

3833
static final ByteStore _byteStore = MemoryByteStore();

pkg/analysis_server/test/analysis/get_hover_test.dart

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -897,26 +897,6 @@ void f(A a) {
897897
expect(hover.propagatedType, isNull);
898898
}
899899

900-
Future<void> test_constructorInvocation_macroGenerated_named() async {
901-
addMacros([declareInTypeMacro()]);
902-
newFile(testFilePath, '''
903-
import 'macros.dart';
904-
905-
@DeclareInType(' /// named\\n C.named();')
906-
class C {}
907-
908-
C f() => C.named(); //
909-
''');
910-
var hover = await prepareHover('med(); //');
911-
expect(hover.containingLibraryName, 'package:test/test.dart');
912-
expect(hover.containingLibraryPath, testFile.path);
913-
expect(hover.containingClassDescription, 'C');
914-
expect(hover.dartdoc, 'named');
915-
expect(hover.elementDescription, '(new) C C.named()');
916-
expect(hover.elementKind, 'constructor');
917-
expect(hover.staticType, isNull);
918-
}
919-
920900
Future<void>
921901
test_constructorInvocation_referenceFromAugmentation_default() async {
922902
var file = newFile('$testPackageLibPath/a.dart', '''
@@ -1449,32 +1429,6 @@ void f() {
14491429
expect(hover.propagatedType, null);
14501430
}
14511431

1452-
Future<void>
1453-
test_methodInvocation_macroGenerated_referenceToGenerated() async {
1454-
addMacros([declareInTypeMacro()]);
1455-
newFile(testFilePath, '''
1456-
import 'macros.dart';
1457-
1458-
@DeclareInType(\'''
1459-
/// method m
1460-
void m() {}
1461-
\''')
1462-
class C {}
1463-
1464-
void f(C c) {
1465-
c.m();
1466-
}
1467-
''');
1468-
var hover = await prepareHover('m();');
1469-
expect(hover.containingLibraryName, 'package:test/test.dart');
1470-
expect(hover.containingLibraryPath, testFile.path);
1471-
expect(hover.containingClassDescription, 'C');
1472-
expect(hover.dartdoc, 'method m');
1473-
expect(hover.elementDescription, 'void m()');
1474-
expect(hover.elementKind, 'method');
1475-
expect(hover.staticType, 'void Function()');
1476-
}
1477-
14781432
Future<void> test_methodInvocation_recordType() async {
14791433
newFile(testFilePath, '''
14801434
class C {

pkg/analysis_server/test/analysis/notification_highlights2_test.dart

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -708,19 +708,6 @@ class A {
708708
''');
709709
}
710710

711-
Future<void> test_class_macroKeyword() async {
712-
var testCode = TestCode.parse(r'''
713-
macro class A {}
714-
''');
715-
addTestFile(testCode.code);
716-
await prepareHighlights();
717-
assertHighlightText(testCode, -1, r'''
718-
0 + 5 |macro| BUILT_IN
719-
6 + 5 |class| KEYWORD
720-
12 + 1 |A| CLASS
721-
''');
722-
}
723-
724711
Future<void> test_class_method_functionTypedFormalParameter() async {
725712
var testCode = TestCode.parse(r'''
726713
class A {

pkg/analysis_server/test/analysis_server_base.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import 'package:unified_analytics/unified_analytics.dart';
2727
import 'constants.dart';
2828
import 'mocks.dart';
2929
import 'support/configuration_files.dart';
30-
import 'test_macros.dart';
3130

3231
// TODO(scheglov): This is duplicate with pkg/linter/test/rule_test_support.dart.
3332
// Keep them as consistent with each other as they are today. Ultimately combine
@@ -236,7 +235,7 @@ abstract class ContextResolutionTest with ResourceProviderMixin {
236235
}
237236

238237
class PubPackageAnalysisServerTest extends ContextResolutionTest
239-
with MockPackagesMixin, ConfigurationFilesMixin, TestMacros {
238+
with MockPackagesMixin, ConfigurationFilesMixin {
240239
// TODO(scheglov): Consider turning it back into a getter.
241240
late String testFilePath = resourceProvider.convertPath(
242241
'$testPackageLibPath/test.dart',

pkg/analysis_server/test/integration/coverage.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,3 @@ server calls. This file is validated by `coverage_test.dart`.
105105

106106
## lsp domain
107107
- [x] lsp.handle
108-
- [x] lsp.notification

pkg/analysis_server/test/integration/coverage_test.dart

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -109,42 +109,6 @@ void main() {
109109
});
110110
}
111111
});
112-
113-
// notifications
114-
group('notification', () {
115-
for (var notification in domain.notifications) {
116-
var fullName = '${domain.name}.${notification.event}';
117-
test(fullName, () {
118-
if (!allMembers.contains(fullName)) {
119-
fail('$fullName not found in ${coverageFile.path}');
120-
}
121-
122-
var fileName = getCamelWords(
123-
notification.event,
124-
).map((s) => s.toLowerCase()).join('_');
125-
var testName = path.join(domain.name, '${fileName}_test.dart');
126-
var testPath = path.join(
127-
pathPrefix,
128-
'test',
129-
'integration',
130-
testName,
131-
);
132-
133-
// Test that if checked, a test file exists; if not checked, no such
134-
// file exists.
135-
var fileExists = FileSystemEntity.isFileSync(testPath);
136-
var isMarkedAsCovered = coveredMembers.contains(fullName);
137-
expect(
138-
fileExists,
139-
isMarkedAsCovered,
140-
reason:
141-
isMarkedAsCovered
142-
? '$testName marked as covered but has no test at $testPath'
143-
: '$testName marked as not covered has test at $testPath',
144-
);
145-
});
146-
}
147-
});
148112
});
149113
}
150114

pkg/analysis_server/test/integration/dtd/dtd_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class DtdTest
2424
with SharedDtdTests {
2525
@override
2626
void createFile(String path, String content) {
27-
newFile(path, content);
27+
writeFile(path, content);
2828
}
2929

3030
@override

pkg/analysis_server/test/integration/edit/get_refactoring_test.dart

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -75,47 +75,4 @@ void bar() {
7575
await analysisFinished;
7676
expect(currentAnalysisErrors[pathname], isEmpty);
7777
}
78-
79-
Future<void> test_rename_macro() async {
80-
addMacros([declareInTypeMacro()]);
81-
var pathname = sourcePath('lib/test.dart');
82-
var text = r'''
83-
import 'macros.dart';
84-
85-
@DeclareInType(' /// named\\n C.named();')
86-
class C {}
87-
''';
88-
writeFile(pathname, text);
89-
await standardAnalysisSetup();
90-
await analysisFinished;
91-
expect(currentAnalysisErrors[pathname], isEmpty);
92-
93-
// expect a valid rename refactoring
94-
var result = await sendEditGetRefactoring(
95-
RefactoringKind.RENAME,
96-
pathname,
97-
text.indexOf('C {'),
98-
0,
99-
false,
100-
options: RenameOptions('Coo'),
101-
);
102-
expect(result.initialProblems, isEmpty);
103-
expect(result.optionsProblems, isEmpty);
104-
expect(result.finalProblems, isEmpty);
105-
expect(result.potentialEdits, isNull);
106-
107-
var change = result.change!;
108-
expect(change.edits.length, 1);
109-
var fileEdit = change.edits.first;
110-
111-
// apply the refactoring, expect that the new code has no errors
112-
expect(fileEdit.edits.length, 1);
113-
for (var edit in fileEdit.edits) {
114-
text = text.replaceRange(edit.offset, edit.end, edit.replacement);
115-
}
116-
await sendAnalysisUpdateContent({pathname: AddContentOverlay(text)});
117-
118-
await analysisFinished;
119-
expect(currentAnalysisErrors[pathname], isEmpty);
120-
}
12178
}

pkg/analysis_server/test/integration/lsp/notification_test.dart

Lines changed: 0 additions & 75 deletions
This file was deleted.

pkg/analysis_server/test/integration/lsp/test_all.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
import 'package:test_reflective_loader/test_reflective_loader.dart';
66

77
import 'handle_test.dart' as handle;
8-
import 'notification_test.dart' as notification;
98

109
void main() {
1110
defineReflectiveSuite(() {
1211
handle.main();
13-
notification.main();
1412
}, name: 'lsp');
1513
}

0 commit comments

Comments
 (0)