From 08ab3261b14de5231cbc1ee1432eb1786a94e9bf Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Mon, 6 Jan 2020 18:52:37 -0500 Subject: [PATCH] Add more tests for variables --- src/format.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/format.rs b/src/format.rs index 0636ea0..e857bb2 100644 --- a/src/format.rs +++ b/src/format.rs @@ -99,7 +99,7 @@ mod test_scss { #[test] fn $func() { let mut buf = Vec::new(); - StyleSheet::new($input) + StyleSheet::new($input).expect(concat!("failed to parse on ", $input)) .pretty_print(&mut buf) .expect(concat!("failed to pretty print on ", $input)); assert_eq!( @@ -112,7 +112,7 @@ mod test_scss { #[test] fn $func() { let mut buf = Vec::new(); - StyleSheet::new($input) + StyleSheet::new($input).expect(concat!("failed to parse on ", $input)) .pretty_print(&mut buf) .expect(concat!("failed to pretty print on ", $input)); assert_eq!( @@ -211,11 +211,21 @@ mod test_scss { "$a: 1px;\n$b: $a;\na {\n height: $b;\n}\n", "a {\n height: 1px;\n}\n" ); + test!( + variable_shadowing_val_does_not_change, + "$a: 1px;\n$b: $a; $a: 2px;\na {\n height: $b;\n}\n", + "a {\n height: 1px;\n}\n" + ); test!( variable_whitespace, "$a : 1px ;\na {\n height: $a;\n}\n", "a {\n height: 1px;\n}\n" ); + test!( + style_after_variable, + "$a: 1px;\na {\n height: $a;\n color: red;\n}\n", + "a {\n height: 1px;\n color: red;\n}\n" + ); test!( literal_and_variable_as_val, "$a: 1px;\na {\n height: 1 $a;\n}\n",