Add more tests for variables
This commit is contained in:
parent
bcfd809c92
commit
08ab3261b1
@ -99,7 +99,7 @@ mod test_scss {
|
|||||||
#[test]
|
#[test]
|
||||||
fn $func() {
|
fn $func() {
|
||||||
let mut buf = Vec::new();
|
let mut buf = Vec::new();
|
||||||
StyleSheet::new($input)
|
StyleSheet::new($input).expect(concat!("failed to parse on ", $input))
|
||||||
.pretty_print(&mut buf)
|
.pretty_print(&mut buf)
|
||||||
.expect(concat!("failed to pretty print on ", $input));
|
.expect(concat!("failed to pretty print on ", $input));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@ -112,7 +112,7 @@ mod test_scss {
|
|||||||
#[test]
|
#[test]
|
||||||
fn $func() {
|
fn $func() {
|
||||||
let mut buf = Vec::new();
|
let mut buf = Vec::new();
|
||||||
StyleSheet::new($input)
|
StyleSheet::new($input).expect(concat!("failed to parse on ", $input))
|
||||||
.pretty_print(&mut buf)
|
.pretty_print(&mut buf)
|
||||||
.expect(concat!("failed to pretty print on ", $input));
|
.expect(concat!("failed to pretty print on ", $input));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@ -211,11 +211,21 @@ mod test_scss {
|
|||||||
"$a: 1px;\n$b: $a;\na {\n height: $b;\n}\n",
|
"$a: 1px;\n$b: $a;\na {\n height: $b;\n}\n",
|
||||||
"a {\n height: 1px;\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!(
|
test!(
|
||||||
variable_whitespace,
|
variable_whitespace,
|
||||||
"$a : 1px ;\na {\n height: $a;\n}\n",
|
"$a : 1px ;\na {\n height: $a;\n}\n",
|
||||||
"a {\n height: 1px;\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!(
|
test!(
|
||||||
literal_and_variable_as_val,
|
literal_and_variable_as_val,
|
||||||
"$a: 1px;\na {\n height: 1 $a;\n}\n",
|
"$a: 1px;\na {\n height: 1 $a;\n}\n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user