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