summaryrefslogtreecommitdiff
path: root/t/no-clobber-globals.t
diff options
context:
space:
mode:
Diffstat (limited to 't/no-clobber-globals.t')
-rw-r--r--t/no-clobber-globals.t35
1 files changed, 35 insertions, 0 deletions
diff --git a/t/no-clobber-globals.t b/t/no-clobber-globals.t
new file mode 100644
index 0000000..905cc0e
--- /dev/null
+++ b/t/no-clobber-globals.t
@@ -0,0 +1,35 @@
+use strict;
+use warnings;
+use lib 't/lib';
+
+use Test::Deep;
+use Test::More 0.88;
+
+{
+ $@ = 'hello';
+ any(123);
+ is($@, 'hello', q{dynamically loaded test doesn't overwrite $@} );
+}
+
+{
+ $! = 11;
+ all(123);
+ is( 0 + $!, 11, q{dynamically loaded test doesn't overwrite $!} );
+}
+
+{
+ $^E = 11;
+ re(qr{a});
+ is( 0 + $^E, 11, q{dynamically loaded test doesn't overwrite $^E} );
+}
+
+{
+ $@ = 'hello';
+ cmp_deeply(
+ 'hello',
+ str($@),
+ 'when passing $@ to str() it is not localized away from new'
+ );
+}
+
+done_testing;