From e0026d5e11873a22b59cab76de265acc1aef3ad0 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Sat, 25 Jan 2020 20:59:16 -0500 Subject: [PATCH] Add basic tests for functions --- tests/main.rs | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/tests/main.rs b/tests/main.rs index a1487c1..2cc7cba 100644 --- a/tests/main.rs +++ b/tests/main.rs @@ -458,11 +458,7 @@ mod test_mixins { "@mixin a {\n color: red;\n}\n\nb {\n @include a;\n}\n", "b {\n color: red;\n}\n" ); - test!( - empty_mixin, - "@mixin a {}\n\nb {\n @include a;\n}\n", - "" - ); + test!(empty_mixin, "@mixin a {}\n\nb {\n @include a;\n}\n", ""); test!( mixin_two_styles, "@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" ); } + +#[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" + // ); +}