@@ -68,6 +68,11 @@ class Metadata {
6868 /// resolved when the metadata is constructed.
6969 final Map <BooleanSelector , Metadata > forTag;
7070
71+ /// The language version comment, if one is present.
72+ ///
73+ /// Only available for test suites and not individual tests.
74+ final String languageVersionComment;
75+
7176 /// Parses a user-provided map into the value for [onPlatform] .
7277 static Map <PlatformSelector , Metadata > _parseOnPlatform (
7378 Map <String , dynamic > onPlatform) {
@@ -147,7 +152,8 @@ class Metadata {
147152 String skipReason,
148153 Iterable <String > tags,
149154 Map <PlatformSelector , Metadata > onPlatform,
150- Map <BooleanSelector , Metadata > forTag}) {
155+ Map <BooleanSelector , Metadata > forTag,
156+ String languageVersionComment}) {
151157 // Returns metadata without forTag resolved at all.
152158 Metadata _unresolved () => Metadata ._(
153159 testOn: testOn,
@@ -159,7 +165,8 @@ class Metadata {
159165 skipReason: skipReason,
160166 tags: tags,
161167 onPlatform: onPlatform,
162- forTag: forTag);
168+ forTag: forTag,
169+ languageVersionComment: languageVersionComment);
163170
164171 // If there's no tag-specific metadata, or if none of it applies, just
165172 // return the metadata as-is.
@@ -193,7 +200,8 @@ class Metadata {
193200 int retry,
194201 Iterable <String > tags,
195202 Map <PlatformSelector , Metadata > onPlatform,
196- Map <BooleanSelector , Metadata > forTag})
203+ Map <BooleanSelector , Metadata > forTag,
204+ this .languageVersionComment})
197205 : testOn = testOn ?? PlatformSelector .all,
198206 timeout = timeout ?? const Timeout .factor (1 ),
199207 _skip = skip,
@@ -220,7 +228,8 @@ class Metadata {
220228 bool chainStackTraces,
221229 int retry,
222230 Map <String , dynamic > onPlatform,
223- tags})
231+ tags,
232+ this .languageVersionComment})
224233 : testOn = testOn == null
225234 ? PlatformSelector .all
226235 : PlatformSelector .parse (testOn),
@@ -261,7 +270,8 @@ class Metadata {
261270 },
262271 forTag = (serialized['forTag' ] as Map ).map ((key, nested) => MapEntry (
263272 BooleanSelector .parse (key as String ),
264- Metadata .deserialize (nested)));
273+ Metadata .deserialize (nested))),
274+ languageVersionComment = serialized['languageVersionComment' ] as String ;
265275
266276 /// Deserializes timeout from the format returned by [_serializeTimeout] .
267277 static Timeout _deserializeTimeout (serialized) {
@@ -314,7 +324,9 @@ class Metadata {
314324 onPlatform: mergeMaps (onPlatform, other.onPlatform,
315325 value: (metadata1, metadata2) => metadata1.merge (metadata2)),
316326 forTag: mergeMaps (forTag, other.forTag,
317- value: (metadata1, metadata2) => metadata1.merge (metadata2)));
327+ value: (metadata1, metadata2) => metadata1.merge (metadata2)),
328+ languageVersionComment:
329+ other.languageVersionComment ?? languageVersionComment);
318330
319331 /// Returns a copy of [this] with the given fields changed.
320332 Metadata change (
@@ -327,7 +339,8 @@ class Metadata {
327339 String skipReason,
328340 Map <PlatformSelector , Metadata > onPlatform,
329341 Set <String > tags,
330- Map <BooleanSelector , Metadata > forTag}) {
342+ Map <BooleanSelector , Metadata > forTag,
343+ String languageVersionComment}) {
331344 testOn ?? = this .testOn;
332345 timeout ?? = this .timeout;
333346 skip ?? = _skip;
@@ -338,6 +351,7 @@ class Metadata {
338351 onPlatform ?? = this .onPlatform;
339352 tags ?? = this .tags;
340353 forTag ?? = this .forTag;
354+ languageVersionComment ?? = this .languageVersionComment;
341355 return Metadata (
342356 testOn: testOn,
343357 timeout: timeout,
@@ -348,7 +362,8 @@ class Metadata {
348362 onPlatform: onPlatform,
349363 tags: tags,
350364 forTag: forTag,
351- retry: retry);
365+ retry: retry,
366+ languageVersionComment: languageVersionComment);
352367 }
353368
354369 /// Returns a copy of [this] with all platform-specific metadata from
@@ -384,7 +399,8 @@ class Metadata {
384399 'tags' : tags.toList (),
385400 'onPlatform' : serializedOnPlatform,
386401 'forTag' : forTag.map ((selector, metadata) =>
387- MapEntry (selector.toString (), metadata.serialize ()))
402+ MapEntry (selector.toString (), metadata.serialize ())),
403+ 'languageVersionComment' : languageVersionComment,
388404 };
389405 }
390406
0 commit comments