Skip to content

Commit

Permalink
migrate public_member_api_docs integration tests (#4612)
Browse files Browse the repository at this point in the history
  • Loading branch information
pq authored Jul 24, 2023
1 parent 05db75f commit e78e0ce
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 216 deletions.
65 changes: 0 additions & 65 deletions test/integration/public_member_api_docs.dart

This file was deleted.

2 changes: 0 additions & 2 deletions test/integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import '../test_data/rules/experiments/experiments.dart';
import 'integration/avoid_web_libraries_in_flutter.dart'
as avoid_web_libraries_in_flutter;
import 'integration/close_sinks.dart' as close_sinks;
import 'integration/public_member_api_docs.dart' as public_member_api_docs;
import 'mocks.dart';
import 'test_constants.dart';

Expand Down Expand Up @@ -125,7 +124,6 @@ void ruleTests() {
group('rule', () {
avoid_web_libraries_in_flutter.main();
close_sinks.main();
public_member_api_docs.main();
});
}

Expand Down
54 changes: 54 additions & 0 deletions test/rules/public_member_api_docs_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import '../rule_test_support.dart';
main() {
defineReflectiveSuite(() {
defineReflectiveTests(PublicMemberApiDocsTest);
defineReflectiveTests(PublicMemberApiDocsTestDirTest);
});
}

Expand Down Expand Up @@ -81,6 +82,18 @@ enum A {
]);
}

test_enum_privateConstant() async {
await assertDiagnostics(r'''
/// Documented.
enum A {
_a;
}
''', [
// No lint.
error(WarningCode.UNUSED_FIELD, 27, 2),
]);
}

test_enumConstructor() async {
await assertNoDiagnostics(r'''
/// Documented.
Expand Down Expand Up @@ -212,4 +225,45 @@ final class A extends S {}
lint(39, 1),
]);
}

test_topLevelMembers() async {
await assertDiagnostics(r'''
int g = 1;
typedef T = void Function();
int get z => 0;
''', [
lint(4, 1),
lint(19, 1),
lint(48, 1),
]);
}

test_topLevelMembers_private() async {
await assertDiagnostics(r'''
int _h = 1;
typedef _T = void Function();
int get _z => 0;
''', [
// No lint
error(WarningCode.UNUSED_ELEMENT, 4, 2),
error(WarningCode.UNUSED_ELEMENT, 20, 2),
error(WarningCode.UNUSED_ELEMENT, 50, 2),
]);
}
}

@reflectiveTest
class PublicMemberApiDocsTestDirTest extends LintRuleTest {
@override
String get lintRule => 'public_member_api_docs';

@override
String get testPackageLibPath => '$testPackageRootPath/test';

test_inTestDir() async {
await assertNoDiagnostics(r'''
String? b;
typedef T = void Function();
''');
}
}

This file was deleted.

135 changes: 0 additions & 135 deletions test_data/integration/public_member_api_docs/lib/a.dart

This file was deleted.

4 changes: 0 additions & 4 deletions test_data/integration/public_member_api_docs/pubspec.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions test_data/integration/public_member_api_docs/test/b.dart

This file was deleted.

0 comments on commit e78e0ce

Please sign in to comment.