Skip to content

Commit

Permalink
Move avoid_relative_lib_imports tests to reflective (#4104)
Browse files Browse the repository at this point in the history
* Move avoid_relative_lib_imports tests to reflective

* remove-old-data
  • Loading branch information
srawlins authored Mar 3, 2023
1 parent cb5ce14 commit a7ff636
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 70 deletions.
41 changes: 0 additions & 41 deletions test/integration/avoid_relative_lib_imports.dart

This file was deleted.

3 changes: 0 additions & 3 deletions test/integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import 'package:yaml/yaml.dart';
import '../test_data/rules/experiments/experiments.dart';
import 'integration/always_require_non_null_named_parameters.dart'
as always_require_non_null_named_parameters;
import 'integration/avoid_relative_lib_imports.dart'
as avoid_relative_lib_imports;
import 'integration/avoid_web_libraries_in_flutter.dart'
as avoid_web_libraries_in_flutter;
import 'integration/close_sinks.dart' as close_sinks;
Expand Down Expand Up @@ -163,7 +161,6 @@ void ruleTests() {
lines_longer_than_80_chars.main();
always_require_non_null_named_parameters.main();
prefer_const_constructors_in_immutables.main();
avoid_relative_lib_imports.main();
public_member_api_docs.main();
secure_pubspec_urls.main();
sort_pub_dependencies.main();
Expand Down
2 changes: 2 additions & 0 deletions test/rules/all.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import 'avoid_private_typedef_functions_test.dart'
as avoid_private_typedef_functions;
import 'avoid_redundant_argument_values_test.dart'
as avoid_redundant_argument_values;
import 'avoid_relative_lib_imports_test.dart' as avoid_relative_lib_imports;
import 'avoid_renaming_method_parameters_test.dart'
as avoid_renaming_method_parameters;
import 'avoid_returning_this_test.dart' as avoid_returning_this;
Expand Down Expand Up @@ -116,6 +117,7 @@ void main() {
avoid_init_to_null.main();
avoid_private_typedef_functions.main();
avoid_redundant_argument_values.main();
avoid_relative_lib_imports.main();
avoid_renaming_method_parameters.main();
avoid_returning_this.main();
avoid_setters_without_getters.main();
Expand Down
43 changes: 43 additions & 0 deletions test/rules/avoid_relative_lib_imports_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright (c) 2023, 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 '../rule_test_support.dart';

main() {
defineReflectiveSuite(() {
defineReflectiveTests(AvoidRelativeLibImportsTest);
});
}

@reflectiveTest
class AvoidRelativeLibImportsTest extends LintRuleTest {
@override
bool get addJsPackageDep => true;

@override
String get lintRule => 'avoid_relative_lib_imports';

test_externalPackage() async {
await assertNoDiagnostics(r'''
/// This provides [JS].
import 'package:js/js.dart';
''');
}

test_samePackage_relativeUri() async {
newFile('$testPackageLibPath/lib.dart', r'''
class C {}
''');
var test = newFile('$testPackageRootPath/test/test.dart', r'''
/// This provides [C].
import '../lib/lib.dart';
''');
var lib2Result = await resolveFile(test.path);
await assertDiagnosticsIn(lib2Result.errors, [
lint(30, 17),
]);
}
}

This file was deleted.

Empty file.

This file was deleted.

9 changes: 0 additions & 9 deletions test_data/rules/avoid_relative_lib_imports.dart

This file was deleted.

0 comments on commit a7ff636

Please sign in to comment.