Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
Signed-off-by: George Lemon <[email protected]>
  • Loading branch information
georgelemon committed Aug 4, 2023
1 parent ae497c6 commit 2e5887c
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/test1.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,53 @@ proc getPath(append: string): string =
var paths = ["basic", "invalid", "for", "forjson", "case", "unused"]

test "can parse":
var p = parseProgram(paths[0].getPath())
var p = parseStylesheet(paths[0].getPath())
check p.hasErrors == false
check p.hasWarnings == false

test "can compile":
let basic = paths[0].getPath()
var p = parseProgram(basic)
var p = parseStylesheet(basic)
check p.hasErrors == false
check p.hasWarnings == false

var c: Compiler
# unminified
c = newCompiler(p.getProgram)
c = newCompiler(p.getStylesheet)
check c.getCSS.count("\n") == 3
# minified
c = newCompiler(p.getProgram, minify = true)
c = newCompiler(p.getStylesheet, minify = true)
check c.getCSS.count("\n") == 0
check c.getCSS == ".btn{border:2px #FFF solid}"

test "can catch errors":
var p = parseProgram(paths[1].getPath)
var p = parseStylesheet(paths[1].getPath)
check p.hasErrors == true
check p.logger.errorLogs[0].getMessage == invalidProperty

test "can catch warnings":
var p = parseProgram(paths[5].getPath)
var p = parseStylesheet(paths[5].getPath)
check p.hasErrors == false
check p.hasWarnings == true

test "can compile `for` blocks":
let path = paths[2].getPath()
var p = parseProgram(path)
var p = parseStylesheet(path)
check p.hasErrors == false
check p.hasWarnings == false
let c = newCompiler(p.getProgram)
let c = newCompiler(p.getStylesheet)

test "can compile `for` blocks w/ @json":
let path = paths[3].getPath()
var p = parseProgram(path)
var p = parseStylesheet(path)
check p.hasErrors == false
check p.hasWarnings == false
let c = newCompiler(p.getProgram)
let c = newCompiler(p.getStylesheet)

test "can compile `case` blocks":
let path = paths[4].getPath()
var p = parseProgram(path)
var p = parseStylesheet(path)
check p.hasErrors == false
check p.hasWarnings == false
let c = newCompiler(p.getProgram)
let c = newCompiler(p.getStylesheet)
echo c.getCSS

0 comments on commit 2e5887c

Please sign in to comment.