You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-15 01:04:37 +02:00
Fixed issue #132: Improved command-line help.
Some platform specific fixes and added regression tests to detect issues.
This commit is contained in:
81
test/lib/BackRestTest/HelpTest.pm
Normal file
81
test/lib/BackRestTest/HelpTest.pm
Normal file
@ -0,0 +1,81 @@
|
||||
#!/usr/bin/perl
|
||||
####################################################################################################################################
|
||||
# HelpTest.pm - Unit Tests for help
|
||||
####################################################################################################################################
|
||||
package BackRestTest::HelpTest;
|
||||
|
||||
####################################################################################################################################
|
||||
# Perl includes
|
||||
####################################################################################################################################
|
||||
use strict;
|
||||
use warnings FATAL => qw(all);
|
||||
use Carp qw(confess);
|
||||
|
||||
use Exporter qw(import);
|
||||
use File::Basename qw(dirname);
|
||||
|
||||
use lib dirname($0) . '/../lib';
|
||||
use BackRest::Common::Log;
|
||||
use BackRest::Config::Config;
|
||||
|
||||
use BackRestTest::CommonTest;
|
||||
|
||||
####################################################################################################################################
|
||||
# BackRestTestHelp_ExecuteHelp
|
||||
####################################################################################################################################
|
||||
sub BackRestTestHelp_ExecuteHelp
|
||||
{
|
||||
my $strCommand = shift;
|
||||
|
||||
BackRestTestCommon_Execute(BackRestTestCommon_CommandMainAbsGet() . ' --no-config ' . $strCommand);
|
||||
}
|
||||
|
||||
####################################################################################################################################
|
||||
# BackRestTestHelp_Test
|
||||
####################################################################################################################################
|
||||
our @EXPORT = qw(BackRestTestHelp_Test);
|
||||
|
||||
sub BackRestTestHelp_Test
|
||||
{
|
||||
my $strTest = shift;
|
||||
|
||||
# Setup test variables
|
||||
my $iRun;
|
||||
my $strModule = 'help';
|
||||
|
||||
# Print test banner
|
||||
&log(INFO, 'HELP MODULE *****************************************************************');
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------------------------------
|
||||
# Test config
|
||||
#-------------------------------------------------------------------------------------------------------------------------------
|
||||
my $strThisTest = 'help';
|
||||
|
||||
if ($strTest eq 'all' || $strTest eq $strThisTest)
|
||||
{
|
||||
$iRun = 0;
|
||||
|
||||
&log(INFO, "Test help\n");
|
||||
|
||||
BackRestTestCommon_Drop(true);
|
||||
BackRestTestCommon_Create();
|
||||
|
||||
# Increment the run, log, and decide whether this unit test should be run
|
||||
if (BackRestTestCommon_Run(++$iRun, 'base', $strModule, $strThisTest, undef, false))
|
||||
{
|
||||
BackRestTestHelp_ExecuteHelp('help');
|
||||
BackRestTestHelp_ExecuteHelp('help version');
|
||||
BackRestTestHelp_ExecuteHelp('help --output=json --stanza=main info');
|
||||
BackRestTestHelp_ExecuteHelp('help --output=json --stanza=main info output');
|
||||
}
|
||||
|
||||
# Cleanup
|
||||
if (BackRestTestCommon_Cleanup())
|
||||
{
|
||||
&log(INFO, 'cleanup');
|
||||
BackRestTestCommon_Drop(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
Reference in New Issue
Block a user