Add basic tests for functions

This commit is contained in:
ConnorSkees 2020-01-25 20:59:16 -05:00
parent 199d108213
commit e0026d5e11

View File

@ -458,11 +458,7 @@ mod test_mixins {
"@mixin a {\n color: red;\n}\n\nb {\n @include a;\n}\n", "@mixin a {\n color: red;\n}\n\nb {\n @include a;\n}\n",
"b {\n color: red;\n}\n" "b {\n color: red;\n}\n"
); );
test!( test!(empty_mixin, "@mixin a {}\n\nb {\n @include a;\n}\n", "");
empty_mixin,
"@mixin a {}\n\nb {\n @include a;\n}\n",
""
);
test!( test!(
mixin_two_styles, mixin_two_styles,
"@mixin a {\n color: red;\n color: blue;\n}\n\nb {\n @include a;\n}\n", "@mixin a {\n color: red;\n color: blue;\n}\n\nb {\n @include a;\n}\n",
@ -644,3 +640,28 @@ mod test_values {
"a {\n color: 1 red blue;\n}\n" "a {\n color: 1 red blue;\n}\n"
); );
} }
#[cfg(test)]
mod test_functions {
use super::*;
test!(
return_num,
"@function a() {\n @return 1;\n}\n\nb {\ncolor: a();\n}\n",
"b {\n color: 1;\n}\n"
);
test!(
return_spaced_list,
"@function a() {\n @return a b;\n}\n\nb {\ncolor: a();\n}\n",
"b {\n color: a b;\n}\n"
);
test!(
single_arg,
"@function a($c) {\n @return $c;\n}\n\nb {\ncolor: a(1);\n}\n",
"b {\n color: 1;\n}\n"
);
// test!(
// return_no_semicolon,
// "@function a() {\n @return 1\n}\n\nb {\ncolor: a();\n}\n",
// "b {\n color: 1;\n}\n"
// );
}