Skip to content

Commit

Permalink
Unpend RDoc dialog related tests (#640)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
st0012 committed Jul 13, 2023
1 parent 621c8c2 commit 3ac96be
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
pull_request:
schedule:
- cron: '30 14 * * *'
- cron: "30 14 * * *"

jobs:
ruby-versions:
Expand Down Expand Up @@ -72,6 +72,7 @@ jobs:
- name: Install dependencies
run: |
gem install bundler --no-document
gem rdoc --all --ri --no-rdoc
WITH_VTERM=1 bundle install
- name: rake test_yamatanooroti
run: WITH_VTERM=1 bundle exec rake test_yamatanooroti
32 changes: 22 additions & 10 deletions test/irb/yamatanooroti/test_rendering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
return
end

class IRB::TestRendering < Yamatanooroti::TestCase
class IRB::RenderingTest < Yamatanooroti::TestCase
def setup
@pwd = Dir.pwd
suffix = '%010d' % Random.rand(0..65535)
Expand Down Expand Up @@ -176,7 +176,7 @@ def test_symbol_with_backtick
end

def test_autocomplete_with_showdoc_in_gaps_on_narrow_screen_right
pend "Needs a dummy document to show doc"
omit if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.1')
write_irbrc <<~'LINES'
IRB.conf[:PROMPT][:MY_PROMPT] = {
:PROMPT_I => "%03n> ",
Expand All @@ -190,16 +190,28 @@ def test_autocomplete_with_showdoc_in_gaps_on_narrow_screen_right
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")
close
assert_screen(<<~EOC)
001> String
StringPress A
StructString
of byte
EOC

# This is because on macOS we display different shortcut for displaying the full doc
# 'O' is for 'Option' and 'A' is for 'Alt'
if RUBY_PLATFORM =~ /darwin/
assert_screen(<<~EOC)
start IRB
001> String
StringPress O
StructString
EOC
else
assert_screen(<<~EOC)
start IRB
001> String
StringPress A
StructString
EOC
end
end

def test_autocomplete_with_showdoc_in_gaps_on_narrow_screen_left
pend "Needs a dummy document to show doc"
omit if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.1')
write_irbrc <<~'LINES'
IRB.conf[:PROMPT][:MY_PROMPT] = {
:PROMPT_I => "%03n> ",
Expand All @@ -214,10 +226,10 @@ def test_autocomplete_with_showdoc_in_gaps_on_narrow_screen_left
write("Str\C-i")
close
assert_screen(<<~EOC)
start IRB
001> String
PressString
StrinStruct
of by
EOC
end

Expand Down

0 comments on commit 3ac96be

Please sign in to comment.