increase code coverage
This commit is contained in:
parent
593f14e1c0
commit
753c4960ca
@ -54,7 +54,7 @@ pub(crate) trait StylesheetParser<'a>: BaseParser<'a> + Sized {
|
|||||||
| None => Ok(()),
|
| None => Ok(()),
|
||||||
_ => {
|
_ => {
|
||||||
self.expect_char(';')?;
|
self.expect_char(';')?;
|
||||||
Ok(())
|
unreachable!();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1972,6 +1972,11 @@ error!(
|
|||||||
}",
|
}",
|
||||||
"Error: complex selectors may not be extended."
|
"Error: complex selectors may not be extended."
|
||||||
);
|
);
|
||||||
|
error!(
|
||||||
|
extend_at_root_of_document,
|
||||||
|
"@extend a;",
|
||||||
|
"Error: @extend may only be used within style rules."
|
||||||
|
);
|
||||||
|
|
||||||
// todo: extend_loop (massive test)
|
// todo: extend_loop (massive test)
|
||||||
// todo: extend tests in folders
|
// todo: extend tests in folders
|
||||||
|
@ -208,3 +208,11 @@ fn member_import_precedence_top_level() {
|
|||||||
&grass::from_string(input.to_string(), &grass::Options::default().fs(&fs)).expect(input)
|
&grass::from_string(input.to_string(), &grass::Options::default().fs(&fs)).expect(input)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
error!(
|
||||||
|
after_style_rule,
|
||||||
|
r#"
|
||||||
|
a {}
|
||||||
|
@forward "foo";
|
||||||
|
"#,
|
||||||
|
"Error: @forward rules must be written before any other rules."
|
||||||
|
);
|
@ -581,6 +581,42 @@ test!(
|
|||||||
}",
|
}",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
query_is_identifier_and_not_parens,
|
||||||
|
"@media screen and not (foo) {
|
||||||
|
a {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
}",
|
||||||
|
"@media screen and not (foo) {\n a {\n color: red;\n }\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
query_is_identifier_identifier_and_parens,
|
||||||
|
"@media only screen and (foo) {
|
||||||
|
a {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
}",
|
||||||
|
"@media only screen and (foo) {\n a {\n color: red;\n }\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
query_is_paren_and_paren,
|
||||||
|
"@media (foo) and (bar) {
|
||||||
|
a {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
}",
|
||||||
|
"@media (foo) and (bar) {\n a {\n color: red;\n }\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
query_is_paren_or_paren,
|
||||||
|
"@media (foo) or (bar) {
|
||||||
|
a {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
}",
|
||||||
|
"@media (foo) or (bar) {\n a {\n color: red;\n }\n}\n"
|
||||||
|
);
|
||||||
error!(
|
error!(
|
||||||
media_query_has_quoted_closing_paren,
|
media_query_has_quoted_closing_paren,
|
||||||
r#"@media ('a)'w) {
|
r#"@media ('a)'w) {
|
||||||
|
@ -647,6 +647,24 @@ test!(
|
|||||||
}"#,
|
}"#,
|
||||||
".environment-locality {\n var: before;\n var: before;\n}\n"
|
".environment-locality {\n var: before;\n var: before;\n}\n"
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
parses_extend_inside_mixin_not_in_style_rule,
|
||||||
|
"@mixin foo {
|
||||||
|
@extend a;
|
||||||
|
}",
|
||||||
|
""
|
||||||
|
);
|
||||||
|
error!(
|
||||||
|
parses_extend_inside_content_block_not_in_style_rule,
|
||||||
|
"@mixin foo {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include foo {
|
||||||
|
@extend a;
|
||||||
|
}",
|
||||||
|
"Error: @extend may only be used within style rules."
|
||||||
|
);
|
||||||
error!(
|
error!(
|
||||||
mixin_in_function,
|
mixin_in_function,
|
||||||
"@function foo() {
|
"@function foo() {
|
||||||
|
@ -157,6 +157,12 @@ error!(
|
|||||||
"Error: Sass variables aren't allowed in plain CSS.",
|
"Error: Sass variables aren't allowed in plain CSS.",
|
||||||
grass::Options::default().input_syntax(InputSyntax::Css)
|
grass::Options::default().input_syntax(InputSyntax::Css)
|
||||||
);
|
);
|
||||||
|
error!(
|
||||||
|
disallows_variable_decl,
|
||||||
|
"$bar: red;",
|
||||||
|
"Error: Sass variables aren't allowed in plain CSS.",
|
||||||
|
grass::Options::default().input_syntax(InputSyntax::Css)
|
||||||
|
);
|
||||||
error!(
|
error!(
|
||||||
disallows_parent_selector_expr,
|
disallows_parent_selector_expr,
|
||||||
"a {
|
"a {
|
||||||
|
@ -93,6 +93,16 @@ a
|
|||||||
"a {\n color: red;\n}\n",
|
"a {\n color: red;\n}\n",
|
||||||
grass::Options::default().input_syntax(InputSyntax::Sass)
|
grass::Options::default().input_syntax(InputSyntax::Sass)
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
style_rule_begins_with_plus,
|
||||||
|
r#"
|
||||||
|
a
|
||||||
|
+ b
|
||||||
|
color: red
|
||||||
|
"#,
|
||||||
|
"a + b {\n color: red;\n}\n",
|
||||||
|
grass::Options::default().input_syntax(InputSyntax::Sass)
|
||||||
|
);
|
||||||
error!(
|
error!(
|
||||||
multiline_comment_in_value_position,
|
multiline_comment_in_value_position,
|
||||||
r#"
|
r#"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user