diff --git a/Makefile b/Makefile index 3be2821..f973242 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ DIFF = $(shell which colordiff || which diff) TMPPID = $(shell echo $$PPID) # Test files to execute. -TESTS ?= $(shell find tests/*.scss) +TESTS ?= $(shell find tests/*/*.scss) # Color & style definitions. BOLD = \033[1m @@ -80,7 +80,7 @@ $(TESTS): @$(FAWKSS) $@.test.$(TMPPID) > $@.actual.$(TMPPID) $(eval te = $(shell date +"%s%3N")) - @printf ">> $(BOLD)Testing file '$@'...$(RESET)\t" + @printf ">> $(BOLD)Testing file '$@'...$(RESET) " # Generate diff between expected and actual results and print back to user. @result=$$($(DIFF) -ud $@.expected.$(TMPPID) $@.actual.$(TMPPID) | tail -n +3); \ diff --git a/tests/03-imports.scss b/tests/03-imports.scss deleted file mode 100644 index 0fd8488..0000000 --- a/tests/03-imports.scss +++ /dev/null @@ -1,34 +0,0 @@ -// -// Simple import tests for Fawkss. -// - ---- TEST --- - -// These should be passed down to the resulting CSS file verbatim. -@import "foo.css"; -@import "foo" screen; -@import "http://foo.com/bar"; -@import url(foo); - -// These should be imported into the resulting CSS file. -@import "imports/partial" ; - @import "imports/full.scss"; - ---- EXPECTED --- - -@import "foo.css"; -@import "foo" screen; -@import "http://foo.com/bar"; -@import url(foo); - -.partial { - content: 'This is a partial'; -} - -.full { - content: 'This is a full import'; - color: #fff; - background-color : #000; -} - ---- END --- \ No newline at end of file diff --git a/tests/04-mixins.scss b/tests/04-mixins.scss deleted file mode 100644 index ec61bfe..0000000 --- a/tests/04-mixins.scss +++ /dev/null @@ -1,72 +0,0 @@ -// -// Simple mixin tests for Fawkss. -// - ---- TEST --- - -// Simple mixin with no parameters or parent selectors. -@mixin invisible-ink { - color: white; - background-color: white; -} - -body { - @include invisible-ink; -} - -// Nested mixin with additional rules. -@mixin invisible-box { - @include invisible-ink; - border: none; -} - -#boxy-mcboxface { - @include invisible-box; -} - -// Simple mixin with parameters. -@mixin paint-it($fg-color, $bg-color) { - color: $fg-color; - background-color: $bg-color; -} - -#black-box { - @include paint-it(black, black); -} - -// Mixin with default parameters and overrides. -$color-1: black; -$color-2: white; -$color-3: red; - -@mixin gradient-me($color-1: purple, $color-2: black) { - linear-gradient(left, $color-1, $color-2, $color-3); -} - -#rainbox-box { - @include gradient-me(green); -} - ---- EXPECTED --- - -body { - color: white; - background-color: white; -} - -#boxy-mcboxface { - color: white; - background-color: white; - border: none; -} - -#black-box { - color: black; - background-color: black; -} - -#rainbox-box { - linear-gradient(left, green, black, red); -} - ---- END --- \ No newline at end of file diff --git a/tests/01-comments.scss b/tests/basic/comments.scss similarity index 90% rename from tests/01-comments.scss rename to tests/basic/comments.scss index fe0748b..44f4933 100644 --- a/tests/01-comments.scss +++ b/tests/basic/comments.scss @@ -1,5 +1,5 @@ // -// Simple comment tests for Fawkss. +// Tests inline and multiline comments. // --- TEST --- diff --git a/tests/02-variables.scss b/tests/basic/variables.scss similarity index 86% rename from tests/02-variables.scss rename to tests/basic/variables.scss index 9a46e71..83ec392 100644 --- a/tests/02-variables.scss +++ b/tests/basic/variables.scss @@ -1,5 +1,5 @@ // -// Simple variable tests for Fawkss. +// Tests global variable declaractions and definitions. // --- TEST --- diff --git a/tests/imports/_partial.scss b/tests/imports/common/_partial.scss similarity index 100% rename from tests/imports/_partial.scss rename to tests/imports/common/_partial.scss diff --git a/tests/imports/full.scss b/tests/imports/common/full.scss similarity index 100% rename from tests/imports/full.scss rename to tests/imports/common/full.scss diff --git a/tests/imports/other-stuff.scss b/tests/imports/common/other-stuff.scss similarity index 100% rename from tests/imports/other-stuff.scss rename to tests/imports/common/other-stuff.scss diff --git a/tests/imports/imports.scss b/tests/imports/imports.scss new file mode 100644 index 0000000..1379000 --- /dev/null +++ b/tests/imports/imports.scss @@ -0,0 +1,22 @@ +// +// Tests integration of nested imports for full and partial SCSS files. +// + +--- TEST --- + +@import "common/partial" ; + @import "common/full.scss"; + +--- EXPECTED --- + +.partial { + content: 'This is a partial'; +} + +.full { + content: 'This is a full import'; + color: #fff; + background-color : #000; +} + +--- END --- \ No newline at end of file diff --git a/tests/imports/legacy.scss b/tests/imports/legacy.scss new file mode 100644 index 0000000..af3ad7f --- /dev/null +++ b/tests/imports/legacy.scss @@ -0,0 +1,19 @@ +// +// Tests that "legacy" or CSS imports are not handled. +// + +--- TEST --- + +@import "foo.css"; +@import "foo" screen; +@import "http://foo.com/bar"; +@import url(foo); + +--- EXPECTED --- + +@import "foo.css"; +@import "foo" screen; +@import "http://foo.com/bar"; +@import url(foo); + +--- END --- \ No newline at end of file diff --git a/tests/mixins/basic.scss b/tests/mixins/basic.scss new file mode 100644 index 0000000..3793988 --- /dev/null +++ b/tests/mixins/basic.scss @@ -0,0 +1,23 @@ +// +// Tests basic mixin functionality. +// + +--- TEST --- + +@mixin invisible-ink { + color: white; + background-color: white; +} + +body { + @include invisible-ink; +} + +--- EXPECTED --- + +body { + color: white; + background-color: white; +} + +--- END --- \ No newline at end of file diff --git a/tests/mixins/nested.scss b/tests/mixins/nested.scss new file mode 100644 index 0000000..bbca4e2 --- /dev/null +++ b/tests/mixins/nested.scss @@ -0,0 +1,29 @@ +// +// Tests nested mixins. +// + +--- TEST --- + +@mixin invisible-ink { + color: white; + background-color: white; +} + +@mixin invisible-box { + @include invisible-ink; + border: none; +} + +#boxy-mcboxface { + @include invisible-box; +} + +--- EXPECTED --- + +#boxy-mcboxface { + color: white; + background-color: white; + border: none; +} + +--- END --- \ No newline at end of file diff --git a/tests/mixins/params-default.scss b/tests/mixins/params-default.scss new file mode 100644 index 0000000..a9816f1 --- /dev/null +++ b/tests/mixins/params-default.scss @@ -0,0 +1,25 @@ +// +// Tests mixins with default parameters and overrides. +// + +--- TEST --- + +$color-1: black; +$color-2: white; +$color-3: red; + +@mixin gradient-me($color-1: purple, $color-2: black) { + linear-gradient(left, $color-1, $color-2, $color-3); +} + +#rainbox-box { + @include gradient-me(green); +} + +--- EXPECTED --- + +#rainbox-box { + linear-gradient(left, green, black, red); +} + +--- END --- \ No newline at end of file diff --git a/tests/mixins/params.scss b/tests/mixins/params.scss new file mode 100644 index 0000000..06292bf --- /dev/null +++ b/tests/mixins/params.scss @@ -0,0 +1,24 @@ +// +// Tests simple mixin with parameters. +// + +--- TEST --- + +// Simple mixin with parameters. +@mixin paint-it($fg-color, $bg-color) { + color: $fg-color; + background-color: $bg-color; +} + +#black-box { + @include paint-it(black, black); +} + +--- EXPECTED --- + +#black-box { + color: black; + background-color: black; +} + +--- END --- \ No newline at end of file