@@ -17,6 +17,113 @@ class PreferVoidToNullTest extends LintRuleTest {
17
17
@override
18
18
String get lintRule => 'prefer_void_to_null' ;
19
19
20
+ @FailingTest (
21
+ issue: 'https://github.com/dart-lang/linter/issues/4890' ,
22
+ reason: 'Null check operator used on a null value' )
23
+ test_augmentedField () async {
24
+ newFile ('$testPackageLibPath /a.dart' , r'''
25
+ import augment 'test.dart';
26
+
27
+ class A {
28
+ Future<Null>? f;
29
+ }
30
+ ''' );
31
+
32
+ await assertNoDiagnostics (r'''
33
+ library augment 'a.dart';
34
+
35
+ augment class A {
36
+ augment Future<Null>? f;
37
+ }
38
+ ''' );
39
+ }
40
+
41
+ test_augmentedFunction () async {
42
+ newFile ('$testPackageLibPath /a.dart' , r'''
43
+ import augment 'test.dart';
44
+
45
+ Future<Null>? f() => null;
46
+ ''' );
47
+
48
+ await assertNoDiagnostics (r'''
49
+ library augment 'a.dart';
50
+
51
+ augment Future<Null>? f() => null;
52
+ ''' );
53
+ }
54
+
55
+ test_augmentedGetter () async {
56
+ newFile ('$testPackageLibPath /a.dart' , r'''
57
+ import augment 'test.dart';
58
+
59
+ class A {
60
+ Future<Null>? get v => null;
61
+ }
62
+ ''' );
63
+
64
+ await assertNoDiagnostics (r'''
65
+ library augment 'a.dart';
66
+
67
+ augment class A {
68
+ augment Future<Null>? get v => null;
69
+ }
70
+ ''' );
71
+ }
72
+
73
+ test_augmentedMethod () async {
74
+ newFile ('$testPackageLibPath /a.dart' , r'''
75
+ import augment 'test.dart';
76
+
77
+ class A {
78
+ Future<Null>? f() => null;
79
+ }
80
+ ''' );
81
+
82
+ await assertNoDiagnostics (r'''
83
+ library augment 'a.dart';
84
+
85
+ augment class A {
86
+ augment Future<Null>? f() => null;
87
+ }
88
+ ''' );
89
+ }
90
+
91
+ @FailingTest (
92
+ issue: 'https://github.com/dart-lang/linter/issues/4890' ,
93
+ reason:
94
+ "CompileTimeErrorCode.DUPLICATE_DEFINITION [55, 1, The name 'v' is already defined.]" )
95
+ test_augmentedTopLevelGetter () async {
96
+ newFile ('$testPackageLibPath /a.dart' , r'''
97
+ import augment 'test.dart';
98
+
99
+ Future<Null>? get v => null;
100
+ ''' );
101
+
102
+ await assertNoDiagnostics (r'''
103
+ library augment 'a.dart';
104
+
105
+ augment Future<Null>? get v => null;
106
+ ''' );
107
+ }
108
+
109
+ @FailingTest (
110
+ issue: 'https://github.com/dart-lang/linter/issues/4890' ,
111
+ reason:
112
+ "CompileTimeErrorCode.DUPLICATE_DEFINITION [49, 1, The name 'v' is already defined.]" )
113
+ test_augmentedTopLevelVariable () async {
114
+ newFile ('$testPackageLibPath /a.dart' , r'''
115
+ import augment 'test.dart';
116
+
117
+ Future<Null>? v;
118
+ ''' );
119
+
120
+ await assertNoDiagnostics (r'''
121
+ library augment 'a.dart';
122
+
123
+ augment Future<Null>? v;
124
+ ''' );
125
+ }
126
+
20
127
/// https://github.com/dart-lang/linter/issues/4201
21
128
test_castAsExpression () async {
22
129
await assertNoDiagnostics (r'''
0 commit comments