Sha256: 7cf65f2adfa11460253cc3e8823b5f045af33322fde621ea6d30a9838b0aa293

Contents?: true

Size: 650 Bytes

Versions: 7

Compression:

Stored size: 650 Bytes

Contents

require 'spec_helper'

describe Parslet::Atoms::Sequence do
  include Parslet
  
  let(:sequence) { described_class.new }
  
  describe '>> shortcut' do
    let(:sequence) { str('a') >> str('b') }
    
    context "when chained with different atoms" do
      before(:each) { 
        # Chain something else to the sequence parslet. If it modifies the
        # parslet atom in place, we'll notice: 
        
        sequence >> str('d')
      }
      let!(:chained) { sequence >> str('c') }
      
      
      it "is side-effect free" do
        chained.should parse('abc')
        chained.should_not parse('abdc')
      end 
    end
    
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
parslet-2.0.0 spec/parslet/atoms/sequence_spec.rb
parslet-1.8.2 spec/parslet/atoms/sequence_spec.rb
parslet-1.8.1 spec/parslet/atoms/sequence_spec.rb
parslet-1.8.0 spec/parslet/atoms/sequence_spec.rb
swift-pyrite-0.1.1 vendor/bundle/ruby/2.0.0/gems/parslet-1.7.1/spec/parslet/atoms/sequence_spec.rb
swift-pyrite-0.1.0 vendor/bundle/ruby/2.0.0/gems/parslet-1.7.1/spec/parslet/atoms/sequence_spec.rb
parslet-1.7.1 spec/parslet/atoms/sequence_spec.rb