@@ -15,6 +15,7 @@ import 'package:dwds/src/services/chrome_proxy_service.dart';
15
15
import 'package:dwds/src/utilities/dart_uri.dart' ;
16
16
import 'package:http/http.dart' as http;
17
17
import 'package:path/path.dart' as path;
18
+ import 'package:pub_semver/pub_semver.dart' as semver;
18
19
import 'package:test/test.dart' ;
19
20
import 'package:vm_service/vm_service.dart' ;
20
21
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart' ;
@@ -445,38 +446,55 @@ void main() {
445
446
expect (library1, equals (library2));
446
447
});
447
448
448
- test ('Classes' , () async {
449
- var testClass = await service.getObject (
450
- isolate.id, rootLibrary.classes.first.id) as Class ;
451
- expect (
452
- testClass.functions,
453
- unorderedEquals ([
454
- predicate ((FuncRef f) => f.name == 'message' && ! f.isStatic),
455
- predicate ((FuncRef f) => f.name == 'notFinal' && ! f.isStatic),
456
- predicate ((FuncRef f) => f.name == 'hello' && ! f.isStatic),
457
- predicate ((FuncRef f) => f.name == '_equals' && ! f.isStatic),
458
- predicate ((FuncRef f) => f.name == 'hashCode' && ! f.isStatic),
459
- predicate ((FuncRef f) => f.name == 'toString' && ! f.isStatic),
460
- predicate ((FuncRef f) => f.name == 'noSuchMethod' && ! f.isStatic),
461
- predicate ((FuncRef f) => f.name == 'runtimeType' && ! f.isStatic),
462
- ]));
463
- expect (
464
- testClass.fields,
465
- unorderedEquals ([
466
- predicate ((FieldRef f) =>
467
- f.name == 'message' &&
468
- f.declaredType != null &&
469
- ! f.isStatic &&
470
- ! f.isConst &&
471
- f.isFinal),
472
- predicate ((FieldRef f) =>
473
- f.name == 'notFinal' &&
474
- f.declaredType != null &&
475
- ! f.isStatic &&
476
- ! f.isConst &&
477
- ! f.isFinal),
478
- ]));
479
- });
449
+ test (
450
+ 'Classes' ,
451
+ () async {
452
+ var testClass = await service.getObject (
453
+ isolate.id, rootLibrary.classes.first.id) as Class ;
454
+ expect (
455
+ testClass.functions,
456
+ unorderedEquals ([
457
+ predicate ((FuncRef f) => f.name == 'staticHello' && f.isStatic),
458
+ predicate ((FuncRef f) => f.name == 'message' && ! f.isStatic),
459
+ predicate ((FuncRef f) => f.name == 'notFinal' && ! f.isStatic),
460
+ predicate ((FuncRef f) => f.name == 'hello' && ! f.isStatic),
461
+ predicate ((FuncRef f) => f.name == '_equals' && ! f.isStatic),
462
+ predicate ((FuncRef f) => f.name == 'hashCode' && ! f.isStatic),
463
+ predicate ((FuncRef f) => f.name == 'toString' && ! f.isStatic),
464
+ predicate (
465
+ (FuncRef f) => f.name == 'noSuchMethod' && ! f.isStatic),
466
+ predicate (
467
+ (FuncRef f) => f.name == 'runtimeType' && ! f.isStatic),
468
+ ]));
469
+ expect (
470
+ testClass.fields,
471
+ unorderedEquals ([
472
+ predicate ((FieldRef f) =>
473
+ f.name == 'message' &&
474
+ f.declaredType != null &&
475
+ ! f.isStatic &&
476
+ ! f.isConst &&
477
+ f.isFinal),
478
+ predicate ((FieldRef f) =>
479
+ f.name == 'notFinal' &&
480
+ f.declaredType != null &&
481
+ ! f.isStatic &&
482
+ ! f.isConst &&
483
+ ! f.isFinal),
484
+ predicate ((FieldRef f) =>
485
+ f.name == 'staticMessage' &&
486
+ f.declaredType != null &&
487
+ f.isStatic &&
488
+ ! f.isConst &&
489
+ ! f.isFinal),
490
+ ]));
491
+ },
492
+ // TODO(elliette): Remove once 2.15.0 is the stable release.
493
+ skip: semver.Version .parse (Platform .version.split (' ' ).first) >=
494
+ semver.Version .parse ('2.15.0-268.18.beta' )
495
+ ? null
496
+ : 'SDK does not expose static member information.' ,
497
+ );
480
498
481
499
test ('Runtime classes' , () async {
482
500
var testClass = await service.getObject (
@@ -701,44 +719,60 @@ void main() {
701
719
expect (world.offset, 3 );
702
720
});
703
721
704
- test ('offset/count parameters are ignored for Classes' , () async {
705
- var testClass = await service.getObject (
706
- isolate.id,
707
- rootLibrary.classes.first.id,
708
- offset: 100 ,
709
- count: 100 ,
710
- ) as Class ;
711
- expect (
712
- testClass.functions,
713
- unorderedEquals ([
714
- predicate ((FuncRef f) => f.name == 'message' && ! f.isStatic),
715
- predicate ((FuncRef f) => f.name == 'notFinal' && ! f.isStatic),
716
- predicate ((FuncRef f) => f.name == 'hello' && ! f.isStatic),
717
- predicate ((FuncRef f) => f.name == '_equals' && ! f.isStatic),
718
- predicate ((FuncRef f) => f.name == 'hashCode' && ! f.isStatic),
719
- predicate ((FuncRef f) => f.name == 'toString' && ! f.isStatic),
720
- predicate (
721
- (FuncRef f) => f.name == 'noSuchMethod' && ! f.isStatic),
722
- predicate (
723
- (FuncRef f) => f.name == 'runtimeType' && ! f.isStatic),
724
- ]));
725
- expect (
726
- testClass.fields,
727
- unorderedEquals ([
728
- predicate ((FieldRef f) =>
729
- f.name == 'message' &&
730
- f.declaredType != null &&
731
- ! f.isStatic &&
732
- ! f.isConst &&
733
- f.isFinal),
734
- predicate ((FieldRef f) =>
735
- f.name == 'notFinal' &&
736
- f.declaredType != null &&
737
- ! f.isStatic &&
738
- ! f.isConst &&
739
- ! f.isFinal),
740
- ]));
741
- });
722
+ test (
723
+ 'offset/count parameters are ignored for Classes' ,
724
+ () async {
725
+ var testClass = await service.getObject (
726
+ isolate.id,
727
+ rootLibrary.classes.first.id,
728
+ offset: 100 ,
729
+ count: 100 ,
730
+ ) as Class ;
731
+ expect (
732
+ testClass.functions,
733
+ unorderedEquals ([
734
+ predicate (
735
+ (FuncRef f) => f.name == 'staticHello' && f.isStatic),
736
+ predicate ((FuncRef f) => f.name == 'message' && ! f.isStatic),
737
+ predicate ((FuncRef f) => f.name == 'notFinal' && ! f.isStatic),
738
+ predicate ((FuncRef f) => f.name == 'hello' && ! f.isStatic),
739
+ predicate ((FuncRef f) => f.name == '_equals' && ! f.isStatic),
740
+ predicate ((FuncRef f) => f.name == 'hashCode' && ! f.isStatic),
741
+ predicate ((FuncRef f) => f.name == 'toString' && ! f.isStatic),
742
+ predicate (
743
+ (FuncRef f) => f.name == 'noSuchMethod' && ! f.isStatic),
744
+ predicate (
745
+ (FuncRef f) => f.name == 'runtimeType' && ! f.isStatic),
746
+ ]));
747
+ expect (
748
+ testClass.fields,
749
+ unorderedEquals ([
750
+ predicate ((FieldRef f) =>
751
+ f.name == 'message' &&
752
+ f.declaredType != null &&
753
+ ! f.isStatic &&
754
+ ! f.isConst &&
755
+ f.isFinal),
756
+ predicate ((FieldRef f) =>
757
+ f.name == 'notFinal' &&
758
+ f.declaredType != null &&
759
+ ! f.isStatic &&
760
+ ! f.isConst &&
761
+ ! f.isFinal),
762
+ predicate ((FieldRef f) =>
763
+ f.name == 'staticMessage' &&
764
+ f.declaredType != null &&
765
+ f.isStatic &&
766
+ ! f.isConst &&
767
+ ! f.isFinal),
768
+ ]));
769
+ },
770
+ // TODO(elliette): Remove once 2.15.0 is the stable release.
771
+ skip: semver.Version .parse (Platform .version.split (' ' ).first) >=
772
+ semver.Version .parse ('2.15.0-268.18.beta' )
773
+ ? null
774
+ : 'SDK does not expose static member information.' ,
775
+ );
742
776
743
777
test ('offset/count parameters are ignored for bools' , () async {
744
778
var ref = await service.evaluate (
0 commit comments