aboutsummaryrefslogtreecommitdiff
path: root/integration_tests
diff options
context:
space:
mode:
Diffstat (limited to 'integration_tests')
-rw-r--r--integration_tests/tests/test_html5lib.rs30
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())