From 8a600a4f0768dc244c25507d704f028747eb3e95 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Tue, 31 Mar 2020 01:52:52 -0400 Subject: [PATCH] implement number minus ident --- src/value/ops.rs | 3 +++ tests/subtraction.rs | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/value/ops.rs b/src/value/ops.rs index fbcccdd..2d153de 100644 --- a/src/value/ops.rs +++ b/src/value/ops.rs @@ -120,6 +120,9 @@ impl Sub for Value { Self::List(..) => { Value::Ident(format!("{}{}-{}", num, unit, other), QuoteKind::None) } + Self::Ident(..) => { + Value::Ident(format!("{}{}-{}", num, unit, other), QuoteKind::None) + } _ => todo!(), }, Self::Color(c) => match other { diff --git a/tests/subtraction.rs b/tests/subtraction.rs index 7b14e01..e43729f 100644 --- a/tests/subtraction.rs +++ b/tests/subtraction.rs @@ -153,3 +153,18 @@ test!( "a {\n color: 'foo' - 1px;\n}\n", "a {\n color: \"foo\"-1px;\n}\n" ); +test!( + number_minus_unquoted_ident, + "a {\n color: 1 - foo;\n}\n", + "a {\n color: 1-foo;\n}\n" +); +test!( + number_minus_sglquoted_ident, + "a {\n color: 1 - 'foo';\n}\n", + "a {\n color: 1-\"foo\";\n}\n" +); +test!( + number_minus_dblquoted_ident, + "a {\n color: 1 - \"foo\";\n}\n", + "a {\n color: 1-\"foo\";\n}\n" +);