From: bakaq Date: Thu, 21 Sep 2023 15:14:27 +0000 (-0300) Subject: Run dif tests on cargo test X-Git-Tag: remove~93^2~1 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=cac52c05376b8d1701c81cc5f631913ed2b412c5;p=scryer-prolog.git Run dif tests on cargo test --- diff --git a/tests-pl/dif_tests.pl b/src/tests/dif.pl similarity index 91% rename from tests-pl/dif_tests.pl rename to src/tests/dif.pl index 01ece5fa..752458b5 100644 --- a/tests-pl/dif_tests.pl +++ b/src/tests/dif.pl @@ -195,6 +195,15 @@ main :- show_failed(Failed), halt. +main_quiet :- + findall(test(Name, Goal), test(Name, Goal), Tests), + run_tests_quiet(Tests, Failed), + ( Failed = [] -> + format("All tests passed", []) + ; format("Some tests failed", []) + ), + halt. + portray_failed_([]) --> []. portray_failed_([F|Fs]) --> "\"", F, "\"", "\n", portray_failed_(Fs). @@ -217,6 +226,14 @@ run_tests([test(Name, Goal)|Tests], Failed) :- ), run_tests(Tests, Failed1). +run_tests_quiet([], []). +run_tests_quiet([test(Name, Goal)|Tests], Failed) :- + ( call(Goal) -> + Failed = Failed1 + ; Failed = [Name|Failed1] + ), + run_tests_quiet(Tests, Failed1). + assert_p(A, B) :- phrase(portray_clause_(A), Portrayed), phrase((B, ".\n"), Portrayed). diff --git a/tests/scryer/src_tests.rs b/tests/scryer/src_tests.rs index f913788e..5572b75f 100644 --- a/tests/scryer/src_tests.rs +++ b/tests/scryer/src_tests.rs @@ -75,3 +75,12 @@ fn clpz_load() { fn iso_conformity_tests() { load_module_test("tests-pl/iso-conformity-tests.pl", "All tests passed"); } + +#[test] +fn dif_tests() { + run_top_level_test_with_args( + &["src/tests/dif.pl", "-f", "-g", "main_quiet"], + "", + "All tests passed", + ); +}