Test
=title class Zef::Service::Shell::Test
=subtitle A raku executable based implementation of the Tester interface
Synopsis
use Zef;
use Zef::Service::Shell::Test;
my $test = Zef::Service::Shell::Test.new;
# Add logging if we want to see output
my $stdout = Supplier.new;
my $stderr = Supplier.new;
$stdout.Supply.tap: { say $_ };
$stderr.Supply.tap: { note $_ };
# Assuming our current directory is a raku distribution
# with no dependencies or all dependencies already installed...
my $dist-to-test = $*CWD;
my Str @includes = $*CWD.absolute;
my $passed = so $test.test($dist-to-test, :@includes, :$stdout, :$stderr);
say $passed ?? "PASS" !! "FAIL";
Description
Tester
class for handling path based URIs ending in .rakutest / .t6 / .t using the raku
command.
You probably never want to use this unless its indirectly through Zef::Test
;
handling files and spawning processes will generally be easier using core language functionality. This
class exists to provide the means for fetching a file using the Tester
interfaces that the e.g. Test/TAP
adapters use.
Methods
method probe
method probe(--> Bool:D)
Returns True
if this module can successfully launch the raku
command (i.e. always returns True
).
method test-matcher
method test-matcher(Str() :uri($) --> Bool:D)
Returns True
if this module knows how to test $uri
. This module always returns True
right now since
it just launches tests directly with the raku
command.
method test
method test(IO() $path, Str :@includes, Supplier :$stdout, Supplier :$stderr --> Bool:D)
Test the files ending in .rakutest
.t6
or .t
in the t/
directory of the given $path
using the
provided @includes
(e.g. /foo/bar
or inst#/foo/bar
) via the raku
command. A Supplier
can be
supplied as :$stdout
and :$stderr
to receive any output.
Returns True
if all test files exited with 0.