Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc0280bc

Browse files
committed
psql: More tests
Add some basic tests for command-line option handling and help output,similar to what we have for other command-line programs. This alsocreates a place to put some more one-off test cases later.Discussion:https://www.postgresql.org/message-id/2570e2ae-fa0f-aac9-f72f-bb59a9983a20@enterprisedb.com
1 parentf9c4cb6 commitc0280bc

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

‎src/bin/psql/t/001_basic.pl

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
# Copyright (c) 2021, PostgreSQL Global Development Group
3+
4+
use strict;
5+
use warnings;
6+
7+
use PostgresNode;
8+
use TestLib;
9+
use Test::Moretests=> 23;
10+
11+
program_help_ok('psql');
12+
program_version_ok('psql');
13+
program_options_handling_ok('psql');
14+
15+
my ($stdout,$stderr);
16+
my$result;
17+
18+
# test --help=foo, analogous to program_help_ok()
19+
foreachmy$arg (qw(commands variables))
20+
{
21+
$result = IPC::Run::run ['psql',"--help=$arg" ],'>', \$stdout,'2>', \$stderr;
22+
ok($result,"psql --help=$arg exit code 0");
23+
isnt($stdout,'',"psql --help=$arg goes to stdout");
24+
is($stderr,'',"psql --help=$arg nothing to stderr");
25+
}
26+
27+
my$node = PostgresNode->new('main');
28+
$node->init;
29+
$node->start;
30+
31+
$node->command_like(['psql','-c','\copyright' ],qr/Copyright/,'\copyright');
32+
$node->command_like(['psql','-c','\help' ],qr/ALTER/,'\help without arguments');
33+
$node->command_like(['psql','-c','\help SELECT' ],qr/SELECT/,'\help');

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp