Skip to content

Commit 603cfe3

Browse files
committed
Add more tests
1 parent c1414d9 commit 603cfe3

File tree

5 files changed

+239
-9
lines changed

5 files changed

+239
-9
lines changed

spec/css/function.hrx

Lines changed: 191 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,18 @@
9898
result: 2;
9999
}
100100

101+
<===>
102+
================================================================================
103+
<===> uppercase/result/nesting/input.scss
104+
@function --a() {
105+
RESULT: {b: c};
106+
}
107+
108+
<===> uppercase/result/nesting/output.css
109+
@function --a() {
110+
RESULT: {b: c};
111+
}
112+
101113
<===>
102114
================================================================================
103115
<===> interpolated/result/sass_script/input.scss
@@ -112,9 +124,186 @@
112124

113125
<===>
114126
================================================================================
115-
<===> interpolated/result/characters/input.scss
127+
<===> interpolated/result/nested/input.sass
128+
@function --a()
129+
#{result}:
130+
b: c
131+
132+
<===> interpolated/result/nested/output.css
133+
@function --a() {
134+
result-b: c;
135+
}
136+
137+
<===>
138+
================================================================================
139+
<===> result/uppercase/sass_script/input.scss
140+
@function --a() {
141+
RESULT: $b;
142+
}
143+
144+
<===> result/uppercase/sass_script/output.css
145+
@function --a() {
146+
RESULT: $b;
147+
}
148+
149+
<===>
150+
================================================================================
151+
<===> result/uppercase/characters/input.scss
116152
@function --a() {
153+
RESULT: {}#&%^*;
154+
}
155+
156+
<===> result/uppercase/characters/output.css
157+
@function --a() {
158+
RESULT: {}#&%^*;
159+
}
160+
161+
<===>
162+
================================================================================
163+
<===> result/uppercase/interpolation/input.scss
164+
@function --a() {
165+
RESULT: #{1 + 1};
166+
}
167+
168+
<===> result/uppercase/interpolation/output.css
169+
@function --a() {
170+
RESULT: 2;
171+
}
172+
173+
<===>
174+
================================================================================
175+
<===> result/interpolated/sass_script/input.scss
176+
@function --a() {
177+
#{result}: 1 + 1;
178+
}
179+
180+
<===> result/interpolated/sass_script/output.css
181+
@function --a() {
182+
result: 2;
183+
}
184+
185+
<===>
186+
================================================================================
187+
<===> result/interpolated/nested/input.sass
188+
@function --a()
189+
#{result}:
190+
b: c
191+
192+
<===> result/interpolated/nested/output.css
193+
@function --a() {
194+
result-b: c;
195+
}
196+
197+
<===>
198+
================================================================================
199+
<===> result/style_rule/sass_script/input.scss
200+
.a {
201+
result: 1 + 1;
202+
}
203+
204+
<===> result/style_rule/sass_script/output.css
205+
.a {
206+
result: 2;
207+
}
208+
209+
<===>
210+
================================================================================
211+
<===> result/style_rule/interpolation/input.scss
212+
.a {
213+
result: #{1 + 1};
214+
}
215+
216+
<===> result/style_rule/interpolation/output.css
217+
.a {
218+
result: 2;
219+
}
220+
221+
<===>
222+
================================================================================
223+
<===> error/lowercase/result/nested/input.sass
224+
@function --a()
225+
result:
226+
b: c
227+
228+
<===> error/lowercase/result/nested/error
229+
Error: Nothing may be indented beneath a @function result.
230+
,
231+
3 | b: c
232+
| ^
233+
'
234+
input.sass 3:5 root stylesheet
235+
236+
<===>
237+
================================================================================
238+
<===> error/uppercase/result/nested/input.sass
239+
@FUNCTION --a()
240+
result:
241+
b: c
242+
243+
<===> error/uppercase/result/nested/error
244+
Error: Nothing may be indented beneath a @function result.
245+
,
246+
3 | b: c
247+
| ^
248+
'
249+
input.sass 3:5 root stylesheet
250+
251+
<===>
252+
================================================================================
253+
<===> error/interpolated/result/characters/input.scss
254+
@#{function} --a() {
255+
result: {}#&%^*;
256+
}
257+
258+
<===> error/interpolated/result/characters/error
259+
Error: expected "{".
260+
,
261+
2 | result: {}#&%^*;
262+
| ^
263+
'
264+
input.scss 2:18 root stylesheet
265+
266+
<===>
267+
================================================================================
268+
<===> error/result/uppercase/nested/input.sass
269+
@function --a()
270+
RESULT:
271+
b: c
272+
273+
<===> error/result/uppercase/nested/error
274+
Error: Nothing may be indented beneath a @function result.
275+
,
276+
3 | b: c
277+
| ^
278+
'
279+
input.sass 3:5 root stylesheet
280+
281+
<===>
282+
================================================================================
283+
<===> error/result/interpolated/characters/input.scss
284+
@function --a() {
285+
#{result}: {}#&%^*;
286+
}
287+
288+
<===> error/result/interpolated/characters/error
289+
Error: expected "{".
290+
,
291+
2 | #{result}: {}#&%^*;
292+
| ^
293+
'
294+
input.scss 2:21 root stylesheet
295+
296+
<===>
297+
================================================================================
298+
<===> error/result/style_rule/characters/input.scss
299+
.a {
117300
result: {}#&%^*;
118301
}
119302

