-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-css.sh
executable file
·59 lines (47 loc) · 1.29 KB
/
test-css.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env sh
assert()
{
result="$(echo -e "$2" | ./build/native/minify css -)"
if [ "$?" != "0" ]; then
echo 'Crashed on:'
echo "$2"
exit 1
elif [ "$1" != "$result" ]; then
echo 'Error: expected:'
echo "$1"
echo 'got:'
echo "$result"
exit 1
fi
}
input='a /**/ + /*o/*o*/ a #b { c : 1px/**//**/1px;/**/; ;;d:"/* " 3 ;; }'
expected='a+a #b{c:1px 1px;d:"/* " 3}'
assert "$expected" "$input"
input='@import url(/*o);'
expected='@import url(/*o);'
assert "$expected" "$input"
input='@import url( "o" );@import url( o );'
expected='@import url("o");@import url(o);'
assert "$expected" "$input"
input='a{b:c !important}'
expected='a{b:c!important}'
assert "$expected" "$input"
input='@media {a :hover{a :hover}}'
expected='@media{a :hover{a:hover}}'
assert "$expected" "$input"
input='@media all and (hover:hover){} @media (hover:hover){}'
expected='@media all and (hover:hover){}@media(hover:hover){}'
assert "$expected" "$input"
input='a [ padding = 0.1em 1em ] {}'
expected='a[padding=.1em 1em]{}'
assert "$expected" "$input"
input='@media ( width < 0.1em ) {}'
expected='@media(width<.1em){}'
assert "$expected" "$input"
input='@page :left { }'
expected='@page :left{}'
assert "$expected" "$input"
input='a\{b{}'
expected='a\{b{}'
assert "$expected" "$input"
echo 'Passed all tests'