File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -207,15 +207,14 @@ def assert_equal_asts_message(expected_ast, actual_ast)
207207
208208 def assert_equal_tokens ( expected_tokens , actual_tokens )
209209 if expected_tokens != actual_tokens
210- expected_index = 0
211- actual_index = 0
210+ index = 0
211+ max_index = [ expected_tokens , actual_tokens ] . map ( & :size ) . max
212212
213- while expected_index < expected_tokens . length
214- expected_token = expected_tokens [ expected_index ]
215- actual_token = actual_tokens . fetch ( actual_index , [ ] )
213+ while index <= max_index
214+ expected_token = expected_tokens . fetch ( index , [ ] )
215+ actual_token = actual_tokens . fetch ( index , [ ] )
216216
217- expected_index += 1
218- actual_index += 1
217+ index += 1
219218
220219 # There are a lot of tokens that have very specific meaning according
221220 # to the context of the parser. We don't expose that information in
You can’t perform that action at this time.
0 commit comments