Sha256: fd9fd2ee61001a8da0a4a58bd7d2647bc61b94ab97bf75e7c6a14a929f206dd3
Contents?: true
Size: 931 Bytes
Versions: 1
Compression:
Stored size: 931 Bytes
Contents
$LOAD_PATH.unshift(Pathname(__FILE__).dirname.parent.join('lib')) require 'fzip' describe Fzip, 'array' do let(:tree) { [ ['x', '+', 'y'], ['a', '*', 'b'] ] } let(:zipper) { Fzip.array(tree) } it 'should return a zipper suitable for arrays' do expect(zipper.adapter).to be_an_instance_of(Fzip::ArrayAdapter) end it 'should allow navigating' do expect(zipper.down.down.right.right.left.node).to eq('+') end it 'should allow inserting nodes' do expect(zipper.down.down.right.insert_left(:foo).insert_right(:bar).root).to eq [["x", :foo, "+", :bar, "y"], ["a", "*", "b"]] end it 'should allow replacing nodes' do expect(zipper.down.right.down.right.replace(:foo).root).to eq [["x", "+", "y"], ["a", :foo, "b"]] end it 'should allow editing with a block' do expect(zipper.down.right.down.right.edit{:foo}.root).to eq [["x", "+", "y"], ["a", :foo, "b"]] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fzip-0.1.0 | spec/fzip_spec.rb |