test for multiline comments in subtraction

This commit is contained in:
ConnorSkees 2020-04-23 19:44:20 -04:00
parent 409ac80921
commit 99ae3ae30a
4 changed files with 15 additions and 4 deletions

View File

@ -8,7 +8,8 @@ use crate::error::SassResult;
use crate::scope::Scope;
use crate::selector::Selector;
use crate::utils::{
devour_whitespace, eat_ident, read_until_closing_curly_brace, read_until_open_curly_brace, devour_whitespace_or_comment
devour_whitespace, devour_whitespace_or_comment, eat_ident, read_until_closing_curly_brace,
read_until_open_curly_brace,
};
use crate::value::Value;
use crate::{Stmt, Token};

View File

@ -52,8 +52,8 @@ pub(crate) fn devour_whitespace_or_comment<I: Iterator<Item = Token>>(
'/' => read_until_newline(toks),
_ => {
toks.reset_view();
return Ok(found_whitespace)
},
return Ok(found_whitespace);
}
};
found_whitespace = true;
continue;

View File

@ -204,3 +204,8 @@ test!(
"a {\n plus-after-minus: 1 - + 2;\n}\n",
"a {\n plus-after-minus: -1;\n}\n"
);
test!(
multiline_comments_between_operands,
"a {\n color: 1/**/-/**/1;\n}\n",
"a {\n color: 0;\n}\n"
);

View File

@ -17,10 +17,15 @@ test!(
);
test!(unary_pos_color, "a {\n color: +\"foo\";\n}\n");
test!(
unary_pos_number,
unary_pos_number_unit,
"a {\n color: +1px;\n}\n",
"a {\n color: 1px;\n}\n"
);
test!(
unary_pos_number,
"a {\n color: +10;\n}\n",
"a {\n color: 10;\n}\n"
);
test!(
unary_pos_in_list,
"a {\n color: bar,+ \"bar\" - foo;\n}\n",