linter: move avoid_js_rounded_ints tests

Change-Id: Ie569dba08fa0bf6fc25447b39015be381e79fe7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370461
Auto-Submit: Sam Rawlins <srawlins@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
diff --git a/pkg/linter/test/rules/all.dart b/pkg/linter/test/rules/all.dart
index 49b053e..a924082 100644
--- a/pkg/linter/test/rules/all.dart
+++ b/pkg/linter/test/rules/all.dart
@@ -33,6 +33,7 @@
 import 'avoid_implementing_value_types_test.dart'
     as avoid_implementing_value_types;
 import 'avoid_init_to_null_test.dart' as avoid_init_to_null;
+import 'avoid_js_rounded_ints_test.dart' as avoid_js_rounded_ints;
 import 'avoid_multiple_declarations_per_line_test.dart'
     as avoid_multiple_declarations_per_line;
 import 'avoid_positional_boolean_parameters_test.dart'
@@ -308,6 +309,7 @@
   avoid_function_literals_in_foreach_calls.main();
   avoid_implementing_value_types.main();
   avoid_init_to_null.main();
+  avoid_js_rounded_ints.main();
   avoid_multiple_declarations_per_line.main();
   avoid_positional_boolean_parameters.main();
   avoid_print.main();
diff --git a/pkg/linter/test/rules/avoid_js_rounded_ints_test.dart b/pkg/linter/test/rules/avoid_js_rounded_ints_test.dart
new file mode 100644
index 0000000..4dbc182
--- /dev/null
+++ b/pkg/linter/test/rules/avoid_js_rounded_ints_test.dart
@@ -0,0 +1,81 @@
+// Copyright (c) 2024, 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(AvoidJsRoundedIntsTest);
+  });
+}
+
+@reflectiveTest
+class AvoidJsRoundedIntsTest extends LintRuleTest {
+  @override
+  String get lintRule => 'avoid_js_rounded_ints';
+
+  test_maxSafeInteger() async {
+    await assertNoDiagnostics(r'''
+final r = 9007199254740991;
+''');
+  }
+
+  test_maxSafeInteger_negative() async {
+    await assertNoDiagnostics(r'''
+final r = -9007199254740991;
+''');
+  }
+
+  test_maxSafeInteger_plusTwo() async {
+    await assertDiagnostics(r'''
+final r = 9007199254740993;
+''', [
+      lint(10, 16),
+    ]);
+  }
+
+  test_maxSafeInteger_plusTwo_negative() async {
+    await assertDiagnostics(r'''
+final r = -9007199254740993;
+''', [
+      lint(11, 16),
+    ]);
+  }
+
+  test_smallInt() async {
+    await assertNoDiagnostics(r'''
+final r = 1;
+''');
+  }
+
+  test_smallInt_negative() async {
+    await assertNoDiagnostics(r'''
+final r = -45321;
+''');
+  }
+
+  test_tenToTheEighteen() async {
+    await assertNoDiagnostics(r'''
+final r = 1000000000000000000;
+''');
+  }
+
+  test_tenToTheEighteen_plusOne() async {
+    await assertDiagnostics(r'''
+final r = 1000000000000000001;
+''', [
+      lint(10, 19),
+    ]);
+  }
+
+  test_twoToTheSixtyThree_negative() async {
+    // value.abs() for this number is negative on the 64-bit integer VM.
+    // Lucky it is not rounded! (-2^63)
+    await assertNoDiagnostics(r'''
+final absNegative = -9223372036854775808; // OK
+''');
+  }
+}
diff --git a/pkg/linter/test_data/rules/avoid_js_rounded_ints.dart b/pkg/linter/test_data/rules/avoid_js_rounded_ints.dart
deleted file mode 100644
index dd561b3..0000000
--- a/pkg/linter/test_data/rules/avoid_js_rounded_ints.dart
+++ /dev/null
@@ -1,20 +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.
-
-final i1 = 1; // OK
-final i2 = -45321; // OK
-final i3 = 24361; // OK
-final i4 = 245452; // OK
-final min = -9007199254740991; // OK
-final max = 9007199254740991; // OK
-
-final minErr = -9007199254740993; // LINT
-final maxErr = 9007199254740993; // LINT
-
-final notRounded = 1000000000000000000; // OK
-final rounded = 1000000000000000001; // LINT
-
-// value.abs() for this number is negative on the 64-bit integer VM.
-// Lucky it is not rounded! (-2^63)
-final absNegative = -9223372036854775808; // OK