diff options
author | David Mitchell <davem@iabyn.com> | 2018-05-09 13:35:42 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2018-05-11 08:37:20 +0100 |
commit | 0d18e3dc7f3c6651b74dcaf1f7799d9b210ec1e5 (patch) | |
tree | ab9851de383a64be68d163d81b91ba72a97d4ef8 | |
parent | 14ccab5a6b00da04dd7a4eeb19bb8caadde2bd72 (diff) | |
download | perl-0d18e3dc7f3c6651b74dcaf1f7799d9b210ec1e5.tar.gz |
t/op/blocks.t: add some whitespace
Makes the tests a bit easier to read.
-rw-r--r-- | t/op/blocks.t | 112 |
1 files changed, 98 insertions, 14 deletions
diff --git a/t/op/blocks.t b/t/op/blocks.t index f220ab2bc9..cda9b42df6 100644 --- a/t/op/blocks.t +++ b/t/op/blocks.t @@ -147,30 +147,114 @@ fresh_perl_is('END { print "ok\n" } INIT { bless {} and exit }', "ok\n", {}, 'null PL_curcop in newGP'); # [perl #2754] exit(0) didn't exit from inside a UNITCHECK or CHECK block -my $testblocks = join(" ", "BEGIN { \$| = 1; }", (map { "@{[uc($_)]} { print \"$_\\n\"; }" } qw(begin unitcheck check init end)), "print \"main\\n\";"); -fresh_perl_is($testblocks, "begin\nunitcheck\ncheck\ninit\nmain\nend", {}, 'blocks execute in right order'); + +my $testblocks = + join(" ", + "BEGIN { \$| = 1; }", + (map { "@{[uc($_)]} { print \"$_\\n\"; }" } + qw(begin unitcheck check init end)), + "print \"main\\n\";" + ); + +fresh_perl_is( + $testblocks, + "begin\nunitcheck\ncheck\ninit\nmain\nend", + {}, + 'blocks execute in right order' +); + SKIP: { skip "VMS doesn't have the perl #2754 bug", 1 if $^O eq 'VMS'; - fresh_perl_is("$testblocks BEGIN { exit 0; }", "begin\nunitcheck\ncheck\ninit\nend", {}, "BEGIN{exit 0} doesn't exit yet"); + fresh_perl_is( + "$testblocks BEGIN { exit 0; }", + "begin\nunitcheck\ncheck\ninit\nend", + {}, + "BEGIN{exit 0} doesn't exit yet" + ); } -fresh_perl_is("$testblocks BEGIN { exit 1; }", "begin\nunitcheck\ncheck\nend", {}, "BEGIN{exit 1} should exit"); -fresh_perl_like("$testblocks BEGIN { die; }", qr/\Abegin\nDied[^\n]*\.\nBEGIN failed[^\n]*\.\nunitcheck\ncheck\nend\z/, {}, "BEGIN{die} should exit"); + +fresh_perl_is( + "$testblocks BEGIN { exit 1; }", + "begin\nunitcheck\ncheck\nend", + {}, + "BEGIN{exit 1} should exit" +); + +fresh_perl_like( + "$testblocks BEGIN { die; }", + qr/\Abegin\nDied[^\n]*\.\nBEGIN failed[^\n]*\.\nunitcheck\ncheck\nend\z/, + {}, + "BEGIN{die} should exit" +); + SKIP: { skip "VMS doesn't have the perl #2754 bug", 1 if $^O eq 'VMS'; - fresh_perl_is("$testblocks UNITCHECK { exit 0; }", "begin\nunitcheck\ncheck\ninit\nmain\nend", {}, "UNITCHECK{exit 0} doesn't exit yet"); + fresh_perl_is( + "$testblocks UNITCHECK { exit 0; }", + "begin\nunitcheck\ncheck\ninit\nmain\nend", + {}, + "UNITCHECK{exit 0} doesn't exit yet" + ); } -fresh_perl_is("$testblocks UNITCHECK { exit 1; }", "begin\nunitcheck\ncheck\nend", {}, "UNITCHECK{exit 1} should exit"); -fresh_perl_like("$testblocks UNITCHECK { die; }", qr/\Abegin\nDied[^\n]*\.\nUNITCHECK failed[^\n]*\.\nunitcheck\ncheck\nend\z/, {}, "UNITCHECK{die} should exit"); + +fresh_perl_is( + "$testblocks UNITCHECK { exit 1; }", + "begin\nunitcheck\ncheck\nend", + {}, + "UNITCHECK{exit 1} should exit" +); + +fresh_perl_like( + "$testblocks UNITCHECK { die; }", + qr/\Abegin\nDied[^\n]*\.\nUNITCHECK failed[^\n]*\.\nunitcheck\ncheck\nend\z/, + {}, + "UNITCHECK{die} should exit" +); + SKIP: { skip "VMS doesn't have the perl #2754 bug", 1 if $^O eq 'VMS'; - fresh_perl_is("$testblocks CHECK { exit 0; }", "begin\nunitcheck\ncheck\ninit\nmain\nend", {}, "CHECK{exit 0} doesn't exit yet"); + fresh_perl_is( + "$testblocks CHECK { exit 0; }", + "begin\nunitcheck\ncheck\ninit\nmain\nend", + {}, + "CHECK{exit 0} doesn't exit yet" + ); } -fresh_perl_is("$testblocks CHECK { exit 1; }", "begin\nunitcheck\ncheck\nend", {}, "CHECK{exit 1} should exit"); -fresh_perl_like("$testblocks CHECK { die; }", qr/\Abegin\nunitcheck\nDied[^\n]*\.\nCHECK failed[^\n]*\.\ncheck\nend\z/, {}, "CHECK{die} should exit"); -fresh_perl_is("$testblocks INIT { exit 0; }", "begin\nunitcheck\ncheck\ninit\nend", {}, "INIT{exit 0} should exit"); -fresh_perl_is("$testblocks INIT { exit 1; }", "begin\nunitcheck\ncheck\ninit\nend", {}, "INIT{exit 1} should exit"); -fresh_perl_like("$testblocks INIT { die; }", qr/\Abegin\nunitcheck\ncheck\ninit\nDied[^\n]*\.\nINIT failed[^\n]*\.\nend\z/, {}, "INIT{die} should exit"); +fresh_perl_is( + "$testblocks CHECK { exit 1; }", + "begin\nunitcheck\ncheck\nend", + {}, + "CHECK{exit 1} should exit" +); + +fresh_perl_like( + "$testblocks CHECK { die; }", + qr/\Abegin\nunitcheck\nDied[^\n]*\.\nCHECK failed[^\n]*\.\ncheck\nend\z/, + {}, + "CHECK{die} should exit" +); + +fresh_perl_is( + "$testblocks INIT { exit 0; }", + "begin\nunitcheck\ncheck\ninit\nend", + {}, + "INIT{exit 0} should exit" +); + +fresh_perl_is( + "$testblocks INIT { exit 1; }", + "begin\nunitcheck\ncheck\ninit\nend", + {}, + "INIT{exit 1} should exit" +); + +fresh_perl_like( + "$testblocks INIT { die; }", + qr/\Abegin\nunitcheck\ncheck\ninit\nDied[^\n]*\.\nINIT failed[^\n]*\.\nend\z/, + {}, + "INIT{die} should exit" +); TODO: { local $TODO = 'RT #2917: INIT{} in eval is wrongly considered too late'; |