Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and increase flexibility of language version override test #3985

Merged
merged 1 commit into from
Aug 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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