summaryrefslogtreecommitdiff
path: root/t/lib/overload_fallback.t
diff options
context:
space:
mode:
Diffstat (limited to 't/lib/overload_fallback.t')
-rw-r--r--t/lib/overload_fallback.t18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/lib/overload_fallback.t b/t/lib/overload_fallback.t
new file mode 100644
index 0000000000..6b50042475
--- /dev/null
+++ b/t/lib/overload_fallback.t
@@ -0,0 +1,18 @@
+use warnings;
+use strict;
+use Test::Simple tests => 2;
+
+use overload '""' => sub { 'stringvalue' }, fallback => 1;
+
+BEGIN {
+my $x = bless {}, 'main';
+ok ($x eq 'stringvalue', 'fallback worked');
+}
+
+
+# NOTE: delete the next line and this test script will pass
+use overload '+' => sub { die "unused"; };
+
+my $x = bless {}, 'main';
+ok (eval {$x eq 'stringvalue'}, 'fallback worked again');
+