From 7db57054e1f3e3736c5d85b787a2c7b019a9e9ea Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Sun, 26 Apr 2020 23:11:04 -0400 Subject: [PATCH] emitting get-function is an error --- src/value/mod.rs | 9 +++++++-- tests/get-function.rs | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/value/mod.rs b/src/value/mod.rs index f5c0942..87befa9 100644 --- a/src/value/mod.rs +++ b/src/value/mod.rs @@ -137,8 +137,13 @@ impl Value { ) .into()) } - // TODO: should to_css_string on function fail? - Self::Function(func) => format!("get-function(\"{}\")", func.name()), + Self::Function(..) => { + return Err(( + format!("{} isn't a valid CSS value.", self.inspect(span)?), + span, + ) + .into()) + } Self::List(vals, sep, brackets) => match brackets { Brackets::None => vals .iter() diff --git a/tests/get-function.rs b/tests/get-function.rs index 757b0ec..01297bf 100644 --- a/tests/get-function.rs +++ b/tests/get-function.rs @@ -99,3 +99,8 @@ error!( non_function_call, "a {color: call(4);}", "Error: $function: 4 is not a function reference." ); +error!( + emit_plain_get_function_is_invalid_css, + "a {color: get-function(lighten);}", + "Error: get-function(\"lighten\") isn't a valid CSS value." +);