[svn:parrot] r47935 - branches/gsoc_past_optimization/t/library
tcurtis at svn.parrot.org
tcurtis at svn.parrot.org
Wed Jun 30 07:00:41 UTC 2010
Author: tcurtis
Date: Wed Jun 30 07:00:41 2010
New Revision: 47935
URL: https://trac.parrot.org/parrot/changeset/47935
Log:
Add failing test for :descend_until with :min_depth.
Modified:
branches/gsoc_past_optimization/t/library/pastpattern.t
Modified: branches/gsoc_past_optimization/t/library/pastpattern.t
==============================================================================
--- branches/gsoc_past_optimization/t/library/pastpattern.t Wed Jun 30 06:15:47 2010 (r47934)
+++ branches/gsoc_past_optimization/t/library/pastpattern.t Wed Jun 30 07:00:41 2010 (r47935)
@@ -5,7 +5,7 @@
pir::load_bytecode('PCT.pbc');
pir::load_bytecode('PAST/Pattern.pbc');
-plan(2150);
+plan(2151);
test_type_matching();
test_attribute_exact_matching();
@@ -787,8 +787,7 @@
sub test_transform () {
test_transform_sub();
- test_transform_min_depth();
- test_transform_descend_until();
+ test_transform_options();
}
sub test_transform_sub () {
@@ -828,6 +827,24 @@
'Matched nodes within other matched nodes are changed.');
}
+sub test_transform_options () {
+ test_transform_min_depth();
+ test_transform_descend_until();
+
+ my @matches := [];
+ my &transform := sub ($/) {
+ pir::push(@matches, $/.orig);
+ $/.orig;
+ }
+ my $pattern := PAST::Pattern::Block.new();
+ my $past := PAST::Block.new(PAST::Block.new());
+ my $limit := PAST::Pattern::Block.new();
+ $pattern.transform($past, &transform,
+ :min_depth(1), :descend_until($limit));
+ ok(@matches == 1 && @matches[0] =:= $past[0],
+ ":descended_until and :min_depth work together.");
+}
+
sub test_transform_min_depth () {
my $pattern := PAST::Pattern::Block.new;
my $past := PAST::Block.new(PAST::Block.new());
More information about the parrot-commits
mailing list