3 use Test::More tests => 6;
4 BEGIN { use_ok('Imager::Expr') }
8 my $expr = Imager::Expr->new({rpnexpr=><<EXPR, variables=>[ qw(x y) ], constants=>{one=>1, two=>2}});
9 x two * # see if comments work
13 ok($expr, "compile postfix")
14 or print "# ", Imager::Expr->error, "\n";
16 or skip("Could not compile", 4);
18 # perform some basic validation on the code
19 my $code = $expr->dumpcode();
20 my @code = split /\n/, $code;
21 ok($code[-1] =~ /:\s+ret/, "ret at the end");
22 ok(grep(/:\s+mult.*x/, @code), "found mult");
23 ok(grep(/:\s+add.*y/, @code), "found add");
24 ok(grep(/:\s+getp1/, @code), "found getp1");