From 3ac96be660bf052902fb4e532c7a46cf294b71eb Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Thu, 13 Jul 2023 17:52:08 +0100 Subject: [PATCH] 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 --- .github/workflows/test.yml | 3 ++- test/irb/yamatanooroti/test_rendering.rb | 32 ++++++++++++++++-------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4ddb48ea7..096ecb31f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,7 @@ on: push: pull_request: schedule: - - cron: '30 14 * * *' + - cron: "30 14 * * *" jobs: ruby-versions: @@ -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 diff --git a/test/irb/yamatanooroti/test_rendering.rb b/test/irb/yamatanooroti/test_rendering.rb index 2bae7171c..d2342d6a2 100644 --- a/test/irb/yamatanooroti/test_rendering.rb +++ b/test/irb/yamatanooroti/test_rendering.rb @@ -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) @@ -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> ", @@ -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> ", @@ -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