Handle quotes in feature-exists
This commit is contained in:
parent
f82f1f3eee
commit
e57a189c77
@ -16,7 +16,7 @@ pub(crate) fn register(f: &mut BTreeMap<String, Builtin>) {
|
|||||||
});
|
});
|
||||||
decl!(f "feature-exists", |args| {
|
decl!(f "feature-exists", |args| {
|
||||||
let feature: &Value = arg!(args, 0, "feature");
|
let feature: &Value = arg!(args, 0, "feature");
|
||||||
match feature.to_string().as_str() {
|
match feature.clone().unquote().to_string().as_str() {
|
||||||
// A local variable will shadow a global variable unless
|
// A local variable will shadow a global variable unless
|
||||||
// `!global` is used.
|
// `!global` is used.
|
||||||
"global-variable-shadowing" => Some(Value::False),
|
"global-variable-shadowing" => Some(Value::False),
|
||||||
|
@ -18,3 +18,23 @@ test!(
|
|||||||
"a {\n color: if(false, 1, 2);\n}\n",
|
"a {\n color: if(false, 1, 2);\n}\n",
|
||||||
"a {\n color: 2;\n}\n"
|
"a {\n color: 2;\n}\n"
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
feature_exists_at_error_dbl_quoted,
|
||||||
|
"a {\n color: feature-exists(\"at-error\")\n}\n",
|
||||||
|
"a {\n color: true;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
feature_exists_at_error_sgl_quoted,
|
||||||
|
"a {\n color: feature-exists('at-error')\n}\n",
|
||||||
|
"a {\n color: true;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
feature_exists_at_error_no_quotes,
|
||||||
|
"a {\n color: feature-exists(at-error)\n}\n",
|
||||||
|
"a {\n color: true;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
feature_exists_at_error_named_arg,
|
||||||
|
"a {\n color: feature-exists($feature: at-error)\n}\n",
|
||||||
|
"a {\n color: true;\n}\n"
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user