Sha256: 8b7d082b4702eff6420e52513034aecbfaf790b11ee46995d7c5375f26da2762

Contents?: true

Size: 648 Bytes

Versions: 6

Compression:

Stored size: 648 Bytes

Contents

require 'spec_helper'
module Sexpr::Parser
  describe Citrus, "to_sexpr" do

    let(:parser){
      Citrus.new(bool_expr_parser)
    }

    subject{ parser.to_sexpr(parser.parse("not x")) }

    it 'calls sexpr' do
      subject.should eq([:bool_not, [:var_ref, "x"]])
    end

    it 'returns a Sexpr object' do
      subject.should be_a(Sexpr)
    end

    it 'tags the modules recursively' do
      subject.last.should be_a(Sexpr)
    end

    it 'sets the markers' do
      [subject, subject.last].each do |s|
        s.tracking_markers.should be_a(Hash)
        s.tracking_markers[:citrus_match].should_not be_nil
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sexpr-1.1.0 spec/unit/parser/citrus/test_to_sexpr.rb
sexpr-1.0.0 spec/unit/parser/citrus/test_to_sexpr.rb
sexpr-0.6.0 spec/unit/parser/citrus/test_to_sexpr.rb
sexpr-0.5.1 spec/parser/citrus/test_to_sexpr.rb
sexpr-0.5.0 spec/parser/citrus/test_to_sexpr.rb
sexpr-0.4.0 spec/parser/citrus/test_to_sexpr.rb