From 9348643575d7a744f3e404d9069a0d29f97960a0 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Sat, 27 Apr 2019 22:01:10 +0900 Subject: make sync-default-gems GEM=irb Synced from https://github.com/ruby/irb/commit/5feb361ed80736efa5b2c2b629837ec2a5fc2cdb. This includes a support to colorize named Class instance on IRB inspect. --- test/irb/test_color.rb | 5 +++-- test/irb/test_completion.rb | 2 +- test/irb/test_option.rb | 2 +- test/irb/test_raise_no_backtrace_exception.rb | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) (limited to 'test/irb') diff --git a/test/irb/test_color.rb b/test/irb/test_color.rb index 8439fd54f5..8a59374691 100644 --- a/test/irb/test_color.rb +++ b/test/irb/test_color.rb @@ -30,7 +30,7 @@ module TestIRB "# comment" => "#{BLUE}#{BOLD}# comment#{CLEAR}", "yield(hello)" => "#{GREEN}yield#{CLEAR}(hello)", }.each do |code, result| - assert_equal(result, with_term { IRB::Color.colorize_code(code) }) + assert_equal(result, with_term { IRB::Color.colorize_code(code) }, "Case: colorize_code(#{code.dump})") end if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.6.0') @@ -54,10 +54,11 @@ module TestIRB { a: 4 } => true, /reg/ => true, Object.new => false, + Struct => true, Struct.new(:a) => false, Struct.new(:a).new(1) => false, }.each do |object, result| - assert_equal(result, IRB::Color.inspect_colorable?(object)) + assert_equal(result, IRB::Color.inspect_colorable?(object), "Case: inspect_colorable?(#{object.inspect})") end end diff --git a/test/irb/test_completion.rb b/test/irb/test_completion.rb index 608c41bad9..83df9c1c47 100644 --- a/test/irb/test_completion.rb +++ b/test/irb/test_completion.rb @@ -7,7 +7,7 @@ module TestIRB begin require "irb/completion" bug5938 = '[ruby-core:42244]' - cmds = %W[-rirb -rirb/completion -e IRB.setup(__FILE__) + cmds = %W[-W0 -rirb -rirb/completion -e IRB.setup(__FILE__) -e IRB.conf[:MAIN_CONTEXT]=IRB::Irb.new.context -e module\sFoo;def\sself.name;//;end;end -e IRB::InputCompletor::CompletionProc.call("[1].first.") diff --git a/test/irb/test_option.rb b/test/irb/test_option.rb index 85ebd085ca..6f36d81bdd 100644 --- a/test/irb/test_option.rb +++ b/test/irb/test_option.rb @@ -5,7 +5,7 @@ module TestIRB class TestOption < Test::Unit::TestCase def test_end_of_option bug4117 = '[ruby-core:33574]' - status = assert_in_out_err(%w[-rirb -e IRB.start(__FILE__) -- -f --], "", //, [], bug4117) + status = assert_in_out_err(%w[-W0 -rirb -e IRB.start(__FILE__) -- -f --], "", //, [], bug4117) assert(status.success?, bug4117) end end diff --git a/test/irb/test_raise_no_backtrace_exception.rb b/test/irb/test_raise_no_backtrace_exception.rb index 1d2e05bfac..38c61f2a94 100644 --- a/test/irb/test_raise_no_backtrace_exception.rb +++ b/test/irb/test_raise_no_backtrace_exception.rb @@ -4,7 +4,7 @@ require 'test/unit' module TestIRB class TestRaiseNoBacktraceException < Test::Unit::TestCase def test_raise_exception - assert_in_out_err(%w[-rirb -W1 -e IRB.start(__FILE__) -- -f --], <<-IRB, /Exception: foo/, []) + assert_in_out_err(%w[-rirb -W0 -e IRB.start(__FILE__) -- -f --], <<-IRB, /Exception: foo/, []) e = Exception.new("foo") def e.backtrace; nil; end raise e -- cgit v1.2.3