Sha256: 0b782b2be99c390619045739619d10b37088af59f241a1e3ecaedb2995e534b7
Contents?: true
Size: 577 Bytes
Versions: 7
Compression:
Stored size: 577 Bytes
Contents
require 'spec_helper' describe Parslet::Atoms::Scope do include Parslet include Parslet::Atoms::DSL let(:context) { Parslet::Atoms::Context.new(nil) } let(:captures) { context.captures } def inject string, parser source = Parslet::Source.new(string) parser.apply(source, context, true) end let(:aabb) { scope { match['ab'].capture(:f) >> dynamic { |s,c| str(c.captures[:f]) } } } it "keeps values of captures outside" do captures[:f] = 'old_value' inject 'aa', aabb captures[:f].should == 'old_value' end end
Version data entries
7 entries across 7 versions & 2 rubygems