aboutsummaryrefslogtreecommitdiff
path: root/src/bin/scripts/t/020_createdb.pl
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/scripts/t/020_createdb.pl')
-rw-r--r--src/bin/scripts/t/020_createdb.pl26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/bin/scripts/t/020_createdb.pl b/src/bin/scripts/t/020_createdb.pl
index c0f6067a923..8df32dba91b 100644
--- a/src/bin/scripts/t/020_createdb.pl
+++ b/src/bin/scripts/t/020_createdb.pl
@@ -3,7 +3,7 @@ use warnings;
use PostgresNode;
use TestLib;
-use Test::More tests => 13;
+use Test::More tests => 22;
program_help_ok('createdb');
program_version_ok('createdb');
@@ -24,3 +24,27 @@ $node->issues_sql_like(
$node->command_fails([ 'createdb', 'foobar1' ],
'fails if database already exists');
+
+# Check quote handling with incorrect option values.
+$node->command_checks_all(
+ [ 'createdb', '--encoding', "foo'; SELECT '1", 'foobar2' ],
+ 1,
+ [qr/^$/],
+ [qr/^createdb: "foo'; SELECT '1" is not a valid encoding name/s],
+ 'createdb with incorrect --lc-collate');
+$node->command_checks_all(
+ [ 'createdb', '--lc-collate', "foo'; SELECT '1", 'foobar2' ],
+ 1,
+ [qr/^$/],
+ [
+ qr/^createdb: database creation failed: ERROR: invalid locale name/s
+ ],
+ 'createdb with incorrect --lc-collate');
+$node->command_checks_all(
+ [ 'createdb', '--lc-ctype', "foo'; SELECT '1", 'foobar2' ],
+ 1,
+ [qr/^$/],
+ [
+ qr/^createdb: database creation failed: ERROR: invalid locale name/s
+ ],
+ 'createdb with incorrect --lc-ctype');