]> git.imager.perl.org - imager.git/blob - t/t56postfix.t
use $Config{path_sep} instead of working it out on our own
[imager.git] / t / t56postfix.t
1 #!perl -w
2 use strict;
3 use Test::More tests => 6;
4 BEGIN { use_ok('Imager::Expr') }
5
6 SKIP:
7 {
8   my $expr = Imager::Expr->new({rpnexpr=><<EXPR, variables=>[ qw(x y) ], constants=>{one=>1, two=>2}});
9 x two * # see if comments work
10 y one + 
11 getp1
12 EXPR
13   ok($expr, "compile postfix")
14     or print "# ", Imager::Expr->error, "\n";
15   $expr
16     or skip("Could not compile", 4);
17
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");
25 }