Debian Codegraph @

ext/XS-APItest/t/stmtasexpr.t

raw
1 use warnings;
2 use strict;
3
4 use Test::More tests => 10;
5
6 BEGIN { $^H |= 0x20000; }
7
8 my $t;
9
10 $t = "";
11 eval q{
12 use XS::APItest qw(stmtasexpr);
13 $t .= "a";
14 $t .= "b" . stmtasexpr "c"; . "d";
15 $t .= "e";
16 };
17 is $@, "";
18 is $t, "abcde";
19
20 $t = "";
21 eval q{
22 use XS::APItest qw(stmtasexpr);
23 $t .= "a";
24 $t .= "b" . stmtasexpr if($t eq "a") { "c"; } else { "d"; } . "e";
25 $t .= "f";
26 };
27 is $@, "";
28 is $t, "abcef";
29
30 $t = "";
31 eval q{
32 use XS::APItest qw(stmtasexpr);
33 $t .= "a";
34 $t .= "b" . stmtasexpr if($t eq "z") { "c"; } else { "d"; } . "e";
35 $t .= "f";
36 };
37 is $@, "";
38 is $t, "abdef";
39
40 $t = "";
41 eval q{
42 use XS::APItest qw(stmtasexpr);
43 no warnings "void";
44 $t .= "a";
45 $t .= "b" . stmtasexpr { "z"; "c"; } . "d";
46 $t .= "e";
47 };
48 is $@, "";
49 is $t, "abcde";
50
51 $t = "";
52 eval q{
53 use XS::APItest qw(stmtasexpr);
54 $t .= "a";
55 $t .= "b" . stmtasexpr x: "c"; . "d";
56 $t .= "e";
57 };
58 isnt $@, "";
59 is $t, "";
60
61 1;