move .pl files from tests-pl next to the .toml of the test that uses them
This commit is contained in:
@@ -1,4 +0,0 @@
|
|||||||
% hello
|
|
||||||
% line!
|
|
||||||
|
|
||||||
a :- b(X).
|
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
# issue 820
|
# issue 820
|
||||||
args = ["-f", "--no-add-history", "-g", "test,halt", "tests-pl/issue820-goals.pl"]
|
args = ["-f", "--no-add-history", "-g", "test,halt", "tests/scryer/cli/issues/issue820-goals.pl"]
|
||||||
binary = true
|
binary = true
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
['tests-pl/issue852-throw_e.pl'].
|
['tests/scryer/cli/issues/issue852-throw_e.pl'].
|
||||||
['tests-pl/issue852-throw_e.pl'].
|
['tests/scryer/cli/issues/issue852-throw_e.pl'].
|
||||||
halt.
|
halt.
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
# issue 820
|
# issue 820
|
||||||
args = ["-f", "--no-add-history", "-g", "test", "-g", "halt", "tests-pl/issue820-goals.pl"]
|
args = ["-f", "--no-add-history", "-g", "test", "-g", "halt", "tests/scryer/cli/issues/issue820-goals.pl"]
|
||||||
binary = true
|
binary = true
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
# issue 841
|
# issue 841
|
||||||
args = ["-f", "--no-add-history", "tests-pl/issue841-occurs-check.pl"]
|
args = ["-f", "--no-add-history", "tests/scryer/cli/issues/issue841-occurs-check.pl"]
|
||||||
binary = true
|
binary = true
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
# issue 839
|
# issue 839
|
||||||
args = ["-f", "--no-add-history", "tests-pl/issue839-op3.pl", "-g", "halt"]
|
args = ["-f", "--no-add-history", "tests/scryer/cli/issues/issue839-op3.pl", "-g", "halt"]
|
||||||
binary = true
|
binary = true
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
['tests-pl/issue812-singleton-warning.pl'].
|
['tests/scryer/cli/issues/issue812-singleton-warning.pl'].
|
||||||
halt.
|
halt.
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
use assert_cmd::Command;
|
|
||||||
use std::ffi::OsStr;
|
|
||||||
|
|
||||||
pub(crate) trait Expectable {
|
pub(crate) trait Expectable {
|
||||||
#[track_caller]
|
#[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();
|
let mut wam = Machine::with_test_streams();
|
||||||
expected.assert_eq(wam.test_load_file(file).as_slice());
|
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();
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -2,10 +2,15 @@ mod helper;
|
|||||||
mod issues;
|
mod issues;
|
||||||
mod src_tests;
|
mod src_tests;
|
||||||
|
|
||||||
/// to generate new reference output files into dump/ run `TRYCMD=dump cargo test -- cli_test`
|
/// To add new cli test copy an existing .toml file in `tests/scryer/cli/issues/` or `tests/scryer/cli/issues/src_tests/`,
|
||||||
/// check that the output is as expected, then move them next to the .toml file
|
/// adjust as necessary the `-f` and `--no-add-history` args should be kept but additional args may be added.
|
||||||
|
/// For input on stdin add a .stdin file with the same filename.
|
||||||
|
/// Then to generate new reference output files into dump/ run `TRYCMD=dump cargo test -- cli_test`
|
||||||
|
/// check that the output in the .stdout and .stderr file is as expected, then move them next to the .toml file.
|
||||||
///
|
///
|
||||||
/// to re-generate reference output files run `TRYCMD=overwrite cargo test -- cli_test`
|
/// If a test does not have a .stderr or .stdout the corresponding output is ignored i.e. any and no output is accepted
|
||||||
|
///
|
||||||
|
/// to re-generate all reference output files run `TRYCMD=overwrite cargo test -- cli_test`
|
||||||
/// then check that the changes are as expected e.g. by looking at the `git diff`
|
/// then check that the changes are as expected e.g. by looking at the `git diff`
|
||||||
#[test]
|
#[test]
|
||||||
fn cli_tests() {
|
fn cli_tests() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use crate::helper::{load_module_test, run_top_level_test_with_args};
|
use crate::helper::load_module_test;
|
||||||
use serial_test::serial;
|
use serial_test::serial;
|
||||||
|
|
||||||
#[serial]
|
#[serial]
|
||||||
|
|||||||
Reference in New Issue
Block a user