summaryrefslogtreecommitdiff
path: root/test/irb/test_history.rb
diff options
context:
space:
mode:
authorst0012 <stan001212@gmail.com>2022-11-13 11:19:40 +0000
committergit <svn-admin@ruby-lang.org>2022-11-15 10:07:32 +0000
commit1eae15142f0fd9e5285e3d685bb1448f0f441b1c (patch)
tree8d123773cd6dbf4ce160526d8961b7d99e75ff32 /test/irb/test_history.rb
parent1a9e87fe3a0bb8a4a16e34997371b1823557202d (diff)
downloadruby-1eae15142f0fd9e5285e3d685bb1448f0f441b1c.tar.gz
[ruby/irb] Remove duplicated TestInputMethod definitions
https://github.com/ruby/irb/commit/4b831d02e1
Diffstat (limited to 'test/irb/test_history.rb')
-rw-r--r--test/irb/test_history.rb34
1 files changed, 3 insertions, 31 deletions
diff --git a/test/irb/test_history.rb b/test/irb/test_history.rb
index b0a07ca29d..2ef4bb3373 100644
--- a/test/irb/test_history.rb
+++ b/test/irb/test_history.rb
@@ -15,38 +15,10 @@ module TestIRB
IRB.conf[:RC_NAME_GENERATOR] = nil
end
- class TestInputMethod < ::IRB::InputMethod
+ class TestInputMethodWithHistory < TestInputMethod
HISTORY = Array.new
include IRB::HistorySavingAbility
-
- attr_reader :list, :line_no
-
- def initialize(list = [])
- super("test")
- @line_no = 0
- @list = list
- end
-
- def gets
- @list[@line_no]&.tap {@line_no += 1}
- end
-
- def eof?
- @line_no >= @list.size
- end
-
- def encoding
- Encoding.default_external
- end
-
- def reset
- @line_no = 0
- end
-
- def winsize
- [10, 20]
- end
end
def test_history_save_1
@@ -167,7 +139,7 @@ module TestIRB
IRB.conf[:SAVE_HISTORY] = 1
Dir.mktmpdir("test_irb_history_") do |tmpdir|
ENV["HOME"] = tmpdir
- io = TestInputMethod.new
+ io = TestInputMethodWithHistory.new
io.class::HISTORY.clear
io.load_history
io.class::HISTORY.concat(%w"line1 line2")
@@ -198,7 +170,7 @@ module TestIRB
f.write(initial_irb_history)
end
- io = TestInputMethod.new
+ io = TestInputMethodWithHistory.new
io.class::HISTORY.clear
io.load_history
if block_given?