This repository was archived by the owner on Nov 20, 2024. It is now read-only.
File tree 2 files changed +52
-0
lines changed 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ import 'tighten_type_of_initializing_formals.dart'
45
45
import 'type_init_formals.dart' as type_init_formals;
46
46
import 'unawaited_futures.dart' as unawaited_futures;
47
47
import 'unnecessary_null_checks.dart' as unnecessary_null_checks;
48
+ import 'unnecessary_overrides.dart' as unnecessary_overrides;
48
49
import 'use_is_even_rather_than_modulo.dart' as use_is_even_rather_than_modulo;
49
50
import 'void_checks.dart' as void_checks;
50
51
@@ -80,6 +81,7 @@ void main() {
80
81
type_init_formals.main ();
81
82
unawaited_futures.main ();
82
83
unnecessary_null_checks.main ();
84
+ unnecessary_overrides.main ();
83
85
use_is_even_rather_than_modulo.main ();
84
86
void_checks.main ();
85
87
}
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2022, 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 (UnnecessaryOverridesTest );
12
+ });
13
+ }
14
+
15
+ @reflectiveTest
16
+ class UnnecessaryOverridesTest extends LintRuleTest {
17
+ @override
18
+ List <String > get experiments => [
19
+ EnableString .enhanced_enums,
20
+ ];
21
+
22
+ @override
23
+ String get lintRule => 'unnecessary_overrides' ;
24
+
25
+ @FailingTest (issue: 'https://github.com/dart-lang/linter/issues/3097' )
26
+ test_field () async {
27
+ await assertDiagnostics (r'''
28
+ enum A {
29
+ a,b,c;
30
+ @override
31
+ int get foo => 0;
32
+ }
33
+ ''' , [
34
+ lint ('unnecessary_overrides' , 28 , 8 ),
35
+ ]);
36
+ }
37
+
38
+ @FailingTest (issue: 'https://github.com/dart-lang/linter/issues/3097' )
39
+ test_method () async {
40
+ await assertDiagnostics (r'''
41
+ enum A {
42
+ a,b,c;
43
+ @override
44
+ String bar() => '';
45
+ }
46
+ ''' , [
47
+ lint ('unnecessary_overrides' , 27 , 8 ),
48
+ ]);
49
+ }
50
+ }
You can’t perform that action at this time.
0 commit comments