Skip to content

Commit 56fc702

Browse files
Sqrt calc function test
1 parent d32cf6d commit 56fc702

File tree

1 file changed

+164
-0
lines changed

1 file changed

+164
-0
lines changed

spec/values/calculation/sqrt.hrx

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
<===> README.md
2+
Most of the same behavior tested for `calc()` applies to `sqrt()`, but for
3+
terseness' sake isn't tested explicitly.
4+
5+
<===>
6+
================================================================================
7+
<===> error/syntax/no_arg/input.scss
8+
a {b: calc(sqrt())}
9+
10+
<===> error/syntax/no_arg/error
11+
Error: Expected number, variable, function, or calculation.
12+
,
13+
1 | a {b: calc(sqrt())}
14+
| ^
15+
'
16+
input.scss 1:17 root stylesheet
17+
18+
<===>
19+
================================================================================
20+
<===> error/syntax/no_units/input.scss
21+
a {b: calc(sqrt(16px))}
22+
23+
<===> error/syntax/no_units/error
24+
Error: Expected 16px to have no units.
25+
,
26+
1 | a {b: calc(sqrt(16px))}
27+
| ^^^^^^^^^^
28+
'
29+
input.scss 1:12 root stylesheet
30+
31+
<===>
32+
================================================================================
33+
<===> error/syntax/operation_no_units/input.scss
34+
a {b: calc(sqrt(1 + 16px))}
35+
36+
<===> error/syntax/operation_no_units/error
37+
Error: Expected 17px to have no units.
38+
,
39+
1 | a {b: calc(sqrt(1 + 16px))}
40+
| ^^^^^^^^^^^^^^
41+
'
42+
input.scss 1:12 root stylesheet
43+
44+
<===>
45+
================================================================================
46+
<===> error/syntax/min_no_units/input.scss
47+
a {b: calc(sqrt(min(16, 9px)))}
48+
49+
<===> error/syntax/min_no_units/error
50+
Error: Expected 9px to have no units.
51+
,
52+
1 | a {b: calc(sqrt(min(16, 9px)))}
53+
| ^^^^^^^^^^^^^^^^^^
54+
'
55+
input.scss 1:12 root stylesheet
56+
57+
<===>
58+
================================================================================
59+
<===> error/syntax/invalid_arg/input.scss
60+
a {b: calc(sqrt($))}
61+
62+
<===> error/syntax/invalid_arg/error
63+
Error: Expected identifier.
64+
,
65+
1 | a {b: calc(sqrt($))}
66+
| ^
67+
'
68+
input.scss 1:18 root stylesheet
69+
70+
<===>
71+
================================================================================
72+
<===> error/complex_unit/input.scss
73+
a {b: sqrt(1px*1px)}
74+
75+
<===> error/complex_unit/error
76+
Error: Number 1px*px isn't compatible with CSS calculations.
77+
,
78+
1 | a {b: sqrt(1px*1px)}
79+
| ^^^^^^^
80+
'
81+
input.scss 1:12 root stylesheet
82+
83+
<===>
84+
================================================================================
85+
<===> error/percentage/input.scss
86+
a {b: calc(sqrt(5%))}
87+
88+
<===> error/percentage/error
89+
Error: Expected 5% to have no units.
90+
,
91+
1 | a {b: calc(sqrt(5%))}
92+
| ^^^^^^^^
93+
'
94+
input.scss 1:12 root stylesheet
95+
96+
<===>
97+
================================================================================
98+
<===> preserved/operation/unitless/first/input.scss
99+
a {b: calc(sqrt(16))}
100+
101+
<===> preserved/operation/unitless/first/output.css
102+
a {
103+
b: 4;
104+
}
105+
106+
<===>
107+
================================================================================
108+
<===> preserved/operation/unitless/second/input.scss
109+
a {b: calc(sqrt(2))}
110+
111+
<===> preserved/operation/unitless/second/output.css
112+
a {
113+
b: 1.4142135624;
114+
}
115+
116+
<===>
117+
================================================================================
118+
<===> preserved/operation/unitless/negative/input.scss
119+
a {b: calc(sqrt(-9))}
120+
121+
<===> preserved/operation/unitless/negative/output.css
122+
a {
123+
b: calc(NaN);
124+
}
125+
126+
<===>
127+
================================================================================
128+
<===> preserved/operation/math/plus/input.scss
129+
a {b: calc(sqrt(10 + 6))}
130+
131+
<===> preserved/operation/math/plus/output.css
132+
a {
133+
b: 4;
134+
}
135+
136+
<===>
137+
================================================================================
138+
<===> preserved/operation/math/minus/input.scss
139+
a {b: calc(sqrt(10 - 1))}
140+
141+
<===> preserved/operation/math/minus/output.css
142+
a {
143+
b: 3;
144+
}
145+
146+
<===>
147+
================================================================================
148+
<===> preserved/operation/math/max/input.scss
149+
a {b: calc(sqrt(max(2, 9)))}
150+
151+
<===> preserved/operation/math/max/output.css
152+
a {
153+
b: 3;
154+
}
155+
156+
<===>
157+
================================================================================
158+
<===> preserved/operation/math/min/input.scss
159+
a {b: calc(sqrt(min(16, 9)))}
160+
161+
<===> preserved/operation/math/min/output.css
162+
a {
163+
b: 3;
164+
}

0 commit comments

Comments
 (0)