From: Nicholas Clark Date: Mon, 27 Mar 2006 20:31:52 +0000 (+0000) Subject: It helps to actually add the files you add to MANIFEST. (Thanks Dave X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a5871da3a494d85e46d501e1e38f3d4b9d0f0c01;p=p5sagit%2Fp5-mst-13.2.git It helps to actually add the files you add to MANIFEST. (Thanks Dave for spotting my mistake). p4raw-id: //depot/perl@27616 --- diff --git a/t/comp/fold.t b/t/comp/fold.t new file mode 100644 index 0000000..f063c20 --- /dev/null +++ b/t/comp/fold.t @@ -0,0 +1,38 @@ +#!./perl + +BEGIN { + chdir 't'; + @INC = '../lib'; + require './test.pl'; +} +use strict; +use warnings; + +plan (8); + +# Historically constant folding was performed by evaluating the ops, and if +# they threw an exception compilation failed. This was seen as buggy, because +# even illegal constants in unreachable code would cause failure. So now +# illegal expressions are reported at runtime, if the expression is reached, +# making constant folding consistent with many other languages, and purely an +# optimisation rather than a behaviour change. + +my $a; +$a = eval '$b = 0/0 if 0; 3'; +is ($a, 3); +is ($@, ""); + +my $b = 0; +$a = eval 'if ($b) {return sqrt -3} 3'; +is ($a, 3); +is ($@, ""); + +$a = eval q{ + $b = eval q{if ($b) {return log 0} 4}; + is ($b, 4); + is ($@, ""); + 5; +}; +is ($a, 5); +is ($@, ""); +