Skip to content

Commit

Permalink
Fix and increase flexibility of language version override test (#3985)
Browse files Browse the repository at this point in the history
  • Loading branch information
parlough authored Aug 14, 2023
1 parent 037138e commit 6c26764
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions test/validator/language_version_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,25 @@ void main() {
});

group('should warn if it', () {
final currentVersion = Version.parse(Platform.version.split(' ').first);
final nextLanguageVersion =
LanguageVersion(currentVersion.major, currentVersion.minor + 1)
.toString();

test('opts in to a newer version.', () async {
final nextVersion =
Version.parse(Platform.version.split(' ').first).nextMajor;
await setup(
sdkConstraint: '^3.0.0',
libraryLanguageVersion:
LanguageVersion.fromVersion(nextVersion).toString(),
libraryLanguageVersion: nextLanguageVersion,
);
await expectValidationWarning(
'The language version override can\'t specify a version greater than the latest known language version',
);
});
test('opts in to a newer version, with non-range constraint.', () async {
await setup(sdkConstraint: '3.1.2+3', libraryLanguageVersion: '3.2');
await setup(
sdkConstraint: '3.1.2+3',
libraryLanguageVersion: nextLanguageVersion,
);
await expectValidationWarning(
'The language version override can\'t specify a version greater than the latest known language version',
);
Expand Down

0 comments on commit 6c26764

Please sign in to comment.