Skip to content

Commit eeaa9cc

Browse files
committed
Tests for fix to crash when mixin @import and @use
1 parent 6f6122a commit eeaa9cc

File tree

2 files changed

+113
-4
lines changed

2 files changed

+113
-4
lines changed

spec/directives/import/nested.hrx

Lines changed: 95 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,10 @@ More info and automated migrator: https://sass-lang.com/d/import
211211
/* Y */
212212

213213
<===> with_comment/_b.scss
214-
@import 'a'
214+
@import 'a';
215215

216216
<===> with_comment/_c.scss
217-
@import 'a'
217+
@import 'a';
218218

219219
<===> with_comment/output.css
220220
/* Y */
@@ -246,7 +246,7 @@ DEPRECATION WARNING [import]: Sass @import rules are deprecated and will be remo
246246
More info and automated migrator: https://sass-lang.com/d/import
247247

248248
,
249-
1 | @import 'a'
249+
1 | @import 'a';
250250
| ^^^
251251
'
252252
_b.scss 1:9 @import
@@ -257,8 +257,99 @@ DEPRECATION WARNING [import]: Sass @import rules are deprecated and will be remo
257257
More info and automated migrator: https://sass-lang.com/d/import
258258

259259
,
260-
1 | @import 'a'
260+
1 | @import 'a';
261261
| ^^^
262262
'
263263
_c.scss 1:9 @import
264264
input.scss 2:9 root stylesheet
265+
266+
<===>
267+
================================================================================
268+
<===> top_level_include_declaration/README.md
269+
These are regression tests for https://github.com/sass/dart-sass/issues/2588.
270+
271+
<===>
272+
================================================================================
273+
<===> top_level_include_declaration/without_use/input.scss
274+
.a {
275+
@import 'upstream';
276+
}
277+
278+
<===> top_level_include_declaration/without_use/_upstream.scss
279+
@mixin a { b: c }
280+
@include a;
281+
282+
<===> top_level_include_declaration/without_use/output.css
283+
.a {
284+
b: c;
285+
}
286+
287+
<===> top_level_include_declaration/without_use/warning
288+
DEPRECATION WARNING [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
289+
More info and automated migrator: https://sass-lang.com/d/import
290+
,
291+
2 | @import 'upstream';
292+
| ^^^^^^^^^^
293+
'
294+
input.scss 2:11 root stylesheet
295+
296+
<===>
297+
================================================================================
298+
<===> top_level_include_declaration/with_use/input.scss
299+
.a {
300+
@import 'upstream';
301+
}
302+
303+
<===> top_level_include_declaration/with_use/_upstream.scss
304+
@use 'other';
305+
@mixin a { b: c }
306+
@include a;
307+
308+
<===> top_level_include_declaration/with_use/other.scss
309+
// Intentionally empty.
310+
311+
<===> top_level_include_declaration/with_use/output.css
312+
.a {
313+
b: c;
314+
}
315+
316+
<===> top_level_include_declaration/with_use/warning
317+
DEPRECATION WARNING [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
318+
More info and automated migrator: https://sass-lang.com/d/import
319+
,
320+
2 | @import 'upstream';
321+
| ^^^^^^^^^^
322+
'
323+
input.scss 2:11 root stylesheet
324+
325+
<===>
326+
================================================================================
327+
<===> top_level_include_declaration/with_use/two_levels_deep/input.scss
328+
.a {
329+
@import 'upstream1';
330+
}
331+
332+
<===> top_level_include_declaration/with_use/two_levels_deep/_upstream1.scss
333+
@import 'upstream2';
334+
335+
<===> top_level_include_declaration/with_use/two_levels_deep/_upstream2.scss
336+
@use 'other';
337+
@mixin a { b: c }
338+
@include a;
339+
340+
<===> top_level_include_declaration/with_use/two_levels_deep/other.scss
341+
// Intentionally empty.
342+
343+
<===> top_level_include_declaration/with_use/two_levels_deep/output.css
344+
.a {
345+
b: c;
346+
}
347+
348+
<===> top_level_include_declaration/with_use/two_levels_deep/warning
349+
DEPRECATION WARNING [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
350+
More info and automated migrator: https://sass-lang.com/d/import
351+
,
352+
2 | @import 'upstream';
353+
| ^^^^^^^^^^
354+
'
355+
input.scss 2:11 root stylesheet

spec/directives/use/error/load.hrx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,3 +328,21 @@ Error: There's already a module with namespace "other".
328328
| ^^^^^^^^^^^^^^^^^^^^^^ new @use
329329
'
330330
input.scss 2:1 root stylesheet
331+
332+
<===>
333+
================================================================================
334+
<===> top_level_include_declaration/input.scss
335+
@use "upstream";
336+
@include upstream.a;
337+
338+
<===> top_level_include_declaration/_upstream.scss
339+
@mixin a { b: c }
340+
341+
<===> top_level_include_declaration/error
342+
Error: Declarations may only be used within style rules.
343+
,
344+
1 | @mixin a { b: c }
345+
| ^^^^^
346+
'
347+
_upstream.scss 1:12 a()
348+
input.scss 2:1 root stylesheet

0 commit comments

Comments
 (0)