@@ -194,6 +194,7 @@ void main() {
194
194
@MapLike()
195
195
@VisibleClass.secret()
196
196
@fieldOnly
197
+ @ClassWithStaticField.staticField
197
198
class Example {}
198
199
199
200
class Int64Like {
@@ -230,8 +231,13 @@ void main() {
230
231
class _FieldOnlyVisible {
231
232
const _FieldOnlyVisible();
232
233
}
233
-
234
+
234
235
const fieldOnly = const _FieldOnlyVisible();
236
+
237
+ class ClassWithStaticField {
238
+ static const staticField = const ClassWithStaticField._();
239
+ const ClassWithStaticField._();
240
+ }
235
241
''' , (resolver) => resolver.findLibraryByName ('test_lib' ));
236
242
constants = library
237
243
.getType ('Example' )
@@ -242,8 +248,8 @@ void main() {
242
248
243
249
test ('should decode Int64Like.ZERO' , () {
244
250
final int64Like0 = constants[0 ].revive ();
245
- expect (int64Like0.source.toString (), endsWith ( '#Int64Like' ) );
246
- expect (int64Like0.accessor, 'ZERO' );
251
+ expect (int64Like0.source.fragment, isEmpty );
252
+ expect (int64Like0.accessor, 'Int64Like. ZERO' );
247
253
});
248
254
249
255
test ('should decode Duration' , () {
@@ -260,8 +266,8 @@ void main() {
260
266
261
267
test ('should decode enums' , () {
262
268
final enumField1 = constants[2 ].revive ();
263
- expect (enumField1.source.toString (), endsWith ( '#Enum' ) );
264
- expect (enumField1.accessor, 'field1' );
269
+ expect (enumField1.source.fragment, isEmpty );
270
+ expect (enumField1.accessor, 'Enum. field1' );
265
271
});
266
272
267
273
test ('should decode forwarding factories' , () {
@@ -281,5 +287,11 @@ void main() {
281
287
expect (fieldOnly.source.fragment, isEmpty);
282
288
expect (fieldOnly.accessor, 'fieldOnly' );
283
289
});
290
+
291
+ test ('should decode static fields' , () {
292
+ final fieldOnly = constants[6 ].revive ();
293
+ expect (fieldOnly.source.fragment, isEmpty);
294
+ expect (fieldOnly.accessor, 'ClassWithStaticField.staticField' );
295
+ });
284
296
});
285
297
}
0 commit comments