diff options
author | Martin Fischer <martin@push-f.com> | 2023-09-12 08:23:52 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2023-09-28 10:36:08 +0200 |
commit | d913e6e91e43241b0105afbbad7db5c5bcda0255 (patch) | |
tree | 35258fc2df6e788315c4572f99e45c9830487738 /integration_tests | |
parent | 852d5c6f2e65a5ab466662ae1c649a0ed25c70a9 (diff) |
feat: implement BasicEmitter
Diffstat (limited to 'integration_tests')
-rw-r--r-- | integration_tests/tests/test_html5lib.rs | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/integration_tests/tests/test_html5lib.rs b/integration_tests/tests/test_html5lib.rs index 42d93f1..3e07531 100644 --- a/integration_tests/tests/test_html5lib.rs +++ b/integration_tests/tests/test_html5lib.rs @@ -6,7 +6,8 @@ use html5lib_tests::{ use html5tokenizer::{ offset::{Offset, PosTrackingReader, Position}, reader::Reader, - CdataAction, Emitter, Error, Event, InternalState, Token, Tokenizer, TracingEmitter, + BasicEmitter, CdataAction, Emitter, Error, Event, InternalState, Token, Tokenizer, + TracingEmitter, }; use similar_asserts::assert_eq; @@ -68,7 +69,26 @@ fn test_tokenizer_file(path: &Path) { fn run_test(fname: &str, test_i: usize, test: Test) { for state in &test.initial_states { - // TODO: test BasicEmitter here once it's implemented + run_test_inner( + fname, + test_i, + &test, + state, + Tokenizer::new(&test.input, BasicEmitter::default()), + "BasicEmitter string", + ); + + run_test_inner( + fname, + test_i, + &test, + state, + Tokenizer::new( + BufReader::new(test.input.as_bytes()), + BasicEmitter::default(), + ), + "BasicEmitter bufread", + ); run_test_inner( fname, @@ -186,6 +206,12 @@ trait DrainErrors<O> { fn drain_errors(&mut self) -> Box<dyn Iterator<Item = (Error, Range<O>)> + '_>; } +impl<O> DrainErrors<O> for BasicEmitter<O> { + fn drain_errors(&mut self) -> Box<dyn Iterator<Item = (Error, Range<O>)> + '_> { + Box::new(self.drain_errors()) + } +} + impl DrainErrors<usize> for TracingEmitter { fn drain_errors(&mut self) -> Box<dyn Iterator<Item = (Error, Range<usize>)> + '_> { Box::new(self.drain_errors()) |