Skip to content

Commit

Permalink
Correspond to refactored RubyLex (#498)
Browse files Browse the repository at this point in the history
* Correspond to refactored RubyLex

ref: ruby/irb#503

* Fix test_yamatanooroti
  • Loading branch information
hasumikin authored Jan 14, 2023
1 parent cab4274 commit d634015
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions test/reline/yamatanooroti/termination_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
class TerminationChecker < RubyLex
def terminated?(code)
code.gsub!(/\n*$/, '').concat("\n")
@tokens = self.class.ripper_lex_without_warning(code)
continue = process_continue
code_block_open = check_code_block(code)
indent = process_nesting_level
ltype = process_literal_type
tokens = self.class.ripper_lex_without_warning(code)
continue = process_continue(tokens)
code_block_open = check_code_block(code, tokens)
indent = process_nesting_level(tokens)
ltype = process_literal_type(tokens)
if code_block_open or ltype or continue or indent > 0
false
else
Expand All @@ -19,9 +19,7 @@ def terminated?(code)

class AutoIndent < RubyLex
def initialize
context = Struct.new("MockIRBContext", :auto_indent_mode, :workspace, :local_variables).new(true, nil, [])
set_input(self, context: context)
set_auto_indent(context)
@context = Struct.new("MockIRBContext", :auto_indent_mode, :workspace, :local_variables).new(true, nil, [])
end

def auto_indent(&block)
Expand Down

0 comments on commit d634015

Please sign in to comment.