mod common;
assert_ok! {
simple_tag(
"Foo",
"
Foo
",
);
simple_attribute(
r#"Foo"#,
r#"Foo
"#,
);
attribute_order(
r#"FooBar"#,
r#"FooBar
"#,
);
escaped_attribute(
"Foo",
"Foo
",
);
boolean_attribute(
"Foo",
"Foo
",
);
self_closing(
"
",
"
",
);
doctype(
"",
"\n",
);
auto_close(
"",
"
",
);
short_close(
"Foo>",
"Foo
",
);
block_tag(
"Foo
",
"Foo
",
);
content_kind(
"",
"",
);
content_kind_nested(
"",
"",
);
var_attribute(
"@let(id=`foo`) Foo",
r#"Foo
"#,
);
var_tag_name(
"@let(t=`span`) <$t>Foo>",
"Foo
",
);
template_attribute(
r#"@let(c=`foo`) Foo"#,
r#"Foo
"#,
);
empty_attribute(
"@let(id=.) Foo",
"Foo
",
);
spread_attribute(
"Foo",
r#"Foo
"#,
);
empty_spread_attribute(
"Foo",
"Foo
",
);
anchor_inline(
"Foo",
"Foo
",
);
anchor_block(
"Foo
",
"Foo
",
);
}
assert_matches! {
tag_name(
"@let(t=) $t::tag_name",
"`span`",
);
}
assert_err! {
unclosed_tag(
"",
SyntaxError::TagUnmatchedOpen,
);
unmatched_closing_tag(
"",
SyntaxError::TokenUnmatched,
);
incorrect_closing_tag(
"",
SyntaxError::TagUnmatchedOpen,
);
unclosed_template(
r#"",
SyntaxError::TokenUnmatched,
);
duplicate_attribute(
"Foobar",
SyntaxError::TagDuplicateAttr,
);
invalid_tag_name(
"@let(t=`12345`) <$t>Foobar>",
NameError::InvalidTag,
);
duplicate_attribute_var(
"Foobar",
RuntimeError::AttrMultipleValues,
);
self_closing_with_content(
"@let(tag_name=`img`) <$tag_name>Foo>",
TypeError::NoContentAllowed,
);
}