|
8 | 8 | import 'package:test/test.dart'; |
9 | 9 |
|
10 | 10 | import 'package:sass/sass.dart'; |
| 11 | +import 'package:pub_semver/pub_semver.dart'; |
11 | 12 |
|
12 | 13 | void main() { |
13 | 14 | // Deprecated in all version of Dart Sass |
@@ -151,6 +152,75 @@ void main() { |
151 | 152 | ); |
152 | 153 | }); |
153 | 154 | }); |
| 155 | + |
| 156 | + group('Deprecation.forVersion', () { |
| 157 | + test('includes deprecations that are not obsolete', () { |
| 158 | + final version = Version.parse('1.79.0'); |
| 159 | + final sassVersion = Version.parse('1.91.0'); |
| 160 | + final deprecations = Deprecation.forVersion(version, sassVersion); |
| 161 | + |
| 162 | + expect( |
| 163 | + deprecations, |
| 164 | + equals({ |
| 165 | + Deprecation.callString, |
| 166 | + Deprecation.elseif, |
| 167 | + Deprecation.mozDocument, |
| 168 | + Deprecation.relativeCanonical, |
| 169 | + Deprecation.newGlobal, |
| 170 | + Deprecation.colorModuleCompat, |
| 171 | + Deprecation.slashDiv, |
| 172 | + Deprecation.bogusCombinators, |
| 173 | + Deprecation.strictUnary, |
| 174 | + Deprecation.functionUnits, |
| 175 | + Deprecation.duplicateVarFlags, |
| 176 | + Deprecation.nullAlpha, |
| 177 | + Deprecation.absPercent, |
| 178 | + Deprecation.fsImporterCwd, |
| 179 | + Deprecation.cssFunctionMixin, |
| 180 | + Deprecation.mixedDecls, |
| 181 | + Deprecation.featureExists, |
| 182 | + Deprecation.color4Api, |
| 183 | + Deprecation.colorFunctions, |
| 184 | + Deprecation.legacyJsApi |
| 185 | + }), |
| 186 | + reason: |
| 187 | + 'type-function not deprecated yet in 1.79.0, mixed-decls not obsolete in 1.91.0', |
| 188 | + ); |
| 189 | + }); |
| 190 | + |
| 191 | + test('includes deprecations that are not obsolete', () { |
| 192 | + final version = Version.parse('1.79.0'); |
| 193 | + final sassVersion = Version.parse('1.92.0'); |
| 194 | + final deprecations = Deprecation.forVersion(version, sassVersion); |
| 195 | + |
| 196 | + expect( |
| 197 | + deprecations, |
| 198 | + equals({ |
| 199 | + Deprecation.callString, |
| 200 | + Deprecation.elseif, |
| 201 | + Deprecation.mozDocument, |
| 202 | + Deprecation.relativeCanonical, |
| 203 | + Deprecation.newGlobal, |
| 204 | + Deprecation.colorModuleCompat, |
| 205 | + Deprecation.slashDiv, |
| 206 | + Deprecation.bogusCombinators, |
| 207 | + Deprecation.strictUnary, |
| 208 | + Deprecation.functionUnits, |
| 209 | + Deprecation.duplicateVarFlags, |
| 210 | + Deprecation.nullAlpha, |
| 211 | + Deprecation.absPercent, |
| 212 | + Deprecation.fsImporterCwd, |
| 213 | + Deprecation.cssFunctionMixin, |
| 214 | + Deprecation.featureExists, |
| 215 | + Deprecation.color4Api, |
| 216 | + Deprecation.colorFunctions, |
| 217 | + Deprecation.legacyJsApi |
| 218 | + }), |
| 219 | + reason: |
| 220 | + 'mixed-decls obsolete in 1.92.0', |
| 221 | + ); |
| 222 | + }); |
| 223 | + }); |
154 | 224 | } |
155 | 225 |
|
156 | 226 | /// Confirms that [source] will error if [deprecation] is fatal. |
|
0 commit comments