Skip to content

Commit

Permalink
Merge pull request #2596 from Skgland/issue-2588
Browse files Browse the repository at this point in the history
fix issue #2588
  • Loading branch information
mthom authored Oct 6, 2024
2 parents 2f47343 + 6dd0ec0 commit 9785a04
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/machine/system_calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions tests-pl/issue2588.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:- use_module(library(sgml)).

test :- load_html("<html><head><title>Hello!</title></head></html>", Es, []), write(Es).

:- initialization(test).
6 changes: 6 additions & 0 deletions tests/scryer/issues.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 9785a04

Please sign in to comment.