From 991b87f33500c803f8fc57c1784beb35bdb54b6c Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Mon, 23 Mar 2020 14:16:27 -0400 Subject: [PATCH] str-slice start/end equality does not preclude output --- src/builtin/string.rs | 2 +- tests/strings.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/builtin/string.rs b/src/builtin/string.rs index 1330781..d16aa26 100644 --- a/src/builtin/string.rs +++ b/src/builtin/string.rs @@ -111,7 +111,7 @@ pub(crate) fn register(f: &mut HashMap) { end = str_len; } - if start >= end || start > str_len { + if start > end || start > str_len { Ok(Value::Ident(String::new(), quotes.normalize())) } else { let s = string[start - 1..end].to_string(); diff --git a/tests/strings.rs b/tests/strings.rs index f6928b4..84e4fec 100644 --- a/tests/strings.rs +++ b/tests/strings.rs @@ -93,6 +93,11 @@ test!( "a {\n color: str-slice($string: \"foo\", $start-at: 99999999999999999999, $end-at: -99999999999999999999);\n}\n", "a {\n color: \"\";\n}\n" ); +test!( + str_slice_start_end_equal, + "a {\n color: str-slice(\"cde\", 1, 1);\n}\n", + "a {\n color: \"c\";\n}\n" +); test!( str_len_dbl_quotes, "a {\n color: str-length(\"cde\");\n}\n",