diff --git a/src/machine/system_calls.rs b/src/machine/system_calls.rs index 89ce2272..752ae6b4 100644 --- a/src/machine/system_calls.rs +++ b/src/machine/system_calls.rs @@ -7758,7 +7758,7 @@ impl Machine { .value_to_str_like(self.machine_st.registers[1]) { let document = scraper::Html::parse_document(&string.as_str()); - let result = self.html_node_to_term(document.tree.root()); + let result = self.html_node_to_term(document.tree.root().first_child().unwrap()); unify!(self.machine_st, self.machine_st.registers[2], result); } else { diff --git a/tests-pl/issue2588.pl b/tests-pl/issue2588.pl new file mode 100644 index 00000000..4e87a39a --- /dev/null +++ b/tests-pl/issue2588.pl @@ -0,0 +1,5 @@ +:- use_module(library(sgml)). + +test :- load_html("Hello!", Es, []), write(Es). + +:- initialization(test). \ No newline at end of file diff --git a/tests/scryer/issues.rs b/tests/scryer/issues.rs index 5e21577e..de318708 100644 --- a/tests/scryer/issues.rs +++ b/tests/scryer/issues.rs @@ -12,6 +12,12 @@ fn call_0() { ); } +#[test] +#[cfg_attr(miri, ignore = "unsupported operation when isolation is enabled")] +fn issue2588_load_html() { + load_module_test("tests-pl/issue2588.pl", "[element(html,[],[element(head,[],[element(title,[],[[H,e,l,l,o,!]])]),element(body,[],[])])]"); +} + // issue #2361 #[serial] #[test]