[perl #68108] : also fix if/else constant folding
[p5sagit/p5-mst-13.2.git] / t / op / die.t
old mode 100755 (executable)
new mode 100644 (file)
index cf4f8b0..a51333f
@@ -1,6 +1,6 @@
 #!./perl
 
-print "1..10\n";
+print "1..15\n";
 
 $SIG{__DIE__} = sub { print ref($_[0]) ? ("ok ",$_[0]->[0]++,"\n") : @_ } ;
 
@@ -35,9 +35,40 @@ eval {
 print "not " unless ref($@) eq "Out";
 print "ok 10\n";
 
-package Error;
+{
+    package Error;
 
-sub PROPAGATE {
-    print "ok ",$_[0]->[0]++,"\n";
-    bless [$_[0]->[0]], "Out";
+    sub PROPAGATE {
+       print "ok ",$_[0]->[0]++,"\n";
+       bless [$_[0]->[0]], "Out";
+    }
+}
+
+{
+    # die/warn and utf8
+    use utf8;
+    local $SIG{__DIE__};
+    my $msg = "ce ºtii tu, bã ?\n";
+    eval { die $msg }; print "not " unless $@ eq $msg;
+    print "ok 11\n";
+    our $err;
+    local $SIG{__WARN__} = $SIG{__DIE__} = sub { $err = shift };
+    eval { die $msg }; print "not " unless $err eq $msg;
+    print "ok 12\n";
+    eval { warn $msg }; print "not " unless $err eq $msg;
+    print "ok 13\n";
+    eval qq/ use strict; \$\x{3b1} /;
+    print "not " unless $@ =~ /Global symbol "\$\x{3b1}"/;
+    print "ok 14\n";
+}
+
+# [perl #36470] got uninit warning if $@ was undef
+
+{
+    my $ok = 1;
+    local $SIG{__DIE__};
+    local $SIG{__WARN__} = sub { $ok = 0 };
+    eval { undef $@; die };
+    print "not " unless $ok;
+    print "ok 15\n";
 }