grass/tests/keywords.rs
Connor Skees ffaee04613
rewrite parsing, evaluation, and serialization (#67)
Adds support for the indented syntax, plain CSS imports, `@forward`, and many other previously missing features.
2022-12-26 15:33:04 -05:00

48 lines
903 B
Rust

#[macro_use]
mod macros;
test!(
basic_keywords,
"@function foo($args...) {
@return inspect(keywords($args));
}
a {
color: foo($a: 1, $b: 2, $c: 3);
}",
"a {\n color: (a: 1, b: 2, c: 3);\n}\n"
);
test!(
access_keywords_in_variable,
"@function foo($args...) {
$a: keywords($args);
@return 2;
}
a {
color: foo($a: 1, $b: 2, $c: 3);
}",
"a {\n color: 2;\n}\n"
);
error!(
keywords_not_accessed,
"@function foo($args...) {
@return 2;
}
a {
color: foo($a: 1, $b: 2, $c: 3);
}",
"Error: No arguments named $a, $b or $c."
);
test!(
keywords_in_meta_module,
r#"
@use "sass:meta";
@function foo($args...) {
@return inspect(meta.keywords($args));
}
a {
color: foo($a: 1, $b: 2, $c: 3);
}"#,
"a {\n color: (a: 1, b: 2, c: 3);\n}\n"
);