-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.lua
More file actions
36 lines (30 loc) · 1.28 KB
/
test.lua
File metadata and controls
36 lines (30 loc) · 1.28 KB
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
local sass = require "sass"
local compile = assert(sass.compile)
local compile_file = assert(sass.compile_file)
local type, assert, write = type, assert, io.write
local _ENV = nil
do -- Compilation of valid SCSS strings should work
local scsstext = "$x: red; a {color: $x / 3}"
local expected = "a{color:#550000}"
local output = assert(compile(scsstext, "compressed"))
assert(output == expected)
end
do -- Compilation of valid SCSS files should work
local filename = "test.scss"
local expected = "p{width:550px;color:#cc5500;border-radius:7px}"
local output = assert(compile_file(filename, "compressed"))
assert(output == expected)
end
do -- Compilation of UTF-8 input containing multi-byte characters should work
local prefix = '@charset "UTF-8";\n'
local scsstext = prefix .. "$สี: blue; .สีน้ำเงิน {color: $สี / 4}"
local expected = prefix .. ".สีน้ำเงิน{color:#000040}"
local output = assert(compile(scsstext, "compressed"))
assert(output == expected)
end
-- Errors should return nil, rather than terminating
assert(not compile "invalid-syntax!")
assert(not compile_file "non-existant.file")
-- Version information should be available
assert(type(sass.LIBSASS_VERSION) == "string")
write "All tests passed\n"