From 9cc95455e10389b2137677d3203b00e1eede7a26 Mon Sep 17 00:00:00 2001 From: Andreas Romeyke <andreas.romeyke@slub-dresden.de> Date: Tue, 28 May 2024 13:51:13 +0200 Subject: [PATCH] - added help checks --- t/03-count.t | 11 ++++++++++- t/03-report.t | 12 +++++++++++- t/03-search.t | 12 +++++++++++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/t/03-count.t b/t/03-count.t index bf0dd4d..2f9d420 100644 --- a/t/03-count.t +++ b/t/03-count.t @@ -1,6 +1,6 @@ use v5.36; use Test::Cmd; -use Test::More tests =>18; +use Test::More tests =>27; use Path::Tiny; my $perl = $^X; my $testapp = Test::Cmd->new( @@ -27,6 +27,15 @@ password: 839852bed005a7f1237578a6ac1197c142f7d0dd58bb248446dc7849d4bf770902e7f9 user: lza _CFG_ # tests +note "help check"; +foreach my $param ("help count", "count -h", "count --help") { + $testapp->run(args => $param); + #say "STDOUT:",$testapp->stdout; + #say "STDERR:",$testapp->stderr; + like($testapp->stdout, qr/this usage screen/, "ta-tool $param, stdout"); + like($testapp->stderr, qr/^$/, "ta-tool $param, stderr"); + is($? >> 8, 0, "ta-tool $param, exit status"); +} note "check cli params"; $testapp->run(args =>'count --lzaid SLUB:LZA:goobi:1 --debug'); diff --git a/t/03-report.t b/t/03-report.t index 0e23e2b..f427e87 100644 --- a/t/03-report.t +++ b/t/03-report.t @@ -1,7 +1,7 @@ use v5.36; use Test::Cmd; -use Test::More tests =>6; +use Test::More tests =>15; use Path::Tiny; my $perl = $^X; my $testapp = Test::Cmd->new( @@ -28,6 +28,16 @@ password: 839852bed005a7f1237578a6ac1197c142f7d0dd58bb248446dc7849d4bf770902e7f9 user: lza _CFG_ # tests +note "help check"; +foreach my $param ("help report", "report -h", "report --help") { + $testapp->run(args => $param); + #say "STDOUT:",$testapp->stdout; + #say "STDERR:",$testapp->stderr; + like($testapp->stdout, qr/this usage screen/, "ta-tool $param, stdout"); + like($testapp->stderr, qr/^$/, "ta-tool $param, stderr"); + is($? >> 8, 0, "ta-tool $param, exit status"); +} + note "check cli params"; $testapp->run(args =>'report'); #say "STDOUT:",$testapp->stdout; diff --git a/t/03-search.t b/t/03-search.t index 6a910e4..2c31d00 100644 --- a/t/03-search.t +++ b/t/03-search.t @@ -1,6 +1,6 @@ use v5.36; use Test::Cmd; -use Test::More tests =>99; +use Test::More tests =>108; use Path::Tiny; my $perl = $^X; my $testapp = Test::Cmd->new( @@ -27,6 +27,16 @@ password: 839852bed005a7f1237578a6ac1197c142f7d0dd58bb248446dc7849d4bf770902e7f9 user: lza _CFG_ # tests +note "help check"; +foreach my $param ("help search", "search -h", "search --help") { + $testapp->run(args => $param); + #say "STDOUT:",$testapp->stdout; + #say "STDERR:",$testapp->stderr; + like($testapp->stdout, qr/this usage screen/, "ta-tool $param, stdout"); + like($testapp->stderr, qr/^$/, "ta-tool $param, stderr"); + is($? >> 8, 0, "ta-tool $param, exit status"); +} + note "check cli params"; $testapp->run(args =>'search --lzaid SLUB:LZA:goobi:1 --debug'); #say "STDOUT:",$testapp->stdout; -- GitLab