Skip to content

Commit 4b7bcd8

Browse files
committed
Add seq spec, succeed soon
1 parent a2e919f commit 4b7bcd8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

spec/seq_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,21 @@
124124
)
125125
expect(i.offset).to eq(4)
126126
end
127+
128+
it 'returns as soon as the job is done' do
129+
130+
i = Raabro::Input.new('to' * 10_000)
131+
132+
t, d = do_time { Raabro.seq(:twotoes, i, :to, :to) }
133+
134+
expect(t.to_a(leaves: true)).to eq(
135+
[ :twotoes, 1, 0, 4, nil, :seq, [
136+
[ nil, 1, 0, 2, nil, :str, 'to' ],
137+
[ nil, 1, 2, 2, nil, :str, 'to' ] ] ]
138+
)
139+
140+
expect(d).to be < 0.2 # seconds
141+
end
127142
end
128143

129144
describe 'seq and quantifiers' do

0 commit comments

Comments
 (0)