|
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,41 @@ void main() { |
151 | 152 | ); |
152 | 153 | }); |
153 | 154 | }); |
| 155 | + |
| 156 | + group('Deprecation.forVersion', () { |
| 157 | + test('includes deprecations as of that version', () { |
| 158 | + final version = Version.parse('1.79.0'); |
| 159 | + final deprecations = Deprecation.forVersion(version); |
| 160 | + |
| 161 | + expect( |
| 162 | + deprecations, |
| 163 | + contains(Deprecation.colorFunctions), |
| 164 | + reason: 'color-functions deprecated in 1.79 (and not obsolete)', |
| 165 | + ); |
| 166 | + }); |
| 167 | + |
| 168 | + test('excludes deprecations of newer versions', () { |
| 169 | + final version = Version.parse('1.79.0'); |
| 170 | + final deprecations = Deprecation.forVersion(version); |
| 171 | + |
| 172 | + expect( |
| 173 | + deprecations, |
| 174 | + isNot(contains(Deprecation.import)), |
| 175 | + reason: 'import deprecated as of 1.80', |
| 176 | + ); |
| 177 | + }); |
| 178 | + |
| 179 | + test('excludes deprecations that are obsolete', () { |
| 180 | + final version = Version.parse('1.79.0'); |
| 181 | + final deprecations = Deprecation.forVersion(version); |
| 182 | + |
| 183 | + expect( |
| 184 | + deprecations, |
| 185 | + isNot(contains(Deprecation.mixedDecls)), |
| 186 | + reason: 'mixed-decls deprecated in 1.77.7 but obsolete in 1.92.0', |
| 187 | + ); |
| 188 | + }); |
| 189 | + }); |
154 | 190 | } |
155 | 191 |
|
156 | 192 | /// Confirms that [source] will error if [deprecation] is fatal. |
|
0 commit comments