diff options
author | Markus Unterwaditzer <markus@unterwaditzer.net> | 2021-11-26 18:38:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-26 18:38:58 +0100 |
commit | dced8066f77f570dd3e396ec3570c71aa86c454e (patch) | |
tree | 2fb81d5f411319948c135dfaaa78bc5da6783621 /tests/test_html5lib.rs | |
parent | 029c13426634e58adb3996c9a5e4d79c3e8437f2 (diff) |
Read html from io::BufRead (#8)
Diffstat (limited to 'tests/test_html5lib.rs')
-rw-r--r-- | tests/test_html5lib.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/test_html5lib.rs b/tests/test_html5lib.rs index 36f371a..a29cdc4 100644 --- a/tests/test_html5lib.rs +++ b/tests/test_html5lib.rs @@ -1,4 +1,4 @@ -use html5gum::{Doctype, EndTag, Error, Reader, StartTag, State, StringReader, Token, Tokenizer}; +use html5gum::{Doctype, EndTag, Error, Reader, StartTag, State, Token, Tokenizer}; use pretty_assertions::assert_eq; use serde::{de::Error as _, Deserialize}; use std::{collections::BTreeMap, fs::File, io::BufReader, path::Path}; @@ -230,9 +230,18 @@ fn run_test(fname: &str, test_i: usize, mut test: Test) { test_i, &test, state.0, - Tokenizer::<StringReader>::new(&test.input), + Tokenizer::new(&test.input), "string", ); + + run_test_inner( + fname, + test_i, + &test, + state.0, + Tokenizer::new(BufReader::new(test.input.as_bytes())), + "bufread", + ); } } @@ -256,6 +265,8 @@ fn run_test_inner<R: Reader>( let mut actual_errors = Vec::new(); for token in tokenizer { + let token = token.unwrap(); + if let Token::Error(e) = token { actual_errors.push(ParseError { code: ParseErrorInner(e), |