@@ -53,6 +53,7 @@ void main() {
53
53
PackageGraph packageGraph;
54
54
PackageGraph packageGraphSmall;
55
55
PackageGraph packageGraphErrors;
56
+ PackageGraph packageGraphExperiments;
56
57
PackageGraph ginormousPackageGraph;
57
58
Library exLibrary;
58
59
Library fakeLibrary;
@@ -67,6 +68,7 @@ void main() {
67
68
packageGraph = utils.testPackageGraph;
68
69
packageGraphSmall = utils.testPackageGraphSmall;
69
70
packageGraphErrors = utils.testPackageGraphErrors;
71
+ packageGraphExperiments = utils.testPackageGraphExperiments;
70
72
ginormousPackageGraph = utils.testPackageGraphGinormous;
71
73
exLibrary = packageGraph.libraries.firstWhere ((lib) => lib.name == 'ex' );
72
74
errorLibrary = packageGraphErrors.libraries
@@ -82,6 +84,40 @@ void main() {
82
84
sdkAsPackageGraph = utils.testPackageGraphSdk;
83
85
});
84
86
87
+ // Experimental features not yet enabled by default. Move tests out of this block
88
+ // when the feature is enabled by default.
89
+ group ('Experiments' , () {
90
+ Library main;
91
+ TopLevelVariable aComplexSet, inferredTypeSet, specifiedSet, untypedMap, typedSet;
92
+
93
+ setUpAll (() {
94
+ main = packageGraphExperiments.libraries.firstWhere ((lib) => lib.name == 'main' );
95
+ aComplexSet = main.constants.firstWhere ((v) => v.name == 'aComplexSet' );
96
+ inferredTypeSet = main.constants.firstWhere ((v) => v.name == 'inferredTypeSet' );
97
+ specifiedSet = main.constants.firstWhere ((v) => v.name == 'specifiedSet' );
98
+ untypedMap = main.constants.firstWhere ((v) => v.name == 'untypedMap' );
99
+ typedSet = main.constants.firstWhere ((v) => v.name == 'typedSet' );
100
+ });
101
+
102
+ test ('Set literals test' , () {
103
+ expect (aComplexSet.modelType.name, equals ('Set' ));
104
+ expect (aComplexSet.modelType.typeArguments.map ((a) => a.name).toList (), equals (['AClassContainingLiterals' ]));
105
+ expect (aComplexSet.constantValue, equals ('const {const AClassContainingLiterals(3, 5)}' ));
106
+ expect (inferredTypeSet.modelType.name, equals ('Set' ));
107
+ expect (inferredTypeSet.modelType.typeArguments.map ((a) => a.name).toList (), equals (['num' ]));
108
+ expect (inferredTypeSet.constantValue, equals ('const {1, 2.5, 3}' ));
109
+ expect (specifiedSet.modelType.name, equals ('Set' ));
110
+ expect (specifiedSet.modelType.typeArguments.map ((a) => a.name).toList (), equals (['int' ]));
111
+ expect (specifiedSet.constantValue, equals ('const {}' ));
112
+ expect (untypedMap.modelType.name, equals ('Map' ));
113
+ expect (untypedMap.modelType.typeArguments.map ((a) => a.name).toList (), equals (['dynamic' , 'dynamic' ]));
114
+ expect (untypedMap.constantValue, equals ('const {}' ));
115
+ expect (typedSet.modelType.name, equals ('Set' ));
116
+ expect (typedSet.modelType.typeArguments.map ((a) => a.name).toList (), equals (['String' ]));
117
+ expect (typedSet.constantValue, equals ('const <String> {}' ));
118
+ });
119
+ });
120
+
85
121
group ('Tools' , () {
86
122
Class toolUser;
87
123
Class _NonCanonicalToolUser , CanonicalToolUser , PrivateLibraryToolUser ;
0 commit comments