summaryrefslogtreecommitdiff
path: root/cpan/autodie/t/lib/Hints_test.pm
diff options
context:
space:
mode:
Diffstat (limited to 'cpan/autodie/t/lib/Hints_test.pm')
-rw-r--r--cpan/autodie/t/lib/Hints_test.pm42
1 files changed, 42 insertions, 0 deletions
diff --git a/cpan/autodie/t/lib/Hints_test.pm b/cpan/autodie/t/lib/Hints_test.pm
new file mode 100644
index 0000000000..40107880cd
--- /dev/null
+++ b/cpan/autodie/t/lib/Hints_test.pm
@@ -0,0 +1,42 @@
+package Hints_test;
+use strict;
+use warnings;
+
+use base qw(Exporter);
+
+our @EXPORT_OK = qw(
+ fail_on_empty fail_on_false fail_on_undef
+);
+
+use autodie::hints;
+
+# Create some dummy subs that just return their arguments.
+
+sub fail_on_empty { return @_; }
+sub fail_on_false { return @_; }
+sub fail_on_undef { return @_; }
+
+# Set them to different failure modes when used with autodie.
+
+autodie::hints->set_hints_for(
+ \&fail_on_empty, {
+ list => autodie::hints::EMPTY_ONLY ,
+ scalar => autodie::hints::EMPTY_ONLY
+ }
+);
+
+autodie::hints->set_hints_for(
+ \&fail_on_false, {
+ list => autodie::hints::EMPTY_OR_FALSE ,
+ scalar => autodie::hints::EMPTY_OR_FALSE
+ }
+);
+
+autodie::hints->set_hints_for(
+ \&fail_on_undef, {
+ list => autodie::hints::EMPTY_OR_UNDEF ,
+ scalar => autodie::hints::EMPTY_OR_UNDEF
+ }
+);
+
+1;