Skip to content

Commit 97a2b86

Browse files
authored
Use IRB's own doc for doc dialog tests (#743)
* Use IRB's own doc for doc dialog tests * Run doc dialog tests for older Rubies too * Remove unnecessary CI setups
1 parent dfa527a commit 97a2b86

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ jobs:
7272
- name: Install dependencies
7373
run: |
7474
gem install bundler --no-document
75-
gem install rake
76-
gem rdoc --all --ri --no-rdoc
7775
WITH_VTERM=1 bundle install
7876
- name: rake test_yamatanooroti
7977
run: WITH_VTERM=1 bundle exec rake test_yamatanooroti

test/irb/yamatanooroti/test_rendering.rb

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,10 @@ def test_symbol_with_backtick
204204
end
205205

206206
def test_autocomplete_with_showdoc_in_gaps_on_narrow_screen_right
207-
omit if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.1')
208-
write_irbrc <<~'LINES'
207+
rdoc_dir = File.join(@tmpdir, 'rdoc')
208+
system("bundle exec rdoc -r -o #{rdoc_dir}")
209+
write_irbrc <<~LINES
210+
IRB.conf[:EXTRA_DOC_DIRS] = ['#{rdoc_dir}']
209211
IRB.conf[:PROMPT][:MY_PROMPT] = {
210212
:PROMPT_I => "%03n> ",
211213
:PROMPT_S => "%03n> ",
@@ -214,32 +216,34 @@ def test_autocomplete_with_showdoc_in_gaps_on_narrow_screen_right
214216
IRB.conf[:PROMPT_MODE] = :MY_PROMPT
215217
puts 'start IRB'
216218
LINES
217-
start_terminal(4, 19, %W{ruby -I/home/aycabta/ruby/reline/lib -I#{@pwd}/lib #{@pwd}/exe/irb}, startup_message: 'start IRB')
218-
write("Str\C-i")
219+
start_terminal(4, 19, %W{ruby -I#{@pwd}/lib #{@pwd}/exe/irb}, startup_message: 'start IRB')
220+
write("IR\C-i")
219221
close
220222

221223
# This is because on macOS we display different shortcut for displaying the full doc
222224
# 'O' is for 'Option' and 'A' is for 'Alt'
223225
if RUBY_PLATFORM =~ /darwin/
224226
assert_screen(<<~EOC)
225227
start IRB
226-
001> String
227-
StringPress O
228-
StructString
228+
001> IRB
229+
IRBPress Opti
230+
IRB
229231
EOC
230232
else
231233
assert_screen(<<~EOC)
232234
start IRB
233-
001> String
234-
StringPress A
235-
StructString
235+
001> IRB
236+
IRBPress Alt+
237+
IRB
236238
EOC
237239
end
238240
end
239241

240242
def test_autocomplete_with_showdoc_in_gaps_on_narrow_screen_left
241-
omit if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.1')
242-
write_irbrc <<~'LINES'
243+
rdoc_dir = File.join(@tmpdir, 'rdoc')
244+
system("bundle exec rdoc -r -o #{rdoc_dir}")
245+
write_irbrc <<~LINES
246+
IRB.conf[:EXTRA_DOC_DIRS] = ['#{rdoc_dir}']
243247
IRB.conf[:PROMPT][:MY_PROMPT] = {
244248
:PROMPT_I => "%03n> ",
245249
:PROMPT_S => "%03n> ",
@@ -249,13 +253,13 @@ def test_autocomplete_with_showdoc_in_gaps_on_narrow_screen_left
249253
puts 'start IRB'
250254
LINES
251255
start_terminal(4, 12, %W{ruby -I#{@pwd}/lib #{@pwd}/exe/irb}, startup_message: 'start IRB')
252-
write("Str\C-i")
256+
write("IR\C-i")
253257
close
254258
assert_screen(<<~EOC)
255259
start IRB
256-
001> String
257-
PressString
258-
StrinStruct
260+
001> IRB
261+
PressIRB
262+
IRB
259263
EOC
260264
end
261265

0 commit comments

Comments
 (0)