diff --git a/src/builtin/string.rs b/src/builtin/string.rs index 298a68a..fdf0eab 100644 --- a/src/builtin/string.rs +++ b/src/builtin/string.rs @@ -45,7 +45,7 @@ pub(crate) fn register(f: &mut BTreeMap) { decl!(f "unquote", |args, _| { max_args!(args, 1); match arg!(args, 0, "string").eval() { - Value::Ident(i, QuoteKind::None) if i.is_empty() => Ok(Value::Null), + Value::Ident(i, _) if i.is_empty() => Ok(Value::Null), i @ Value::Ident(..) => Ok(i.unquote()), v => Err(format!("$string: {} is not a string.", v).into()), } diff --git a/tests/strings.rs b/tests/strings.rs index 15f1a84..c1e9a16 100644 --- a/tests/strings.rs +++ b/tests/strings.rs @@ -93,6 +93,11 @@ test!( "a {\n color: str-length(cde);\n}\n", "a {\n color: 3;\n}\n" ); +test!( + unquote_empty_string_is_null, + "a {\n color: unquote('');\n}\n", + "" +); // blocked on refactoring how function-call args are parsed // right now, whitespace is eaten between idents with no // regard for quotes