Sha256: a8ad05c2025880d820fa6a85140dd8b8d1fe709fb35c00028458a0b403282742
Contents?: true
Size: 890 Bytes
Versions: 6
Compression:
Stored size: 890 Bytes
Contents
require 'spec_helper' module Sexpr describe Node, "sexpr_copy" do let(:markers){ {:hello => 'world'} } let(:array){ [:bool_not, [:bool_lit, true]] } let(:the_sexpr){ sexpr(array, markers) } it 'degenerates to a tag preserving dup without a block' do [the_sexpr.sexpr_copy, the_sexpr.dup].each do |copy| copy.object_id.should_not eq(the_sexpr.object_id) copy.should eq(array) copy.should be_a(Sexpr) copy.tracking_markers.should eq(markers) end end it 'works ala inject with a block' do copy = the_sexpr.sexpr_copy do |base, child| base << [:bool_lit, false] end copy.object_id.should_not eq(the_sexpr.object_id) copy.should eq([:bool_not, [:bool_lit, false]]) copy.should be_a(Sexpr) copy.tracking_markers.should eq(markers) end end end
Version data entries
6 entries across 6 versions & 1 rubygems