Move prefer_iterable_whereType tests (dart-lang/linter#4667)

diff --git a/test/rules/all.dart b/test/rules/all.dart
index a7e7547..0f1637a 100644
--- a/test/rules/all.dart
+++ b/test/rules/all.dart
@@ -124,6 +124,8 @@
 import 'prefer_inlined_adds_test.dart' as prefer_inlined_adds;
 import 'prefer_interpolation_to_compose_strings_test.dart'
     as prefer_interpolation_to_compose_strings;
+// ignore: library_prefixes
+import 'prefer_iterable_whereType_test.dart' as prefer_iterable_whereType;
 import 'prefer_mixin_test.dart' as prefer_mixin;
 import 'prefer_null_aware_method_calls_test.dart'
     as prefer_null_aware_method_calls;
@@ -301,6 +303,7 @@
   prefer_if_elements_to_conditional_expressions.main();
   prefer_inlined_adds.main();
   prefer_interpolation_to_compose_strings.main();
+  prefer_iterable_whereType.main();
   prefer_mixin.main();
   prefer_null_aware_method_calls.main();
   prefer_null_aware_operators.main();
diff --git a/test/rules/prefer_iterable_whereType_test.dart b/test/rules/prefer_iterable_whereType_test.dart
new file mode 100644
index 0000000..fb391e1
--- /dev/null
+++ b/test/rules/prefer_iterable_whereType_test.dart
@@ -0,0 +1,138 @@
+// 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';
+
+// ignore_for_file: file_names
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(PreferIterableWhereTypeTest);
+  });
+}
+
+@reflectiveTest
+class PreferIterableWhereTypeTest extends LintRuleTest {
+  @override
+  String get lintRule => 'prefer_iterable_whereType';
+
+  test_closureWithIs() async {
+    await assertDiagnostics(r'''
+var x = [42].where((e) => e is String);
+''', [
+      lint(13, 5),
+    ]);
+  }
+
+  test_closureWithIs_blockBodySingleStatement() async {
+    await assertDiagnostics(r'''
+var x = [42].where(
+  (e) {
+    return e is String;
+});
+''', [
+      lint(13, 5),
+    ]);
+  }
+
+  test_closureWithIs_multipleStatements() async {
+    await assertNoDiagnostics(r'''
+var x = [42].where((e) {
+  print('');
+  return e is String;
+});
+''');
+  }
+
+  test_closureWithIs_parenthesized() async {
+    await assertDiagnostics(r'''
+var x = [42].where((e) => (e is String));
+''', [
+      lint(13, 5),
+    ]);
+  }
+
+  test_closureWithIs_wrongSimpleTarget() async {
+    await assertNoDiagnostics(r'''
+var l = [42];
+var x = l.where((e) => l is String);
+''');
+  }
+
+  test_closureWithIs_wrongTarget() async {
+    await assertNoDiagnostics(r'''
+var x = [42].where((e) => e.isEven is String);
+''');
+  }
+
+  test_closureWithIsNot() async {
+    await assertNoDiagnostics(r'''
+var x = [42, 42.5].where((e) => e is! int);
+''');
+  }
+
+  test_functionReference() async {
+    await assertNoDiagnostics(r'''
+bool p(Object e) => false;
+var x = [42].where(p);
+''');
+  }
+
+  test_nonIterable_whereMethod_closure_explicitTarget() async {
+    await assertNoDiagnostics(r'''
+class A {
+  void where(bool Function(Object) g) {}
+}
+
+void f(A a) {
+  a.where((e) => e is String);
+}
+''');
+  }
+
+  test_nonIterable_whereMethod_closure_implicitTarget() async {
+    await assertNoDiagnostics(r'''
+class A {
+  void where(bool Function(Object) f) {}
+
+  void m(A a) {
+    a.where((e) => e is String);
+  }
+}
+
+''');
+  }
+
+  test_nonIterable_whereMethod_explicitTarget() async {
+    await assertNoDiagnostics(r'''
+class A {
+  bool where() => true;
+}
+
+void f(A a) {
+  a.where();
+}
+''');
+  }
+
+  test_nonIterable_whereMethod_implicitTarget() async {
+    await assertNoDiagnostics(r'''
+class A {
+  bool where() => true;
+
+  void m() {
+    where();
+  }
+}
+''');
+  }
+
+  test_whereType() async {
+    await assertNoDiagnostics(r'''
+var x = [42].whereType<String>();
+''');
+  }
+}
diff --git a/test_data/rules/prefer_iterable_whereType.dart b/test_data/rules/prefer_iterable_whereType.dart
deleted file mode 100644
index f93d448..0000000
--- a/test_data/rules/prefer_iterable_whereType.dart
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) 2018, 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.
-
-// test w/ `dart test -N prefer_iterable_whereType`
-
-var foo = [42].where((num) => num is! int); // OK
-
-main() {
-  var l = [];
-  l.where((e) => e is String); // LINT
-  l.where(// LINT
-      (e) {
-    return e is String;
-  });
-  l.where((e) => (e is String)); // LINT
-  l.where((e) => e.f is String); // OK
-  l.where((e) => l is String); // OK
-  l.where(p); // OK
-  l.where(// OK
-      (e) {
-    print('');
-    return e is String;
-  });
-  l.whereType<String>(); // OK
-  []..add(0)..where((e) => true); // OK
-}
-
-bool p(e) => e is String;
-
-class A {
-  bool where() => true;
-
-  m() {
-    final o = new A();
-    o.where(); // OK
-    where(); // OK
-  }
-}
-class B {
-  bool where(bool Function(Object e) f) => false;
-
-  m() {
-    final o = new B();
-    o.where((e) => false); // OK
-    where((e) => false); // OK
-  }
-}