newlines are no longer replaced with spaces in quoted strings

This commit is contained in:
ConnorSkees 2020-04-20 11:48:17 -04:00
parent 8f27525536
commit 29886d6845
2 changed files with 14 additions and 5 deletions

View File

@ -165,10 +165,14 @@ impl Value {
let mut buf = String::with_capacity(string.len()); let mut buf = String::with_capacity(string.len());
for c in string.chars() { for c in string.chars() {
match c { match c {
'\n' => { // TODO: figure out what is going on here
buf.push(' '); // This is adapted from the original dart-sass
after_newline = true; // code, but in the spec tests it seems that
} // newlines are not actually treated like this.
// '\n' => {
// buf.push(' ');
// after_newline = true;
// }
' ' => { ' ' => {
if !after_newline { if !after_newline {
buf.push(' '); buf.push(' ');

View File

@ -44,7 +44,12 @@ test!(
"a {\n color: a b;\n}\n" "a {\n color: a b;\n}\n"
); );
test!( test!(
interpolated_string_literally_inserted, interpolated_newline,
"a {\n color: \"#{\"\\a\"}\";\n}\n", "a {\n color: \"#{\"\\a\"}\";\n}\n",
"a {\n color: \"\\a\";\n}\n" "a {\n color: \"\\a\";\n}\n"
); );
test!(
double_interpolated_newline,
"a {\n color: \"#{#{\"\\a\"}}\";\n}\n",
"a {\n color: \"\\a\";\n}\n"
);