@@ -88,6 +88,24 @@ void main() {
88
88
});
89
89
});
90
90
91
+ group ("compileStringRelativeUrl is violated by" , () {
92
+ test ("a fully relative URL" , () {
93
+ _expectDeprecationCallback (
94
+ () => compileStringToResult ("a {b: c}" ,
95
+ url: "foo" ,
96
+ fatalDeprecations: {Deprecation .compileStringRelativeUrl}),
97
+ Deprecation .compileStringRelativeUrl);
98
+ });
99
+
100
+ test ("a root-relative URL" , () {
101
+ _expectDeprecationCallback (
102
+ () => compileStringToResult ("a {b: c}" ,
103
+ url: "/foo" ,
104
+ fatalDeprecations: {Deprecation .compileStringRelativeUrl}),
105
+ Deprecation .compileStringRelativeUrl);
106
+ });
107
+ });
108
+
91
109
// Deprecated in various Sass versions <=1.56.0
92
110
group ("functionUnits is violated by" , () {
93
111
test ("a hue with a non-angle unit" , () {
@@ -136,9 +154,16 @@ void main() {
136
154
}
137
155
138
156
/// Confirms that [source] will error if [deprecation] is fatal.
139
- void _expectDeprecation (String source, Deprecation deprecation) {
157
+ void _expectDeprecation (String source, Deprecation deprecation) =>
158
+ _expectDeprecationCallback (
159
+ () => compileStringToResult (source, fatalDeprecations: {deprecation}),
160
+ deprecation);
161
+
162
+ /// Confirms that [callback] will produce a fatal deprecation error for
163
+ /// [deprecation] .
164
+ void _expectDeprecationCallback (void callback (), Deprecation deprecation) {
140
165
try {
141
- compileStringToResult (source, fatalDeprecations : {deprecation} );
166
+ callback ( );
142
167
} catch (e) {
143
168
if (e.toString ().contains ("$deprecation deprecation to be fatal" )) return ;
144
169
fail ('Unexpected error: $e ' );
0 commit comments