mirror of
https://github.com/postgres/postgres.git
synced 2026-04-15 22:10:45 -04:00
This commit rewrites a good chunk of the command arrays in TAP tests with a grammar based on the following rules: - Fat commas are used between option names and their values, making it clear to both humans and perltidy that values and names are bound together. This is particularly useful for the readability of multi-line command arrays, and there are plenty of them in the TAP tests. Most of the test code is updated to use this style. Some commands used parenthesis to show the link, or attached values and options in a single string. These are updated to use fat commas instead. - Option names are switched to use their long names, making them more self-documented. Based on a suggestion by Andrew Dunstan. - Add some trailing commas after the last item in multi-line arrays, which is a common perl style. Not all the places are taken care of, but this covers a very good chunk of them. Author: Dagfinn Ilmari Mannsåker Reviewed-by: Michael Paquier, Peter Smith, Euler Taveira Discussion: https://postgr.es/m/87jzc46d8u.fsf@wibble.ilmari.org
42 lines
1.1 KiB
Perl
42 lines
1.1 KiB
Perl
|
|
# Copyright (c) 2021-2025, PostgreSQL Global Development Group
|
|
|
|
use strict;
|
|
use warnings FATAL => 'all';
|
|
use PostgreSQL::Test::Utils;
|
|
use Test::More;
|
|
|
|
my $tempdir = PostgreSQL::Test::Utils::tempdir;
|
|
|
|
program_help_ok('pg_verifybackup');
|
|
program_version_ok('pg_verifybackup');
|
|
program_options_handling_ok('pg_verifybackup');
|
|
|
|
command_fails_like(
|
|
['pg_verifybackup'],
|
|
qr/no backup directory specified/,
|
|
'target directory must be specified');
|
|
command_fails_like(
|
|
[ 'pg_verifybackup', $tempdir ],
|
|
qr/could not open file.*\/backup_manifest\"/,
|
|
'pg_verifybackup requires a manifest');
|
|
command_fails_like(
|
|
[ 'pg_verifybackup', $tempdir, $tempdir ],
|
|
qr/too many command-line arguments/,
|
|
'multiple target directories not allowed');
|
|
|
|
# create fake manifest file
|
|
open(my $fh, '>', "$tempdir/backup_manifest") || die "open: $!";
|
|
close($fh);
|
|
|
|
# but then try to use an alternate, nonexisting manifest
|
|
command_fails_like(
|
|
[
|
|
'pg_verifybackup',
|
|
'--manifest-path' => "$tempdir/not_the_manifest",
|
|
$tempdir,
|
|
],
|
|
qr/could not open file.*\/not_the_manifest\"/,
|
|
'pg_verifybackup respects -m flag');
|
|
|
|
done_testing();
|