diff --git a/test/validator/language_version_test.dart b/test/validator/language_version_test.dart index 83e6cd7b4..c0c0a2167 100644 --- a/test/validator/language_version_test.dart +++ b/test/validator/language_version_test.dart @@ -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', );