<div>");
+ s.add_test("rcdata in title, character reference", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, "<div>");
expect_token(tokens, StartTagToken{.tag_name = "title"});
expect_text(tokens, "");
expect_token(tokens, EndTagToken{.tag_name = "title"});
@@ -373,94 +374,94 @@ void rcdata_tests() {
// Once a start tag with the tag name "plaintext" has been seen, that will be
// the last token ever seen other than character tokens (and the end-of-file
// token), because there is no way to switch out of the PLAINTEXT state.
-void plaintext_tests() {
- etest::test("plaintext", [] {
- auto tokens = run_tokenizer("", Options{.state_override = State::Plaintext});
+void plaintext_tests(etest::Suite &s) {
+ s.add_test("plaintext", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, "", Options{.state_override = State::Plaintext});
expect_text(tokens, "");
expect_token(tokens, EndOfFileToken{});
});
- etest::test("plaintext, null character", [] {
- auto tokens = run_tokenizer("\0"sv, Options{.state_override = State::Plaintext});
+ s.add_test("plaintext, null character", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, "\0"sv, Options{.state_override = State::Plaintext});
expect_error(tokens, ParseError::UnexpectedNullCharacter);
expect_text(tokens, kReplacementCharacter);
expect_token(tokens, EndOfFileToken{});
});
}
-void source_location_tests() {
- etest::test("src loc: doctype eof", [] {
- auto tokens = run_tokenizer("");
+ s.add_test("end tag open: missing tag name", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, ">");
expect_error(tokens, ParseError::MissingEndTagName);
expect_token(tokens, EndOfFileToken{});
});
}
-void tag_name_tests() {
- etest::test("tag name: eof", [] {
- auto tokens = run_tokenizer("");
+ s.add_test("script, escaped", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, " -->");
expect_token(tokens, StartTagToken{.tag_name = "script"});
expect_text(tokens, ""sv);
+ s.add_test("script, escaped null", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, ""sv);
expect_error(tokens, ParseError::UnexpectedNullCharacter);
expect_token(tokens, StartTagToken{.tag_name = "script"});
@@ -781,8 +783,8 @@ int main() {
expect_token(tokens, EndOfFileToken{});
});
- etest::test("script, escaped one dash", [] {
- auto tokens = run_tokenizer("");
+ s.add_test("script, escaped one dash", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, "");
expect_token(tokens, StartTagToken{.tag_name = "script"});
expect_text(tokens, "");
+ s.add_test("script, escaped upper case", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, " --->");
expect_token(tokens, StartTagToken{.tag_name = "script"});
expect_text(tokens, "");
+ s.add_test("script, escaped dummy tags", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, "");
expect_token(tokens, StartTagToken{.tag_name = "script"});
expect_text(tokens, ""sv);
@@ -839,8 +841,8 @@ int main() {
expect_token(tokens, EndOfFileToken{});
});
- etest::test("script, double escaped", [] {
- auto tokens = run_tokenizer("-->");
+ s.add_test("script, double escaped", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, "-->");
expect_token(tokens, StartTagToken{.tag_name = "script"});
expect_text(tokens, ""sv);
@@ -848,8 +850,8 @@ int main() {
expect_token(tokens, EndOfFileToken{});
});
- etest::test("script, double escaped null", [] {
- auto tokens = run_tokenizer("-->"sv);
+ s.add_test("script, double escaped null", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, "-->"sv);
expect_error(tokens, ParseError::UnexpectedNullCharacter);
expect_token(tokens, StartTagToken{.tag_name = "script"});
@@ -858,8 +860,8 @@ int main() {
expect_token(tokens, EndOfFileToken{});
});
- etest::test("script, double escaped dash", [] {
- auto tokens = run_tokenizer("-->");
+ s.add_test("script, double escaped dash", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, "-->");
expect_token(tokens, StartTagToken{.tag_name = "script"});
expect_text(tokens, ""sv);
@@ -867,8 +869,8 @@ int main() {
expect_token(tokens, EndOfFileToken{});
});
- etest::test("script, double escaped dash null", [] {
- auto tokens = run_tokenizer("-->"sv);
+ s.add_test("script, double escaped dash null", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, "-->"sv);
expect_error(tokens, ParseError::UnexpectedNullCharacter);
expect_token(tokens, StartTagToken{.tag_name = "script"});
@@ -877,8 +879,8 @@ int main() {
expect_token(tokens, EndOfFileToken{});
});
- etest::test("script, double escaped dash dash null", [] {
- auto tokens = run_tokenizer("-->"sv);
+ s.add_test("script, double escaped dash dash null", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, "-->"sv);
expect_error(tokens, ParseError::UnexpectedNullCharacter);
expect_token(tokens, StartTagToken{.tag_name = "script"});
@@ -887,8 +889,8 @@ int main() {
expect_token(tokens, EndOfFileToken{});
});
- etest::test("script, double escaped less than", [] {
- auto tokens = run_tokenizer("-->");
+ s.add_test("script, double escaped less than", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, "-->");
expect_token(tokens, StartTagToken{.tag_name = "script"});
expect_text(tokens, ""sv);
@@ -896,8 +898,8 @@ int main() {
expect_token(tokens, EndOfFileToken{});
});
- etest::test("script, double escaped dash less than", [] {
- auto tokens = run_tokenizer("-->");
+ s.add_test("script, double escaped dash less than", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, "-->");
expect_token(tokens, StartTagToken{.tag_name = "script"});
expect_text(tokens, ""sv);
@@ -905,8 +907,8 @@ int main() {
expect_token(tokens, EndOfFileToken{});
});
- etest::test("script, double escaped dash less than", [] {
- auto tokens = run_tokenizer("");
+ s.add_test("script, double escaped dash less than", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, "");
expect_token(tokens, StartTagToken{.tag_name = "script"});
expect_text(tokens, "-->"sv);
@@ -914,8 +916,8 @@ int main() {
expect_token(tokens, EndOfFileToken{});
});
- etest::test("script, end tag with attribute", [] {
- auto tokens = run_tokenizer(R"()");
+ s.add_test("script, end tag with attribute", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, R"()");
expect_token(tokens, StartTagToken{.tag_name = "script"});
expect_token(tokens, EndTagToken{.tag_name = "script"});
@@ -923,16 +925,16 @@ int main() {
expect_error(tokens, ParseError::EndTagWithAttributes);
});
- etest::test("script, misspelled end tag with attribute", [] {
- auto tokens = run_tokenizer(R"(");
+ s.add_test("script, self closing end tag", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, "");
expect_token(tokens, StartTagToken{.tag_name = "script"});
expect_token(tokens, EndTagToken{.tag_name = "script"});
@@ -940,16 +942,16 @@ int main() {
expect_error(tokens, ParseError::EndTagWithTrailingSolidus);
});
- etest::test("script, misspelled self closing end tag", [] {
- auto tokens = run_tokenizer("");
+ s.add_test("script, escaped end tag open", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, "");
expect_token(tokens, StartTagToken{.tag_name = "script"});
expect_text(tokens, ""sv);
@@ -957,8 +959,8 @@ int main() {
expect_token(tokens, EndOfFileToken{});
});
- etest::test("script, escaped end tag with attributes", [] {
- auto tokens = run_tokenizer(R"(-->)");
+ s.add_test("script, escaped end tag with attributes", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, R"(-->)");
expect_token(tokens, StartTagToken{.tag_name = "script"});
expect_text(tokens, ")");
+ s.add_test("script, misspelled escaped end tag with attributes", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, R"()");
expect_token(tokens, StartTagToken{.tag_name = "script"});
expect_text(tokens, R"()"sv);
@@ -978,8 +980,8 @@ int main() {
expect_token(tokens, EndOfFileToken{});
});
- etest::test("script, escaped self closing end tag", [] {
- auto tokens = run_tokenizer("-->");
+ s.add_test("script, escaped self closing end tag", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, "-->");
expect_token(tokens, StartTagToken{.tag_name = "script"});
expect_text(tokens, "");
+ s.add_test("script, misspelled escaped self closing end tag", [](etest::IActions &a) {
+ auto tokens = run_tokenizer(a, "");
expect_token(tokens, StartTagToken{.tag_name = "script"});
expect_text(tokens, ""sv);
@@ -999,55 +1001,55 @@ int main() {
expect_token(tokens, EndOfFileToken{});
});
- etest::test("script, eof in less than sign", [] {
- auto tokens = run_tokenizer("