]> Repositorios git - scryer-prolog.git/commitdiff
move .pl files from tests-pl next to the .toml of the test that uses them
authorSkgland <[email protected]>
Mon, 4 Dec 2023 21:16:04 +0000 (22:16 +0100)
committerBennet Bleßmann <[email protected]>
Mon, 4 Dec 2023 21:16:04 +0000 (22:16 +0100)
14 files changed:
tests-pl/issue812-singleton-warning.pl [deleted file]
tests/scryer/cli/issues/compound_goal.toml
tests/scryer/cli/issues/do_not_duplicate_path_components.stdin
tests/scryer/cli/issues/issue820-goals.pl [moved from tests-pl/issue820-goals.pl with 100% similarity]
tests/scryer/cli/issues/issue839-op3.pl [moved from tests-pl/issue839-op3.pl with 100% similarity]
tests/scryer/cli/issues/issue841-occurs-check.pl [moved from tests-pl/issue841-occurs-check.pl with 100% similarity]
tests/scryer/cli/issues/issue852-throw_e.pl [moved from tests-pl/issue852-throw_e.pl with 100% similarity]
tests/scryer/cli/issues/multiple_goals.toml
tests/scryer/cli/issues/occurs_check_flag.toml
tests/scryer/cli/issues/op3.toml
tests/scryer/cli/issues/singleton_warning.stdin
tests/scryer/helper.rs
tests/scryer/main.rs
tests/scryer/src_tests.rs

diff --git a/tests-pl/issue812-singleton-warning.pl b/tests-pl/issue812-singleton-warning.pl
deleted file mode 100644 (file)
index 9c8673b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-% hello
-% line!
-
-a :- b(X).
\ No newline at end of file
index 354705accccab5d31a267d994c4491c89d3c3852..0ad3236628ca123c077491129003f3200d643b83 100644 (file)
@@ -1,3 +1,3 @@
 # 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
index 8b66cc85102edcebc05711cb63028aebbaa09763..9860cb27c928a0e065ed82a0617d118d29b785e2 100644 (file)
@@ -1,3 +1,3 @@
-['tests-pl/issue852-throw_e.pl'].
-['tests-pl/issue852-throw_e.pl'].
+['tests/scryer/cli/issues/issue852-throw_e.pl'].
+['tests/scryer/cli/issues/issue852-throw_e.pl'].
 halt.
index 3b80d759c93d67ba9e41816d56d27565431a4cf4..5e9c9155bc3b8649197ba0b3175d884affb3726d 100644 (file)
@@ -1,3 +1,3 @@
 # 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
index 89946f05ec80ad8f7c0eb35897256ac49a2cf14b..2754c362dc66a72fa5e7dbc203f79b1c44fca83d 100644 (file)
@@ -1,3 +1,3 @@
 # 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
index 44a9109ff38c19543065d439c395185e7ce2a1f2..cbd1f64c66cd834247b46996af10014ba5e20c93 100644 (file)
@@ -1,3 +1,3 @@
 # 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
index ba37e689a3234672840c14964a7705128d424a45..f82cad20af0d7adb4d153ee6fe9730d740a7b8d7 100644 (file)
@@ -1,2 +1,2 @@
-['tests-pl/issue812-singleton-warning.pl'].
+['tests/scryer/cli/issues/issue812-singleton-warning.pl'].
 halt.
index 623994ff60db387de0c6bf3e9c3e5fb602671138..467a06d1aa56f7a7dfa6dd981fdda5ebd21a987a 100644 (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();
-}
index 8b3fdeb1bdef5272fa3ddf2866899ce696b6d86b..643f8d7160236548002dd2837b47ff3c32597ef6 100644 (file)
@@ -2,10 +2,15 @@ mod helper;
 mod issues;
 mod src_tests;
 
-/// to generate new reference output files into dump/ run `TRYCMD=dump cargo test -- cli_test`
-/// check that the output is as expected, then move them next to the .toml file
+/// To add new cli test copy an existing .toml file in `tests/scryer/cli/issues/` or `tests/scryer/cli/issues/src_tests/`,
+/// 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`
 #[test]
 fn cli_tests() {
index 6b95ee459ea610f6677b186ea51e31aa82078af6..99272686660f7fa588518ce504084a1a8c70a492 100644 (file)
@@ -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;
 
 #[serial]