File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -224,7 +224,8 @@ enum Deprecation {
224224 var range = VersionRange (max: version, includeMax: true );
225225 return {
226226 for (var deprecation in Deprecation .values)
227- if (deprecation.deprecatedIn.andThen (range.allows) ?? false )
227+ if ((deprecation.deprecatedIn.andThen (range.allows) ?? false ) &&
228+ (deprecation.obsoleteIn.andThen ((v) => ! range.allows (v)) ?? true ))
228229 deprecation,
229230 };
230231 }
Original file line number Diff line number Diff line change 88import 'package:test/test.dart' ;
99
1010import 'package:sass/sass.dart' ;
11+ import 'package:pub_semver/pub_semver.dart' ;
1112
1213void main () {
1314 // Deprecated in all version of Dart Sass
@@ -151,6 +152,36 @@ void main() {
151152 );
152153 });
153154 });
155+
156+ group ('Deprecation.forVersion' , () {
157+ test ('includes deprecation if not obsolete' , () {
158+ final version = Version .parse ('1.91.0' );
159+ final deprecations = Deprecation .forVersion (version);
160+
161+ expect (
162+ deprecations,
163+ contains (Deprecation .mixedDecls),
164+ reason: 'mixed-decls is obsolete in 1.92, should be fatal at 1.91' ,
165+ );
166+ });
167+
168+ test ('excludes obsolete deprecations' , () {
169+ final version = Version .parse ('1.93.0' );
170+ final deprecations = Deprecation .forVersion (version);
171+
172+ expect (
173+ deprecations,
174+ isNot (contains (Deprecation .mixedDecls)),
175+ reason: 'mixed-decls is obsolete in 1.92, should not be fatal at 1.93' ,
176+ );
177+
178+ expect (
179+ deprecations,
180+ contains (Deprecation .functionUnits),
181+ reason: 'functionUnits is deprecated but not obsolete, should be fatal' ,
182+ );
183+ });
184+ });
154185}
155186
156187/// Confirms that [source] will error if [deprecation] is fatal.
You can’t perform that action at this time.
0 commit comments