Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

Commit 2051f94

Browse files
committed
migrate test to reflective_test_loader style
1 parent d99d3bf commit 2051f94

File tree

7 files changed

+49
-96
lines changed

7 files changed

+49
-96
lines changed

test/integration/use_string_in_part_of_directives.dart

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

test/integration_test.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ import 'integration/unnecessary_string_escapes.dart'
4949
as unnecessary_string_escapes;
5050
import 'integration/use_build_context_synchronously.dart'
5151
as use_build_context_synchronously;
52-
import 'integration/use_string_in_part_of_directives.dart'
53-
as use_string_in_part_of_directives;
5452
import 'mocks.dart';
5553
import 'test_constants.dart';
5654

@@ -203,7 +201,6 @@ void ruleTests() {
203201
prefer_mixin.main();
204202
use_build_context_synchronously.main();
205203
prefer_const_constructors.main();
206-
use_string_in_part_of_directives.main();
207204
});
208205
}
209206

test/rule_test_support.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,10 @@ class PubPackageResolutionTest extends _ContextResolutionTest {
237237
/// The path that is not in [workspaceRootPath], contains external packages.
238238
String get packagesRootPath => '/packages';
239239

240+
String get testFileName => 'test.dart';
241+
240242
@override
241-
String get testFilePath => '$testPackageLibPath/test.dart';
243+
String get testFilePath => '$testPackageLibPath/$testFileName';
242244

243245
String? get testPackageLanguageVersion => null;
244246

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:test_reflective_loader/test_reflective_loader.dart';
6+
7+
import '../rule_test_support.dart';
8+
9+
main() {
10+
defineReflectiveSuite(() {
11+
defineReflectiveTests(UseStringInPartOfDirectivesTest);
12+
});
13+
}
14+
15+
@reflectiveTest
16+
class UseStringInPartOfDirectivesTest extends LintRuleTest {
17+
@override
18+
bool get addMetaPackageDep => true;
19+
20+
@override
21+
String get lintRule => 'use_string_in_part_of_directives';
22+
23+
test_part_of_with_string() async {
24+
newFile2('$testPackageRootPath/lib/lib.dart', '''
25+
part '$testFileName';
26+
''');
27+
await assertNoDiagnostics(r'''
28+
part of 'lib.dart';
29+
''');
30+
}
31+
32+
test_part_of_with_library_name() async {
33+
newFile2('$testPackageRootPath/lib/lib.dart', '''
34+
library lib;
35+
part '$testFileName';
36+
''');
37+
await assertDiagnostics(
38+
r'''
39+
part of lib;
40+
''',
41+
[
42+
lint('use_string_in_part_of_directives', 0, 12),
43+
],
44+
);
45+
}
46+
}

test_data/integration/use_string_in_part_of_directives/bad_part.dart

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

test_data/integration/use_string_in_part_of_directives/good_part.dart

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

test_data/integration/use_string_in_part_of_directives/lib.dart

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

0 commit comments

Comments
 (0)