This fixes #2725, by making it so that `strip_module(Pred, M, P), call(M:P)` doesn't throw an `instanciation_error` when `Pred` isn't in the form `module:predicate`. Now, `strip_module(hello, M, P)` will call `load_context(M)`, which unifies `M` with the topmost module (or `user`). Two new test cases are added: issue2725.pl, which tests the minimal case id(X) --> X. and the strip_module(P, M, _), call(M:P) scenario, and module_resolution, which tests the behavior of strip_module in a few scenarios.
46 lines
1.4 KiB
Rust
46 lines
1.4 KiB
Rust
use crate::helper::load_module_test;
|
|
use serial_test::serial;
|
|
|
|
// issue #831
|
|
#[serial]
|
|
#[test]
|
|
#[cfg_attr(miri, ignore = "it takes too long to run")]
|
|
fn call_0() {
|
|
load_module_test(
|
|
"tests-pl/issue831-call0.pl",
|
|
" error(existence_error(procedure,call/0),call/0).\n",
|
|
);
|
|
}
|
|
|
|
#[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]
|
|
#[cfg_attr(miri, ignore = "it takes too long to run")]
|
|
fn call_qualification() {
|
|
load_module_test("tests-pl/issue2361-call-qualified.pl", "");
|
|
}
|
|
|
|
// PR #2756: ensures that calling load_context with a bound variable doesn't trigger unreachable!()
|
|
#[serial]
|
|
#[test]
|
|
#[cfg_attr(miri, ignore = "it takes too long to run")]
|
|
fn load_context_unreachable() {
|
|
load_module_test("tests-pl/load-context-unreachable.pl", "");
|
|
}
|
|
|
|
// Issue #2725: A dcg of the form `id(X) --> X.` would previously trigger an instantiation
|
|
// error, as it would call `strip_module(X, M, P)` and later `call(M:P)`,
|
|
// but `strip_module` left `M` uninstanciated if the `module:` prefix was unspecified.
|
|
#[serial]
|
|
#[test]
|
|
#[cfg_attr(miri, ignore = "it takes too long to run")]
|
|
fn issue2725_dcg_without_module() {
|
|
load_module_test("tests-pl/issue2725.pl", "");
|
|
}
|