aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStan Lo <stan001212@gmail.com>2023-10-30 18:21:58 +0000
committergit <svn-admin@ruby-lang.org>2023-10-30 18:22:02 +0000
commit85beca6e418baecddc0f01e8a7d86d42c3e96bbf (patch)
treea7e834b50bedc30392c291e630881e0b4b86a203
parent83911002f89f18b827e2bb954902d42edcf931ab (diff)
downloadruby-85beca6e418baecddc0f01e8a7d86d42c3e96bbf.tar.gz
[ruby/irb] Use IRB's own doc for doc dialog tests
(https://github.com/ruby/irb/pull/743) * Use IRB's own doc for doc dialog tests * Run doc dialog tests for older Rubies too * Remove unnecessary CI setups https://github.com/ruby/irb/commit/97a2b86f0a
-rw-r--r--test/irb/yamatanooroti/test_rendering.rb36
1 files changed, 20 insertions, 16 deletions
diff --git a/test/irb/yamatanooroti/test_rendering.rb b/test/irb/yamatanooroti/test_rendering.rb
index 279eff6515..b1a7a4087d 100644
--- a/test/irb/yamatanooroti/test_rendering.rb
+++ b/test/irb/yamatanooroti/test_rendering.rb
@@ -204,8 +204,10 @@ class IRB::RenderingTest < Yamatanooroti::TestCase
end
def test_autocomplete_with_showdoc_in_gaps_on_narrow_screen_right
- omit if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.1')
- write_irbrc <<~'LINES'
+ rdoc_dir = File.join(@tmpdir, 'rdoc')
+ system("bundle exec rdoc -r -o #{rdoc_dir}")
+ write_irbrc <<~LINES
+ IRB.conf[:EXTRA_DOC_DIRS] = ['#{rdoc_dir}']
IRB.conf[:PROMPT][:MY_PROMPT] = {
:PROMPT_I => "%03n> ",
:PROMPT_S => "%03n> ",
@@ -214,8 +216,8 @@ class IRB::RenderingTest < Yamatanooroti::TestCase
IRB.conf[:PROMPT_MODE] = :MY_PROMPT
puts 'start IRB'
LINES
- start_terminal(4, 19, %W{ruby -I/home/aycabta/ruby/reline/lib -I#{@pwd}/lib #{@pwd}/exe/irb}, startup_message: 'start IRB')
- write("Str\C-i")
+ start_terminal(4, 19, %W{ruby -I#{@pwd}/lib #{@pwd}/exe/irb}, startup_message: 'start IRB')
+ write("IR\C-i")
close
# This is because on macOS we display different shortcut for displaying the full doc
@@ -223,23 +225,25 @@ class IRB::RenderingTest < Yamatanooroti::TestCase
if RUBY_PLATFORM =~ /darwin/
assert_screen(<<~EOC)
start IRB
- 001> String
- StringPress O
- StructString
+ 001> IRB
+ IRBPress Opti
+ IRB
EOC
else
assert_screen(<<~EOC)
start IRB
- 001> String
- StringPress A
- StructString
+ 001> IRB
+ IRBPress Alt+
+ IRB
EOC
end
end
def test_autocomplete_with_showdoc_in_gaps_on_narrow_screen_left
- omit if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.1')
- write_irbrc <<~'LINES'
+ rdoc_dir = File.join(@tmpdir, 'rdoc')
+ system("bundle exec rdoc -r -o #{rdoc_dir}")
+ write_irbrc <<~LINES
+ IRB.conf[:EXTRA_DOC_DIRS] = ['#{rdoc_dir}']
IRB.conf[:PROMPT][:MY_PROMPT] = {
:PROMPT_I => "%03n> ",
:PROMPT_S => "%03n> ",
@@ -249,13 +253,13 @@ class IRB::RenderingTest < Yamatanooroti::TestCase
puts 'start IRB'
LINES
start_terminal(4, 12, %W{ruby -I#{@pwd}/lib #{@pwd}/exe/irb}, startup_message: 'start IRB')
- write("Str\C-i")
+ write("IR\C-i")
close
assert_screen(<<~EOC)
start IRB
- 001> String
- PressString
- StrinStruct
+ 001> IRB
+ PressIRB
+ IRB
EOC
end