120-
<===> interpolated/result/characters/error
303+
<===> error/result/style_rule/characters/error
304+
Error: expected "{".
305+
,
306+
2 | result: {}#&%^*;
307+
| ^
308+
'
309+
input.scss 2:18 root stylesheet

spec/css/plain/function.hrx

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<===>
4141
================================================================================
4242
<===> lowercase/result/characters/input.scss
43-
@use "sass";
43+
@use "plain";
4444

4545
<===> lowercase/result/characters/plain.css
4646
@function --a() {
@@ -55,7 +55,7 @@
5555
<===>
5656
================================================================================
5757
<===> uppercase/result/sass_script/input.scss
58-
@use "sass";
58+
@use "plain";
5959

6060
<===> uppercase/result/sass_script/plain.css
6161
@FUNCTION --a() {
@@ -70,7 +70,7 @@
7070
<===>
7171
================================================================================
7272
<===> uppercase/result/characters/input.scss
73-
@use "sass";
73+
@use "plain";
7474

7575
<===> uppercase/result/characters/plain.css
7676
@FUNCTION --a() {
@@ -81,3 +81,33 @@
8181
@FUNCTION --a() {
8282
result: {}#&%^*;
8383
}
84+
85+
<===>
86+
================================================================================
87+
<===> result/uppercase/sass_script/input.scss
88+
@use "plain";
89+
90+
<===> result/uppercase/sass_script/plain.css
91+
@function --a() {
92+
RESULT: $b;
93+
}
94+
95+
<===> result/uppercase/sass_script/output.css
96+
@function --a() {
97+
RESULT: $b;
98+
}
99+
100+
<===>
101+
================================================================================
102+
<===> result/uppercase/characters/input.scss
103+
@use "plain";
104+
105+
<===> result/uppercase/characters/plain.css
106+
@function --a() {
107+
RESULT: {}#&%^*;
108+
}
109+
110+
<===> result/uppercase/characters/output.css
111+
@function --a() {
112+
RESULT: {}#&%^*;
113+
}

spec/css/propset.hrx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ a { b: { --d: e } }
115115
Error: Declarations whose names begin with "--" may not be nested.
116116
,
117117
1 | a { b: { --d: e } }
118-
| ^^^^^^^
118+
| ^^^
119119
'
120120
input.scss 1:10 root stylesheet
121121

@@ -128,7 +128,7 @@ a { b: { --d: {e: f} } }
128128
Error: Declarations whose names begin with "--" may not be nested.
129129
,
130130
1 | a { b: { --d: {e: f} } }
131-
| ^^^^^^^^^^^
131+
| ^^^
132132
'
133133
input.scss 1:10 root stylesheet
134134

@@ -141,6 +141,6 @@ a { b: { --d: e {--f: g} } }
141141
Error: Declarations whose names begin with "--" may not be nested.
142142
,
143143
1 | a { b: { --d: e {--f: g} } }
144-
| ^^^^^^^^^^^^^^^
144+
| ^^^
145145
'
146146
input.scss 1:10 root stylesheet

spec/directives/function/name.hrx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
@function __a() {@return 1}
33
b {c: --a()}
44

5-
<===> custom_ident/call/error
5+
<===> custom_ident/call/output.css
6+
b {
7+
c: --a();
8+
}
69

710
<===>
811
================================================================================

spec/directives/mixin/custom_ident_include.hrx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,11 @@
33
d {@include --a}
44

55
<===> error
6+
Error: Sass @mixin names beginning with -- are forbidden for forward-compatibility with plain CSS mixins.
7+
8+
For details, see https://sass-lang.com/d/css-function-mixin
9+
,
10+
2 | d {@include --a}
11+
| ^^^
12+
'
13+
input.scss 2:13 root stylesheet

0 commit comments

Comments
 (0)