Skip to content

Commit

Permalink
Add test for changing the name of an existing pass when .registering it.
Browse files Browse the repository at this point in the history
  • Loading branch information
tcurtis committed Aug 6, 2010
1 parent 4d67c12 commit ce84c71
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion t/tree-optimizer.t
Expand Up @@ -2,7 +2,7 @@

pir::load_bytecode('Tree/Optimizer.pbc');

plan(32);
plan(33);

{
my $opt := Tree::Optimizer.new;
Expand Down Expand Up @@ -307,6 +307,14 @@ pir::load_bytecode('PAST/Pattern.pbc');
}
}

{
my $inc := Tree::Optimizer::Pass.new(-> $n { $n + 1; });
my $opt := Tree::Optimizer.new;
$opt.register($inc, :name<inc>);
ok(pir::defined__IP($opt.find-pass('inc')),
'Adding .name to an existing pass object when .registering works.');
}

{
my $inc := Tree::Optimizer::Pass.new(-> $n { $n + 1; }, :name<inc>);
my $double := Tree::Optimizer::Pass.new(-> $n { $n * 2; }, :name<double>);
Expand Down

0 comments on commit ce84c71

Please sign in to comment.