main
1RSpec.describe Mpeg::Sequence do
2 subject { Mpeg::Str.new('h') >> Mpeg::Str.new('i') }
3
4 context "when the sequence does match" do
5 let(:input) { Mpeg::Input.new('hi') }
6 let!(:result) { subject.parse('hi', input: input) }
7
8 specify { expect(result).to be_truthy }
9 specify { expect(input).to be_end_of_string }
10 end
11
12 context "when the sequence does not match" do
13 let(:input) { Mpeg::Input.new('hello') }
14 let!(:result) { subject.parse('hello', input: input) }
15
16 specify { expect(result).to be_falsey }
17 specify { expect(input.position).to be_zero }
18 end
19end