added tests for trailing commas and css imports
This commit is contained in:
parent
428599f091
commit
745fbc4e95
@ -105,6 +105,38 @@ fn comma_separated_import_order() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn comma_separated_import_order_css() {
|
||||||
|
let input =
|
||||||
|
"@import 'comma_separated_import_order1.css', 'comma_separated_import_order2', url(third);";
|
||||||
|
tempfile!("comma_separated_import_order1.css", "p { color: red; }");
|
||||||
|
tempfile!("comma_separated_import_order2", "p { color: blue; }");
|
||||||
|
assert_eq!(
|
||||||
|
"@import \"comma_separated_import_order1.css\";\n\np {\n color: blue;\n}\n@import url(third);\n",
|
||||||
|
&grass::from_string(input.to_string(), &grass::Options::default()).expect(input)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn comma_separated_import_trailing() {
|
||||||
|
let input =
|
||||||
|
"@import 'comma_separated_import_trailing1', 'comma_separated_import_trailing2', url(third),,,,,,,,;";
|
||||||
|
tempfile!("comma_separated_import_trailing1", "p { color: red; }");
|
||||||
|
tempfile!("comma_separated_import_trailing2", "p { color: blue; }");
|
||||||
|
|
||||||
|
match grass::from_string(input.to_string(), &grass::Options::default()) {
|
||||||
|
Ok(..) => panic!("did not fail"),
|
||||||
|
Err(e) => assert_eq!(
|
||||||
|
"Error: Expected expression.",
|
||||||
|
e.to_string()
|
||||||
|
.chars()
|
||||||
|
.take_while(|c| *c != '\n')
|
||||||
|
.collect::<String>()
|
||||||
|
.as_str()
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn finds_name_scss() {
|
fn finds_name_scss() {
|
||||||
let input = "@import \"finds_name_scss\";\na {\n color: $a;\n}";
|
let input = "@import \"finds_name_scss\";\na {\n color: $a;\n}";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user