From 2240035e20a5f4e6c621720fd8cd9536b584b338 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 19 Feb 2021 17:04:19 -0500 Subject: [PATCH] Run tests with yath This will let us run tests in parallel, and creates a more Perl-standard test development experience. --- flake.nix | 2 ++ tests/Makefile.am | 2 +- tests/{evaluation-tests.pl => evaluation.t} | 0 tests/{ => lib}/Setup.pm | 0 tests/test.pl | 24 +++++++++++++++++++++ 5 files changed, 27 insertions(+), 1 deletion(-) rename tests/{evaluation-tests.pl => evaluation.t} (100%) rename tests/{ => lib}/Setup.pm (100%) create mode 100644 tests/test.pl diff --git a/flake.nix b/flake.nix index de4f29c5..08783bbc 100644 --- a/flake.nix +++ b/flake.nix @@ -126,6 +126,7 @@ EmailMIME EmailSender FileSlurp + FileWhich IOCompress IPCRun JSON @@ -145,6 +146,7 @@ TermSizeAny TestMore TextDiff + Test2Harness TextTable XMLSimple YAML diff --git a/tests/Makefile.am b/tests/Makefile.am index b0881bce..f5a92239 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -26,7 +26,7 @@ EXTRA_DIST = \ TESTS = \ set-up.pl \ - evaluation-tests.pl \ + test.pl \ tear-down.pl check_SCRIPTS = repos diff --git a/tests/evaluation-tests.pl b/tests/evaluation.t similarity index 100% rename from tests/evaluation-tests.pl rename to tests/evaluation.t diff --git a/tests/Setup.pm b/tests/lib/Setup.pm similarity index 100% rename from tests/Setup.pm rename to tests/lib/Setup.pm diff --git a/tests/test.pl b/tests/test.pl new file mode 100644 index 00000000..fc5b215a --- /dev/null +++ b/tests/test.pl @@ -0,0 +1,24 @@ +#!/usr/bin/env perl +# HARNESS-NO-PRELOAD +# HARNESS-CAT-LONG +# THIS IS A GENERATED YATH RUNNER TEST +use strict; +use warnings; + +use lib 'lib'; +BEGIN { + use File::Which qw(which); + $App::Yath::Script::SCRIPT = which 'yath'; +} +use App::Yath::Util qw/find_yath/; + +system($^X, find_yath(), '-D', 'test', '--default-search' => './', @ARGV); +my $exit = $?; + +# This makes sure it works with prove. +print "1..1\n"; +print "not " if $exit; +print "ok 1 - Passed tests when run by yath\n"; +print STDERR "yath exited with $exit" if $exit; + +exit($exit ? 255 : 0);