Sha256: 116a16ede59954cdad9aa5943cd5b0b2643d0ea812ecfb384b51a779e51599d9

Contents?: true

Size: 569 Bytes

Versions: 2

Compression:

Stored size: 569 Bytes

Contents

require 'spec_helper'
module Sexpr::Grammar
  describe Tagging, "tag_sexpr" do
    include Tagging

    module TaggingReference
      module Not; end
      module Lit; end
    end

    def tag(x)
      res = tag_sexpr(x, TaggingReference)
      res.should eq(x)
      res
    end

    it 'tags a sexpr at first level' do
      tag([:lit]).should be_a(TaggingReference::Lit)
    end

    it 'tags sexpr recursively' do
      res = tag([:not, [:lit, true]])
      res.should be_a(TaggingReference::Not)
      res.last.should be_a(TaggingReference::Lit)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sexpr-0.4.0 spec/grammar/tagging/test_tag_sexpr.rb
sexpr-0.3.0 spec/grammar/tagging/test_tag_sexpr.rb