@@ -30,42 +30,43 @@ void main() {
30
30
exit (1 );
31
31
}
32
32
33
- // This doesn't have the `max` because NNBD is supposed to work after this
34
- // version, and if the `max` is placed here we'll silently pass 2.10 stable
35
- // if we haven't figured out how to switch on NNBD outside of `dev` builds
36
- // as specified in #2148.
37
- final _nnbdExperimentAllowed =
33
+ // This doesn't have the `max` because Null safety is supposed to work after
34
+ // this version, and if the `max` is placed here we'll silently pass 2.10
35
+ // stable if we haven't figured out how to switch on Null safety outside of
36
+ // dev builds as specified in #2148.
37
+ final _nullSafetyExperimentAllowed =
38
38
VersionRange (min: Version .parse ('2.9.0-9.0.dev' ), includeMin: true );
39
39
40
- // Experimental features not yet enabled by default. Move tests out of this block
41
- // when the feature is enabled by default.
40
+ // Experimental features not yet enabled by default. Move tests out of this
41
+ // block when the feature is enabled by default.
42
42
group ('Experiments' , () {
43
43
Library lateFinalWithoutInitializer,
44
- nnbdClassMemberDeclarations ,
45
- optOutOfNnbd ,
44
+ nullSafetyClassMemberDeclarations ,
45
+ optOutOfNullSafety ,
46
46
nullableElements;
47
47
Class b;
48
48
49
49
setUpAll (() async {
50
50
lateFinalWithoutInitializer = (await utils.testPackageGraphExperiments)
51
51
.libraries
52
52
.firstWhere ((lib) => lib.name == 'late_final_without_initializer' );
53
- nnbdClassMemberDeclarations = (await utils.testPackageGraphExperiments)
53
+ nullSafetyClassMemberDeclarations = (await utils
54
+ .testPackageGraphExperiments)
54
55
.libraries
55
56
.firstWhere ((lib) => lib.name == 'nnbd_class_member_declarations' );
56
- optOutOfNnbd = (await utils.testPackageGraphExperiments)
57
+ optOutOfNullSafety = (await utils.testPackageGraphExperiments)
57
58
.libraries
58
59
.firstWhere ((lib) => lib.name == 'opt_out_of_nnbd' );
59
60
nullableElements = (await utils.testPackageGraphExperiments)
60
61
.libraries
61
62
.firstWhere ((lib) => lib.name == 'nullable_elements' );
62
- b = nnbdClassMemberDeclarations .allClasses
63
+ b = nullSafetyClassMemberDeclarations .allClasses
63
64
.firstWhere ((c) => c.name == 'B' );
64
65
});
65
66
66
- test ('isNNBD is set correctly for libraries' , () {
67
- expect (lateFinalWithoutInitializer.isNNBD , isTrue);
68
- expect (optOutOfNnbd.isNNBD , isFalse);
67
+ test ('isNullSafety is set correctly for libraries' , () {
68
+ expect (lateFinalWithoutInitializer.isNullSafety , isTrue);
69
+ expect (optOutOfNullSafety.isNullSafety , isFalse);
69
70
});
70
71
71
72
test ('method parameters with required' , () {
@@ -118,8 +119,8 @@ void main() {
118
119
var cField = c.instanceFields.firstWhere ((f) => f.name == 'cField' );
119
120
var dField = c.instanceFields.firstWhere ((f) => f.name == 'dField' );
120
121
121
- // If nnbd isn't enabled, fields named 'late' come back from the analyzer
122
- // instead of setting up 'isLate'.
122
+ // If Null safety isn't enabled, fields named 'late' come back from the
123
+ // analyzer instead of setting up 'isLate'.
123
124
expect (c.instanceFields.any ((f) => f.name == 'late' ), isFalse);
124
125
125
126
expect (a.modelType.returnType.name, equals ('dynamic' ));
@@ -147,10 +148,10 @@ void main() {
147
148
expect (initializeMe.features, contains ('late' ));
148
149
});
149
150
150
- test ('Opt out of NNBD ' , () {
151
- var notOptedIn = optOutOfNnbd .publicProperties
151
+ test ('Opt out of Null safety ' , () {
152
+ var notOptedIn = optOutOfNullSafety .publicProperties
152
153
.firstWhere ((v) => v.name == 'notOptedIn' );
153
- expect (notOptedIn.isNNBD , isFalse);
154
+ expect (notOptedIn.isNullSafety , isFalse);
154
155
expect (notOptedIn.modelType.nullabilitySuffix, isEmpty);
155
156
});
156
157
@@ -161,7 +162,7 @@ void main() {
161
162
.firstWhere ((f) => f.name == 'aComplexType' );
162
163
var aComplexSetterOnlyType = complexNullableMembers.allFields
163
164
.firstWhere ((f) => f.name == 'aComplexSetterOnlyType' );
164
- expect (complexNullableMembers.isNNBD , isTrue);
165
+ expect (complexNullableMembers.isNullSafety , isTrue);
165
166
expect (
166
167
complexNullableMembers.nameWithGenerics,
167
168
equals (
@@ -186,7 +187,7 @@ void main() {
186
187
.firstWhere ((f) => f.name == 'methodWithNullables' );
187
188
var operatorStar = nullableMembers.publicInstanceOperators
188
189
.firstWhere ((f) => f.name == 'operator *' );
189
- expect (nullableMembers.isNNBD , isTrue);
190
+ expect (nullableMembers.isNullSafety , isTrue);
190
191
expect (
191
192
nullableField.linkedReturnType,
192
193
equals (
@@ -206,7 +207,7 @@ void main() {
206
207
'<span class="parameter" id="*-param-nullableOther"><span class="type-annotation"><a href="%%__HTMLBASE_dartdoc_internal__%%nullable_elements/NullableMembers-class.html">NullableMembers</a>?</span> <span class="parameter-name">nullableOther</span></span><wbr>' ));
207
208
});
208
209
},
209
- skip: (! _nnbdExperimentAllowed .allows (_platformVersion) &&
210
+ skip: (! _nullSafetyExperimentAllowed .allows (_platformVersion) &&
210
211
! _platformVersionString.contains ('edge' )));
211
212
212
213
group ('HTML Injection when allowed' , () {
0 commit comments