Move prefer_contains tests (dart-lang/linter#4686)

diff --git a/test/rules/prefer_contains_test.dart b/test/rules/prefer_contains_test.dart
index 0b33edd..a12cb41 100644
--- a/test/rules/prefer_contains_test.dart
+++ b/test/rules/prefer_contains_test.dart
@@ -30,6 +30,386 @@
     ]);
   }
 
+  test_list_indexOf_greaterThan_negativeOne() async {
+    await assertDiagnostics(r'''
+void f(List<int> list) {
+  list.indexOf(1) > -1;
+}
+''', [
+      lint(27, 20),
+    ]);
+  }
+
+  test_list_indexOf_notEqual_negativeOne() async {
+    await assertDiagnostics(r'''
+void f(List<int> list) {
+  list.indexOf(1) != -1;
+}
+''', [
+      lint(27, 21),
+    ]);
+  }
+
+  test_listConcatenation_indexOfWithDifferentArguments() async {
+    await assertNoDiagnostics(r'''
+void f(List<int> list) {
+  list.indexOf(1) + "a".indexOf("ab") > 0;
+}
+''');
+  }
+
+  test_listLiteral_indexOf_equalEqual_negativeOne() async {
+    await assertDiagnostics(r'''
+void f() {
+  [].indexOf(1) == -1;
+}
+''', [
+      lint(13, 19),
+    ]);
+  }
+
+  test_listLiteral_indexOf_equalEqual_negativeTwo() async {
+    await assertDiagnostics(r'''
+void f() {
+  [].indexOf(1) == -2;
+}
+''', [
+      lint(13, 19),
+    ]);
+  }
+
+  test_listLiteral_indexOf_equalEqual_zero() async {
+    await assertNoDiagnostics(r'''
+void f() {
+  [].indexOf(1) == 0;
+}
+''');
+  }
+
+  test_listLiteral_indexOf_greater_negativeTwo() async {
+    await assertDiagnostics(r'''
+void f() {
+  [].indexOf(1) > -2;
+}
+''', [
+      lint(13, 18),
+    ]);
+  }
+
+  test_listLiteral_indexOf_greaterOr_negativeTwo() async {
+    await assertDiagnostics(r'''
+void f() {
+  [].indexOf(1) >= -2;
+}
+''', [
+      lint(13, 19),
+    ]);
+  }
+
+  test_listLiteral_indexOf_greaterOrEqual_negativeOne() async {
+    await assertDiagnostics(r'''
+void f() {
+  [].indexOf(1) >= -1;
+}
+''', [
+      lint(13, 19),
+    ]);
+  }
+
+  test_listLiteral_indexOf_greaterOrEqual_zero() async {
+    await assertDiagnostics(r'''
+void f() {
+  [].indexOf(1) >= 0;
+}
+''', [
+      lint(13, 18),
+    ]);
+  }
+
+  test_listLiteral_indexOf_greaterThan_negativeOne() async {
+    await assertDiagnostics(r'''
+void f() {
+  [].indexOf(1) > -1;
+}
+''', [
+      lint(13, 18),
+    ]);
+  }
+
+  test_listLiteral_indexOf_greaterThan_one() async {
+    await assertNoDiagnostics(r'''
+void f() {
+  [].indexOf(1) > 1;
+}
+''');
+  }
+
+  test_listLiteral_indexOf_greaterThan_zero() async {
+    await assertNoDiagnostics(r'''
+void f() {
+  [].indexOf(1) > 0;
+}
+''');
+  }
+
+  test_listLiteral_indexOf_lessOrEqual_negativeOne() async {
+    await assertDiagnostics(r'''
+void f() {
+  [].indexOf(1) <= -1;
+}
+''', [
+      lint(13, 19),
+    ]);
+  }
+
+  test_listLiteral_indexOf_lessOrEqual_negativeTwo() async {
+    await assertDiagnostics(r'''
+void f() {
+  [].indexOf(1) <= -2;
+}
+''', [
+      lint(13, 19),
+    ]);
+  }
+
+  test_listLiteral_indexOf_lessOrEqual_zero() async {
+    await assertNoDiagnostics(r'''
+void f() {
+  [].indexOf(1) <= 0;
+}
+''');
+  }
+
+  test_listLiteral_indexOf_lessThan_negativeOne() async {
+    await assertDiagnostics(r'''
+void f() {
+  [].indexOf(1) < -1;
+}
+''', [
+      lint(13, 18),
+    ]);
+  }
+
+  test_listLiteral_indexOf_lessThan_negativeOneConst() async {
+    await assertDiagnostics(r'''
+const int MINUS_ONE = -1;
+void f() {
+  [].indexOf(1) < MINUS_ONE;
+}
+''', [
+      lint(39, 25),
+    ]);
+  }
+
+  test_listLiteral_indexOf_lessThan_negativeTwo() async {
+    await assertDiagnostics(r'''
+void f() {
+  [].indexOf(1) < -2;
+}
+''', [
+      lint(13, 18),
+    ]);
+  }
+
+  test_listLiteral_indexOf_lessThan_zero() async {
+    await assertDiagnostics(r'''
+void f() {
+  [].indexOf(1) < 0;
+}
+''', [
+      lint(13, 17),
+    ]);
+  }
+
+  test_listLiteral_indexOf_notEqual_negativeOne() async {
+    await assertDiagnostics(r'''
+void f() {
+  [].indexOf(1) != -1;
+}
+''', [
+      lint(13, 19),
+    ]);
+  }
+
+  test_listLiteral_indexOf_notEqual_negativeTwo() async {
+    await assertDiagnostics(r'''
+void f() {
+  [].indexOf(1) != -2;
+}
+''', [
+      lint(13, 19),
+    ]);
+  }
+
+  test_listLiteral_indexOf_notEqual_zero() async {
+    await assertNoDiagnostics(r'''
+void f() {
+  [].indexOf(1) != 0;
+}
+''');
+  }
+
+  test_listTypedef_indexOf_equalEqual_negativeOne() async {
+    await assertDiagnostics(r'''
+typedef F = List<int>;
+void f(F list) {
+  list.indexOf(1) == -1;
+}
+''', [
+      lint(42, 21),
+    ]);
+  }
+
+  test_negativeOne_equalEqual_listLiteral_indexOf() async {
+    await assertDiagnostics(r'''
+void f() {
+  -1 == [].indexOf(1);
+}
+''', [
+      lint(13, 19),
+    ]);
+  }
+
+  test_negativeOne_greaterOrEqual_listLiteral_indexOf() async {
+    await assertDiagnostics(r'''
+void f() {
+  -1 >= [].indexOf(1);
+}
+''', [
+      lint(13, 19),
+    ]);
+  }
+
+  test_negativeOne_greaterThan_listLiteral_indexOf() async {
+    await assertDiagnostics(r'''
+void f() {
+  -1 > [].indexOf(1);
+}
+''', [
+      lint(13, 18),
+    ]);
+  }
+
+  test_negativeOne_lessOrEqual_listLiteral_indexOf() async {
+    await assertDiagnostics(r'''
+void f() {
+  -1 <= [].indexOf(1);
+}
+''', [
+      lint(13, 19),
+    ]);
+  }
+
+  test_negativeOne_lessThan_list_indexOf() async {
+    await assertDiagnostics(r'''
+void f(List<int> list) {
+  -1 < list.indexOf(1);
+}
+''', [
+      lint(27, 20),
+    ]);
+  }
+
+  test_negativeOne_lessThan_listLiteral_indexOf() async {
+    await assertDiagnostics(r'''
+void f() {
+  -1 < [].indexOf(1);
+}
+''', [
+      lint(13, 18),
+    ]);
+  }
+
+  test_negativeOne_notEqual_listLiteral_indexOf() async {
+    await assertDiagnostics(r'''
+void f() {
+  -1 != [].indexOf(1);
+}
+''', [
+      lint(13, 19),
+    ]);
+  }
+
+  test_negativeOneConst_lessThan_listLiteral_indexOf() async {
+    await assertDiagnostics(r'''
+const int MINUS_ONE = -1;
+void f() {
+  MINUS_ONE < [].indexOf(1);
+}
+''', [
+      lint(39, 25),
+    ]);
+  }
+
+  test_negativeTwo_equalEqual_listLiteral_indexOf() async {
+    await assertDiagnostics(r'''
+void f() {
+  -2 == [].indexOf(1);
+}
+''', [
+      lint(13, 19),
+    ]);
+  }
+
+  test_negativeTwo_greaterOrEqual_listLiteral_indexOf() async {
+    await assertDiagnostics(r'''
+void f() {
+  -2 >= [].indexOf(1);
+}
+''', [
+      lint(13, 19),
+    ]);
+  }
+
+  test_negativeTwo_greaterThan_listLiteral_indexOf() async {
+    await assertDiagnostics(r'''
+void f() {
+  -2 > [].indexOf(1);
+}
+''', [
+      lint(13, 18),
+    ]);
+  }
+
+  test_negativeTwo_lessOrEqual_listLiteral_indexOf() async {
+    await assertDiagnostics(r'''
+void f() {
+  -2 <= [].indexOf(1);
+}
+''', [
+      lint(13, 19),
+    ]);
+  }
+
+  test_negativeTwo_lessThan_listLiteral_indexOf() async {
+    await assertDiagnostics(r'''
+void f() {
+  -2 < [].indexOf(1);
+}
+''', [
+      lint(13, 18),
+    ]);
+  }
+
+  test_negativeTwo_notEqual_listLiteral_indexOf() async {
+    await assertDiagnostics(r'''
+void f() {
+  -2 != [].indexOf(1);
+}
+''', [
+      lint(13, 19),
+    ]);
+  }
+
+  test_promotedToList_indexOf_lessThan_zero() async {
+    await assertDiagnostics(r'''
+bool f<T>(T list) =>
+  list is List<int> && list.indexOf(1) < 0;
+''', [
+      lint(44, 19),
+    ]);
+  }
+
   /// https://github.com/dart-lang/linter/issues/3546
   test_secondArgNonZero() async {
     await assertNoDiagnostics(r'''
@@ -46,6 +426,33 @@
     ]);
   }
 
+  test_stringLiteral_indexOf_equalEqual_negativeOne() async {
+    await assertDiagnostics(r'''
+void f() {
+  'aaa'.indexOf('a') == -1;
+}
+''', [
+      lint(13, 24),
+    ]);
+  }
+
+  test_stringLiteral_indexOf_twoArguments() async {
+    await assertNoDiagnostics(r'''
+void f() {
+  'aaa'.indexOf('a', 2);
+}
+''');
+  }
+
+  test_typeVariableExtendingList_indexOf_lessThan_zero() async {
+    await assertDiagnostics(r'''
+bool f<T extends List<int>>(T list) =>
+  list.indexOf(1) < 0;
+''', [
+      lint(41, 19),
+    ]);
+  }
+
   test_unnecessaryCast() async {
     await assertDiagnostics(r'''
 bool le3 = ([].indexOf(1) as int) > -1;
@@ -54,4 +461,56 @@
       error(WarningCode.UNNECESSARY_CAST, 12, 20),
     ]);
   }
