str-slice start/end equality does not preclude output
This commit is contained in:
parent
893c758e13
commit
991b87f335
@ -111,7 +111,7 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
|
|||||||
end = str_len;
|
end = str_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
if start >= end || start > str_len {
|
if start > end || start > str_len {
|
||||||
Ok(Value::Ident(String::new(), quotes.normalize()))
|
Ok(Value::Ident(String::new(), quotes.normalize()))
|
||||||
} else {
|
} else {
|
||||||
let s = string[start - 1..end].to_string();
|
let s = string[start - 1..end].to_string();
|
||||||
|
@ -93,6 +93,11 @@ test!(
|
|||||||
"a {\n color: str-slice($string: \"foo\", $start-at: 99999999999999999999, $end-at: -99999999999999999999);\n}\n",
|
"a {\n color: str-slice($string: \"foo\", $start-at: 99999999999999999999, $end-at: -99999999999999999999);\n}\n",
|
||||||
"a {\n color: \"\";\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!(
|
test!(
|
||||||
str_len_dbl_quotes,
|
str_len_dbl_quotes,
|
||||||
"a {\n color: str-length(\"cde\");\n}\n",
|
"a {\n color: str-length(\"cde\");\n}\n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user