From ce1b0f9da03e1cebc293f60b378079b22bd7cc0f Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Wed, 22 Jan 2025 14:47:13 +0900 Subject: Improve grammar of options for command arrays in TAP tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/bin/scripts/t/011_clusterdb_all.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/bin/scripts/t/011_clusterdb_all.pl') diff --git a/src/bin/scripts/t/011_clusterdb_all.pl b/src/bin/scripts/t/011_clusterdb_all.pl index beaf2930f0e..cf06c8c1f8e 100644 --- a/src/bin/scripts/t/011_clusterdb_all.pl +++ b/src/bin/scripts/t/011_clusterdb_all.pl @@ -15,7 +15,7 @@ $node->start; # clusterdb -a is not compatible with -d. This relies on PGDATABASE to be # set, something PostgreSQL::Test::Cluster does. $node->issues_sql_like( - [ 'clusterdb', '-a' ], + [ 'clusterdb', '--all' ], qr/statement: CLUSTER.*statement: CLUSTER/s, 'cluster all databases'); @@ -24,13 +24,13 @@ $node->safe_psql( CREATE DATABASE regression_invalid; UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'; )); -$node->command_ok([ 'clusterdb', '-a' ], +$node->command_ok([ 'clusterdb', '--all' ], 'invalid database not targeted by clusterdb -a'); # Doesn't quite belong here, but don't want to waste time by creating an # invalid database in 010_clusterdb.pl as well. $node->command_fails_like( - [ 'clusterdb', '-d', 'regression_invalid' ], + [ 'clusterdb', '--dbname' => 'regression_invalid' ], qr/FATAL: cannot connect to invalid database "regression_invalid"/, 'clusterdb cannot target invalid database'); @@ -41,7 +41,7 @@ $node->safe_psql('template1', 'CREATE TABLE test1 (a int); CREATE INDEX test1x ON test1 (a); CLUSTER test1 USING test1x' ); $node->issues_sql_like( - [ 'clusterdb', '-a', '-t', 'test1' ], + [ 'clusterdb', '--all', '--table' => 'test1' ], qr/statement: CLUSTER public\.test1/s, 'cluster specific table in all databases'); -- cgit v1.2.3