Permalink
Browse files

+ A failing regression that exhibits trouble with the slice

implementation
  • Loading branch information...
1 parent 65c500c commit db154567d6751e84c26bd8be91f8dc9f3b255866 @kschiess committed Feb 21, 2011
Showing with 16 additions and 1 deletion.
  1. +16 −1 spec/acceptance/regression_spec.rb
@@ -151,5 +151,20 @@ def remove_indent(s)
end
end
- # TODO insert a test for pattern match binding comparison
+ class BLanguage < Parslet::Parser
+ root :expression
+ rule(:expression) { b.as(:one) >> b.as(:two) }
+ rule(:b) { str('b') }
+ end
+ describe BLanguage do
+ it "should parse 'bb'" do
+ subject.should parse('bb').as(:one => 'b', :two => 'b')
+ end
+ it "should transform with binding constraint" do
+ transform = Parslet::Transform.new do |t|
+ t.rule(:one => simple(:b), :two => simple(:b)) { :ok }
+ end
+ transform.apply(subject.parse('bb')).should == :ok
+ end
+ end
end

0 comments on commit db15456

Please sign in to comment.