[ruby/irb] Fix easter_egg run without RDoc, fix input-method test
run without RDoc (https://github.com/ruby/irb/pull/998) * EasterEgg no longer depend on RDoc * Run most of the input-method tests even if RDoc is not avialable https://github.com/ruby/irb/commit/30fa1595d9
This commit is contained in:
parent
0889f64021
commit
f1349924df
@ -107,13 +107,14 @@ module IRB
|
|||||||
end
|
end
|
||||||
|
|
||||||
private def easter_egg(type = nil)
|
private def easter_egg(type = nil)
|
||||||
|
print "\e[?1049h"
|
||||||
type ||= [:logo, :dancing].sample
|
type ||= [:logo, :dancing].sample
|
||||||
case type
|
case type
|
||||||
when :logo
|
when :logo
|
||||||
require "rdoc"
|
Pager.page do |io|
|
||||||
RDoc::RI::Driver.new.page do |io|
|
logo_type = STDOUT.external_encoding == Encoding::UTF_8 ? :unicode_large : :ascii_large
|
||||||
type = STDOUT.external_encoding == Encoding::UTF_8 ? :unicode_large : :ascii_large
|
io.write easter_egg_logo(logo_type)
|
||||||
io.write easter_egg_logo(type)
|
STDIN.raw { STDIN.getc } if io == STDOUT
|
||||||
end
|
end
|
||||||
when :dancing
|
when :dancing
|
||||||
STDOUT.cooked do
|
STDOUT.cooked do
|
||||||
@ -138,10 +139,11 @@ module IRB
|
|||||||
end
|
end
|
||||||
rescue Interrupt
|
rescue Interrupt
|
||||||
ensure
|
ensure
|
||||||
print "\e[0m\e[?1049l"
|
|
||||||
trap("SIGINT", prev_trap)
|
trap("SIGINT", prev_trap)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
ensure
|
||||||
|
print "\e[0m\e[?1049l"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -70,6 +70,7 @@ module TestIRB
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_initialization_with_use_autocomplete
|
def test_initialization_with_use_autocomplete
|
||||||
|
omit 'This test requires RDoc' unless defined?(RDoc)
|
||||||
original_show_doc_proc = Reline.dialog_proc(:show_doc)&.dialog_proc
|
original_show_doc_proc = Reline.dialog_proc(:show_doc)&.dialog_proc
|
||||||
empty_proc = Proc.new {}
|
empty_proc = Proc.new {}
|
||||||
Reline.add_dialog_proc(:show_doc, empty_proc)
|
Reline.add_dialog_proc(:show_doc, empty_proc)
|
||||||
@ -190,5 +191,5 @@ module TestIRB
|
|||||||
def has_rdoc_content?
|
def has_rdoc_content?
|
||||||
File.exist?(RDoc::RI::Paths::BASE)
|
File.exist?(RDoc::RI::Paths::BASE)
|
||||||
end
|
end
|
||||||
end
|
end if defined?(RDoc)
|
||||||
end if defined?(RDoc)
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user