@@ -53,6 +53,7 @@ void main() {
5353 PackageGraph packageGraph;
5454 PackageGraph packageGraphSmall;
5555 PackageGraph packageGraphErrors;
56+ PackageGraph packageGraphExperiments;
5657 PackageGraph ginormousPackageGraph;
5758 Library exLibrary;
5859 Library fakeLibrary;
@@ -67,6 +68,7 @@ void main() {
6768 packageGraph = utils.testPackageGraph;
6869 packageGraphSmall = utils.testPackageGraphSmall;
6970 packageGraphErrors = utils.testPackageGraphErrors;
71+ packageGraphExperiments = utils.testPackageGraphExperiments;
7072 ginormousPackageGraph = utils.testPackageGraphGinormous;
7173 exLibrary = packageGraph.libraries.firstWhere ((lib) => lib.name == 'ex' );
7274 errorLibrary = packageGraphErrors.libraries
@@ -82,6 +84,40 @@ void main() {
8284 sdkAsPackageGraph = utils.testPackageGraphSdk;
8385 });
8486
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+
85121 group ('Tools' , () {
86122 Class toolUser;
87123 Class _NonCanonicalToolUser , CanonicalToolUser , PrivateLibraryToolUser ;
0 commit comments