From a8141d2488dd2252bcd4940a90a6fe5f0ef06af8 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Sat, 25 Apr 2020 20:19:50 -0400 Subject: [PATCH] handle edge case in parsing of units ending with hypen followed by whitespace --- src/utils/strings.rs | 2 +- tests/subtraction.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/strings.rs b/src/utils/strings.rs index 594f87b..9894d5f 100644 --- a/src/utils/strings.rs +++ b/src/utils/strings.rs @@ -32,9 +32,9 @@ fn ident_body_no_interpolation>( if second.kind == '.' || second.kind.is_ascii_digit() { break; } + toks.next(); text.push('-'); - text.push(toks.next().unwrap().kind); } else if is_name(tok.kind) { text.push(toks.next().unwrap().kind); } else if tok.kind == '\\' { diff --git a/tests/subtraction.rs b/tests/subtraction.rs index de68079..8ad6fb4 100644 --- a/tests/subtraction.rs +++ b/tests/subtraction.rs @@ -209,3 +209,8 @@ test!( "a {\n color: 1/**/-/**/1;\n}\n", "a {\n color: 0;\n}\n" ); +test!( + no_space_after_first_unit_and_second_float, + "a {\n color: 1em- 0.0em;\n}\n", + "a {\n color: 1em- 0em;\n}\n" +);