Sha256: 935932e7bc953516b3af8149ddb8be39546d1d77581da7d1a8b8f1b10bff3eae
Contents?: true
Size: 1.34 KB
Versions: 8
Compression:
Stored size: 1.34 KB
Contents
# # specifying raabro # # Sun Sep 20 06:11:54 JST 2015 # require 'spec_helper' describe Raabro do describe '.str' do it 'returns a tree with result == 0 in case of failure' do i = Raabro::Input.new('toto') t = Raabro.str(nil, i, 'nada') expect(t.to_a).to eq( [ nil, 0, 0, 0, nil, :str, [] ] ) expect(i.offset).to eq(0) end it "returns a tree with result == 1 in case of success" do i = Raabro::Input.new('toto') t = Raabro.str(nil, i, 'toto') expect(t.to_a).to eq( [ nil, 1, 0, 4, nil, :str, [] ] ) expect(i.offset).to eq(4) end it "names the result if there is a name" do i = Raabro::Input.new('toto') t = Raabro.str(:x, i, 'toto') expect(t.to_a).to eq( [ :x, 1, 0, 4, nil, :str, [] ] ) expect(i.offset).to eq(4) end it "names in case of failure as well" do i = Raabro::Input.new('toto') t = Raabro.str(:y, i, 'nada') expect(t.to_a).to eq( [ :y, 0, 0, 0, nil, :str, [] ] ) expect(i.offset).to eq(0) end it "accepts an empty input" do i = Raabro::Input.new('toto') i.offset = 4 t = Raabro.str(nil, i, 'nada') expect(t.to_a).to eq( [ nil, 0, 4, 0, nil, :str, [] ] ) expect(i.offset).to eq(4) end end end
Version data entries
8 entries across 8 versions & 1 rubygems