+
+  test_zero_equalEqual_listLiteral_indexOf() async {
+    await assertNoDiagnostics(r'''
+void f() {
+  0 == [].indexOf(1);
+}
+''');
+  }
+
+  test_zero_greaterOrEqual_listLiteral_indexOf() async {
+    await assertNoDiagnostics(r'''
+void f() {
+  0 >= [].indexOf(1);
+}
+''');
+  }
+
+  test_zero_greaterThan_listLiteral_indexOf() async {
+    await assertDiagnostics(r'''
+void f() {
+  0 > [].indexOf(1);
+}
+''', [
+      lint(13, 17),
+    ]);
+  }
+
+  test_zero_lessOrEqual_listLiteral_indexOf() async {
+    await assertDiagnostics(r'''
+void f() {
+  0 <= [].indexOf(1);
+}
+''', [
+      lint(13, 18),
+    ]);
+  }
+
+  test_zero_lessThan_listLiteral_indexOf() async {
+    await assertNoDiagnostics(r'''
+void f() {
+  0 < [].indexOf(1);
+}
+''');
+  }
+
+  test_zero_notEqual_listLiteral_indexOf() async {
+    await assertNoDiagnostics(r'''
+void f() {
+  0 != [].indexOf(1);
+}
+''');
+  }
 }
