|
| 1 | +use strict; |
| 2 | +use warnings; |
| 3 | + |
| 4 | +use Config; |
| 5 | +use PostgresNode; |
| 6 | +use TestLib; |
| 7 | +use Test::More tests => 15; |
| 8 | + |
| 9 | +my $tempdir = TestLib::tempdir; |
| 10 | +my $tempdir_short = TestLib::tempdir_short; |
| 11 | + |
| 12 | +######################################### |
| 13 | +# Basic checks |
| 14 | + |
| 15 | +program_help_ok('pg_dump'); |
| 16 | +program_version_ok('pg_dump'); |
| 17 | +program_options_handling_ok('pg_dump'); |
| 18 | + |
| 19 | +######################################### |
| 20 | +# Test various invalid options and disallowed combinations |
| 21 | +# Doesn't require a PG instance to be set up, so do this first. |
| 22 | + |
| 23 | +command_exit_is([ 'pg_dump', 'qqq', 'abc' ], |
| 24 | + 1, 'pg_dump: too many command-line arguments (first is "asd")'); |
| 25 | + |
| 26 | +command_exit_is([ 'pg_dump', '-s', '-a' ], |
| 27 | + 1, 'pg_dump: options -s/--schema-only and -a/--data-only cannot be used together'); |
| 28 | + |
| 29 | +command_exit_is([ 'pg_dump', '-c', '-a' ], |
| 30 | + 1, 'pg_dump: options -c/--clean and -a/--data-only cannot be used together'); |
| 31 | + |
| 32 | +command_exit_is([ 'pg_dump', '--inserts', '-o' ], |
| 33 | + 1, 'pg_dump: options --inserts/--column-inserts and -o/--oids cannot be used together'); |
| 34 | + |
| 35 | +command_exit_is([ 'pg_dump', '--if-exists' ], |
| 36 | + 1, 'pg_dump: option --if-exists requires option -c/--clean'); |
| 37 | + |
| 38 | +command_exit_is([ 'pg_dump', '-j' ], |
| 39 | + 1, 'pg_dump: option requires an argument -- \'j\''); |
| 40 | + |
| 41 | +command_exit_is([ 'pg_dump', '-j3' ], |
| 42 | + 1, 'pg_dump: parallel backup only supported by the directory format'); |
0 commit comments