fix TestInputMethod
* test/irb/test_context.rb (TestInputMethod#initialize): fix typos and increment `line_no` only when not reaching the end. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
97c07d3487
commit
4969fb6282
@ -7,16 +7,16 @@ require 'rubygems' if defined?(Gem)
|
|||||||
module TestIRB
|
module TestIRB
|
||||||
class TestContext < Test::Unit::TestCase
|
class TestContext < Test::Unit::TestCase
|
||||||
class TestInputMethod < ::IRB::InputMethod
|
class TestInputMethod < ::IRB::InputMethod
|
||||||
attr_reader :line, :line_no
|
attr_reader :list, :line_no
|
||||||
|
|
||||||
def initialize(list = [])
|
def initialize(list = [])
|
||||||
super("test")
|
super("test")
|
||||||
@line_no = 0
|
@line_no = 0
|
||||||
@line = list
|
@list = list
|
||||||
end
|
end
|
||||||
|
|
||||||
def gets
|
def gets
|
||||||
@list[@line_no.tap {@line_no += 1}]
|
@list[@line_no]&.tap {@line_no += 1}
|
||||||
end
|
end
|
||||||
|
|
||||||
def eof?
|
def eof?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user