Script
NAME
Test::Script - Test-run a script
SYNOPSIS
use Test::Script;
output-is "script.p6", "hello: goodbye\n", "Two args ",
args => ["--msg=goodbye", "hello"];
output-like "script.p6, /"hello ā goodbye"/, "Prints environment ",
env => { "hello" => "goodbye" };
variable-ok "script.p6", '$foo', "Variable exists and is set";
variable-is "script.p6", '$foo', <bar baz>, "Variable exists and has value";
DESCRIPTION
This module is intended as a white-box test for scripts. Instead of running them as black boxes, it incorporates them into the current program, allowing better examination of its internal workings.
For the time being, it's just the output, but in the roadmap is the examination of variable values and other dynamic stuff.
CAVEATS
You can't test the same script twice in the same file. As a workaround
(probably temporary), call it under different names such as ./script.p6
or
../dir/script.p6
; alternatively, just use different tests for different
scripts.
AUTHOR
JJ Merelo <[email protected]>
COPYRIGHT AND LICENSE
Copyright 2020,2022 JJ Merelo
This library is free software; you can redistribute it and/or modify it under the Artistic 2.0 license