summaryrefslogtreecommitdiff
path: root/t/release-pp-32-regex-as-value.t
diff options
context:
space:
mode:
Diffstat (limited to 't/release-pp-32-regex-as-value.t')
-rw-r--r--t/release-pp-32-regex-as-value.t50
1 files changed, 50 insertions, 0 deletions
diff --git a/t/release-pp-32-regex-as-value.t b/t/release-pp-32-regex-as-value.t
new file mode 100644
index 0000000..4eb0d05
--- /dev/null
+++ b/t/release-pp-32-regex-as-value.t
@@ -0,0 +1,50 @@
+
+
+use Test::More;
+
+BEGIN {
+ unless ( $ENV{RELEASE_TESTING} ) {
+ plan skip_all => 'these tests are for release testing';
+ }
+
+ $ENV{PV_TEST_PERL} = 1;
+}
+
+use strict;
+use warnings;
+
+use Params::Validate qw( validate SCALAR SCALARREF );
+
+use Test::More;
+use Test::Fatal;
+
+is(
+ exception { v( foo => qr/foo/ ) },
+ undef,
+ 'no exception with regex object'
+);
+
+is(
+ exception { v( foo => 'foo' ) },
+ undef,
+ 'no exception with plain scalar'
+);
+
+my $foo = 'foo';
+is(
+ exception { v( foo => \$foo ) },
+ undef,
+ 'no exception with scalar ref'
+);
+
+done_testing();
+
+sub v {
+ validate(
+ @_, {
+ foo => { type => SCALAR | SCALARREF },
+ },
+ );
+ return;
+}
+