Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
Signed-off-by: George Lemon <[email protected]>
  • Loading branch information
georgelemon committed Aug 9, 2023
1 parent f51ae5f commit a22b57d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 24 deletions.
2 changes: 1 addition & 1 deletion tests/stylesheets/case.bass
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$colors = [yellow, blue, pink]
var colors = [yellow, blue, pink]

for $color in $colors:
case $color
Expand Down
2 changes: 1 addition & 1 deletion tests/stylesheets/for.bass
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$colors = [blue, yellow, pink, green]
var colors = [blue, yellow, pink, green]

for $color in $colors:
.btn-{$color}
Expand Down
2 changes: 1 addition & 1 deletion tests/stylesheets/forjson.bass
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$config = @json "sample.json"
const config = @json "sample.json"

for $color in $config["colors"]:
.btn-{$color}
Expand Down
2 changes: 1 addition & 1 deletion tests/stylesheets/unused.bass
Original file line number Diff line number Diff line change
@@ -1 +1 @@
$config = @json "sample.json"
const config = @json "sample.json"
21 changes: 10 additions & 11 deletions tests/stylesheets/vars.bass
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
$a = 5px
$b = 10px
$c = true
$d = 10
$e = 1.0
var a = 5px
var b = 10px
var c = true
var d = 10
var e = 1.0

echo $a > $b
echo $a == 5px
echo $b == 10px

$MAX_WIDTH = 1240px // immutable
echo $MAX_WIDTH
assert $a == 5px
assert "abc" == "abc"
assert 1 == 1
assert true == true
assert 10 + 10 == 21
20 changes: 11 additions & 9 deletions tests/test1.nim
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ proc getPath(append: string): string =

var paths = ["basic", "invalid", "for", "forjson", "case", "unused", "vars"]

test "var declarations":
var p = parseStylesheet(paths[6].getPath)
check p.hasErrors == false
var c = newCompiler(p.getStylesheet)
echo c.getCSS

test "can parse":
var p = parseStylesheet(paths[0].getPath())
check p.hasErrors == false
Expand Down Expand Up @@ -42,21 +36,29 @@ test "can catch warnings":
check p.hasErrors == false
check p.hasWarnings == true

test "can compile `for` blocks":
test "var declarations":
var p = parseStylesheet(paths[6].getPath)
check p.hasErrors == false
var c = newCompiler(p.getStylesheet)
echo c.getCSS

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

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

test "can compile `case` blocks":
test "`case` blocks":
let path = paths[4].getPath()
var p = parseStylesheet(path)
check p.hasErrors == false
Expand Down

0 comments on commit a22b57d

Please sign in to comment.