diff --git a/test_data/rules/prefer_contains.dart b/test_data/rules/prefer_contains.dart
deleted file mode 100644
index b79da88..0000000
--- a/test_data/rules/prefer_contains.dart
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright (c) 2016, 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_contains`
-
-const int MINUS_ONE = -1;
-
-List<int> list = [];
-
-List get getter => [];
-
-typedef List F();
-
-F a() {
-  return () => [];
-}
-
-bool le = list.indexOf(1) > -1; //LINT
-
-bool le2 = [].indexOf(1) > -1; //LINT
-
-bool le4 = -1 < list.indexOf(1); //LINT
-
-bool le5 = [].indexOf(1) < MINUS_ONE; //LINT
-
-bool le6 = MINUS_ONE < [].indexOf(1); //LINT
-
-bool ge = getter.indexOf(1) != -1; //LINT
-
-bool ce = a()().indexOf(1) == -1; //LINT
-
-bool se = "aaa".indexOf('a') == -1; //LINT
-
-int ser = "aaa".indexOf('a', 2); //OK
-
-bool mixed = list.indexOf(1) + "a".indexOf("ab") > 0; //OK
-
-bool le7 = [].indexOf(1) > 1; //OK
-
-testOperators() {
-  [].indexOf(1) == -1; // LINT
-  [].indexOf(1) != -1; // LINT
-  [].indexOf(1) > -1; // LINT
-  [].indexOf(1) >= -1; // LINT
-  [].indexOf(1) < -1; // LINT
-  [].indexOf(1) <= -1; // LINT
-
-  [].indexOf(1) == -2; // LINT
-  [].indexOf(1) != -2; // LINT
-  [].indexOf(1) > -2; // LINT
-  [].indexOf(1) >= -2; // LINT
-  [].indexOf(1) < -2; // LINT
-  [].indexOf(1) <= -2; // LINT
-
-  [].indexOf(1) == 0; // OK
-  [].indexOf(1) != 0; // OK
-  [].indexOf(1) > 0; // OK
-  [].indexOf(1) >= 0; // LINT
-  [].indexOf(1) < 0; // LINT
-  [].indexOf(1) <= 0; // OK
-
-  -1 == [].indexOf(1); // LINT
-  -1 != [].indexOf(1); // LINT
-  -1 < [].indexOf(1); // LINT
-  -1 <= [].indexOf(1); // LINT
-  -1 > [].indexOf(1); // LINT
-  -1 >= [].indexOf(1); // LINT
-
-  -2 == [].indexOf(1); // LINT
-  -2 != [].indexOf(1); // LINT
-  -2 < [].indexOf(1); // LINT
-  -2 <= [].indexOf(1); // LINT
-  -2 > [].indexOf(1); // LINT
-  -2 >= [].indexOf(1); // LINT
-
-  0 == [].indexOf(1); // OK
-  0 != [].indexOf(1); // OK
-  0 < [].indexOf(1); // OK
-  0 <= [].indexOf(1); // LINT
-  0 > [].indexOf(1); // LINT
-  0 >= [].indexOf(1); // OK
-}
-
-bool f<T extends List<int>>(T list) =>
-  list.indexOf(1) < 0; // LINT
-
-bool g<T>(T list) =>
-  list is List<int> && list.indexOf(1) < 0; // LINT