Permalink
Browse files

Add test for changing the name of an existing pass when .registering it.

  • Loading branch information...
1 parent 4d67c12 commit ce84c71f19132e3da9c6f073b5d087b58c07dbe1 tcurtis committed Aug 6, 2010
Showing with 9 additions and 1 deletion.
  1. +9 −1 t/tree-optimizer.t
View
10 t/tree-optimizer.t
@@ -2,7 +2,7 @@
pir::load_bytecode('Tree/Optimizer.pbc');
-plan(32);
+plan(33);
{
my $opt := Tree::Optimizer.new;
@@ -308,6 +308,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>);
{

0 comments on commit ce84c71

Please sign in to comment.