3 sub callme ($ ) : assertion {
21 '1 && ((1) && 1)' => 1,
27 '(1 && 1) && 1)' => undef,
36 '(( 1 && 1) && ( 1 || 0)) || _ && one && ( one || three)' => 1 );
42 use assertions::activate 'one', 'two';
47 my $expected=shift @expr;
48 my $result=eval {assertions::calc_expr($expr)};
49 if (defined $expected) {
50 unless (defined $result and $result == $expected) {
51 print STDERR "assertions::calc_expr($expr) failed,".
52 " expected '$expected' but '$result' obtained (\$@=$@)\n";
57 if (defined $result) {
58 print STDERR "assertions::calc_expr($expr) failed,".
59 " expected undef but '$result' obtained\n";
63 print "ok ", $i++, "\n";
69 print STDERR "assertions called by default\n";
72 print "ok ", $i++, "\n";
75 use assertions::activate 'mine';
78 sub callme ($) : assertion {
83 print STDERR "'use assertions;' doesn't active assertions based on package name\n";
87 print "ok ", $i++, "\n";
92 print STDERR "assertion deselection doesn't work\n";
95 print "ok ", $i++, "\n";
98 use assertions::activate 'bar', 'doz';
101 print STDERR "assertion selection doesn't work\n";
104 print "ok ", $i++, "\n";
107 use assertions q(_ && doz);
109 print STDERR "assertion activation filtering doesn't work\n";
112 print "ok ", $i++, "\n";
115 use assertions q(_ && foo);
117 print STDERR "assertion deactivation filtering doesn't work\n";
120 print "ok ", $i++, "\n";
124 use assertions 'bar';
127 print STDERR "assertion scoping doesn't work\n";
130 print "ok ", $i++, "\n";
133 use assertions::activate 're.*';
134 use assertions 'reassert';
136 print STDERR "assertion selection with re failed\n";
139 print "ok ", $i++, "\n";
144 use assertions 'bar';
147 print STDERR "this shouldn't fail ever (b=$b)\n";
151 print "ok ", $i++, "\n";
158 print STDERR "lexical declaration in assertion arg ignored (b=$b\n";
162 print "ok ", $i++, "\n";