move .pl files from tests-pl next to the .toml of the test that uses them

This commit is contained in:
Skgland
2023-12-04 22:16:04 +01:00
committed by Bennet Bleßmann
parent 1c52de9ab1
commit fcf2e2db05
14 changed files with 16 additions and 44 deletions

View File

@@ -1,5 +1,3 @@
use assert_cmd::Command;
use std::ffi::OsStr;
pub(crate) trait Expectable {
#[track_caller]
@@ -34,30 +32,3 @@ pub(crate) fn load_module_test<T: Expectable>(file: &str, expected: T) {
let mut wam = Machine::with_test_streams();
expected.assert_eq(wam.test_load_file(file).as_slice());
}
pub const SCRYER_PROLOG: &str = "scryer-prolog";
/// Test whether scryer-prolog
/// produces the expected output when called with the supplied
/// arguments and fed the supplied input
pub fn run_top_level_test_with_args<
A: IntoIterator<Item = AS>,
S: Into<Vec<u8>>,
O: assert_cmd::assert::IntoOutputPredicate<P>,
AS: AsRef<OsStr>,
P: predicates_core::Predicate<[u8]>,
>(
args: A,
stdin: S,
expected_stdout: O,
) {
Command::cargo_bin(SCRYER_PROLOG)
.unwrap()
.arg("-f")
.arg("--no-add-history")
.args(args)
.write_stdin(stdin)
.assert()
.stdout(expected_stdout.into_output())
.success();
}