diff options
author | Martin Fischer <martin@push-f.com> | 2023-08-29 12:50:22 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2023-09-28 07:26:44 +0200 |
commit | 9c089bb1eb0fa1b17d0804ff3ee8ed83d6fc77e6 (patch) | |
tree | cc29c0c08a1d053c616c69b12e5b63842fca254d | |
parent | 82961e1f8c85d6961410fd007ca2127cee594848 (diff) |
chore: build html5lib_tests::Output later
This is done separately so that the next commit has a cleaner diff.
-rw-r--r-- | integration_tests/tests/test_html5lib.rs | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/integration_tests/tests/test_html5lib.rs b/integration_tests/tests/test_html5lib.rs index f13e580..0cf5868 100644 --- a/integration_tests/tests/test_html5lib.rs +++ b/integration_tests/tests/test_html5lib.rs @@ -115,10 +115,8 @@ fn run_test_inner<R: Reader>( tokenizer.set_last_start_tag(last_start_tag); } - let mut actual = Output { - errors: Vec::new(), - tokens: Vec::new(), - }; + let mut actual_errors = Vec::new(); + let mut actual_tokens = Vec::new(); while let Some(event) = tokenizer.next() { let token = match event.unwrap() { @@ -130,10 +128,10 @@ fn run_test_inner<R: Reader>( }; match token { - Token::Error { error, .. } => actual.errors.push(TestError { + Token::Error { error, .. } => actual_errors.push(TestError { code: error.code().to_string(), }), - Token::StartTag(tag) => actual.tokens.push(TestToken::StartTag { + Token::StartTag(tag) => actual_tokens.push(TestToken::StartTag { name: tag.name, attributes: tag .attributes @@ -142,10 +140,10 @@ fn run_test_inner<R: Reader>( .collect(), self_closing: tag.self_closing, }), - Token::EndTag(tag) => actual.tokens.push(TestToken::EndTag { name: tag.name }), - Token::String(data) => actual.tokens.push(TestToken::Character(data)), - Token::Comment(comment) => actual.tokens.push(TestToken::Comment(comment.data)), - Token::Doctype(doctype) => actual.tokens.push(TestToken::Doctype { + Token::EndTag(tag) => actual_tokens.push(TestToken::EndTag { name: tag.name }), + Token::String(data) => actual_tokens.push(TestToken::Character(data)), + Token::Comment(comment) => actual_tokens.push(TestToken::Comment(comment.data)), + Token::Doctype(doctype) => actual_tokens.push(TestToken::Doctype { name: doctype.name, public_id: doctype.public_id, system_id: doctype.system_id, @@ -154,5 +152,11 @@ fn run_test_inner<R: Reader>( }; } - assert_eq!(test.output, actual); + assert_eq!( + Output { + errors: actual_errors, + tokens: actual_tokens, + }, + test.output, + ); } |