Skip to content

Commit

Permalink
add some basic tests for while and for
Browse files Browse the repository at this point in the history
  • Loading branch information
cotto committed Feb 25, 2011
1 parent 89cc7b5 commit 668cbd8
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions t/compilers/opsc/03-past-declarator.t
Expand Up @@ -55,6 +55,30 @@ is( $if.pasttype, "if", ".. with pasttype call" );
is( +@($if), 3, ".. with 3 children" );


# test while pasttype
$buf := q|
inline op bar(out PMC, in INT) {
while (1) {
foo();
}
}|;
$past := $compiler.compile($buf, target => 'past');
$op := $past<ops>[0];
is( $op[0][0]<pasttype>, 'while', "while loop generates right pasttype");

# test for pasttype
$buf := q|
inline op bar(out PMC, in INT) {
for (i = 0; i < 111; quux($2)) {
foo($1);
}
}|;
$past := $compiler.compile($buf, target => 'past');
$op := $past<ops>[0];
is( $op[0][0]<pasttype>, 'for', "for loop generates right pasttype");



done_testing();

# Don't forget to update plan!
Expand Down

0 comments on commit 668cbd8

Please sign in to comment.