Skip to content

Commit 3ac96be

Browse files
authored
Unpend RDoc dialog related tests (#640)
* Unpend rdoc dialog tests Without these tests, we don't have any coverage on autocompletion's rdoc dialog, which is what caused #638 to happen. * Pull ri doc on CI for the doc dialog test * Assert different screen result on CI and local machine
1 parent 621c8c2 commit 3ac96be

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
pull_request:
66
schedule:
7-
- cron: '30 14 * * *'
7+
- cron: "30 14 * * *"
88

99
jobs:
1010
ruby-versions:
@@ -72,6 +72,7 @@ jobs:
7272
- name: Install dependencies
7373
run: |
7474
gem install bundler --no-document
75+
gem rdoc --all --ri --no-rdoc
7576
WITH_VTERM=1 bundle install
7677
- name: rake test_yamatanooroti
7778
run: WITH_VTERM=1 bundle exec rake test_yamatanooroti

test/irb/yamatanooroti/test_rendering.rb

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
return
99
end
1010

11-
class IRB::TestRendering < Yamatanooroti::TestCase
11+
class IRB::RenderingTest < Yamatanooroti::TestCase
1212
def setup
1313
@pwd = Dir.pwd
1414
suffix = '%010d' % Random.rand(0..65535)
@@ -176,7 +176,7 @@ def test_symbol_with_backtick
176176
end
177177

178178
def test_autocomplete_with_showdoc_in_gaps_on_narrow_screen_right
179-
pend "Needs a dummy document to show doc"
179+
omit if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.1')
180180
write_irbrc <<~'LINES'
181181
IRB.conf[:PROMPT][:MY_PROMPT] = {
182182
:PROMPT_I => "%03n> ",
@@ -190,16 +190,28 @@ def test_autocomplete_with_showdoc_in_gaps_on_narrow_screen_right
190190
start_terminal(4, 19, %W{ruby -I/home/aycabta/ruby/reline/lib -I#{@pwd}/lib #{@pwd}/exe/irb}, startup_message: 'start IRB')
191191
write("Str\C-i")
192192
close
193-
assert_screen(<<~EOC)
194-
001> String
195-
StringPress A
196-
StructString
197-
of byte
198-
EOC
193+
194+
# This is because on macOS we display different shortcut for displaying the full doc
195+
# 'O' is for 'Option' and 'A' is for 'Alt'
196+
if RUBY_PLATFORM =~ /darwin/
197+
assert_screen(<<~EOC)
198+
start IRB
199+
001> String
200+
StringPress O
201+
StructString
202+
EOC
203+
else
204+
assert_screen(<<~EOC)
205+
start IRB
206+
001> String
207+
StringPress A
208+
StructString
209+
EOC
210+
end
199211
end
200212

201213
def test_autocomplete_with_showdoc_in_gaps_on_narrow_screen_left
202-
pend "Needs a dummy document to show doc"
214+
omit if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.1')
203215
write_irbrc <<~'LINES'
204216
IRB.conf[:PROMPT][:MY_PROMPT] = {
205217
:PROMPT_I => "%03n> ",
@@ -214,10 +226,10 @@ def test_autocomplete_with_showdoc_in_gaps_on_narrow_screen_left
214226
write("Str\C-i")
215227
close
216228
assert_screen(<<~EOC)
229+
start IRB
217230
001> String
218231
PressString
219232
StrinStruct
220-
of by
221233
EOC
222234
end
223235

0 commit comments

Comments
 (0)