diff options
author | Stan Lo <stan001212@gmail.com> | 2023-04-05 22:40:34 +0100 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-04-05 21:40:40 +0000 |
commit | 2f8e5c80e65a14b3a9298b6cae7ee7fc53890540 (patch) | |
tree | ca1b18b39c4a0d95017361207b635d71a173a639 /test/irb/test_color.rb | |
parent | 1587494b0b5f64a9976dcf0bd94dfe98123c2c27 (diff) | |
download | ruby-2f8e5c80e65a14b3a9298b6cae7ee7fc53890540.tar.gz |
[ruby/irb] Drop Ruby 2.6 support
(https://github.com/ruby/irb/pull/555)
* Remove all Ruby 2.6 support
* Drop Ruby 2.6 specific testing conditions
* Only run Ruby 2.7+ on CI
* Bump Ruby requirement to 2.7+
https://github.com/ruby/irb/commit/3f714b616c
Diffstat (limited to 'test/irb/test_color.rb')
-rw-r--r-- | test/irb/test_color.rb | 45 |
1 files changed, 7 insertions, 38 deletions
diff --git a/test/irb/test_color.rb b/test/irb/test_color.rb index fbcb283a6d..652396c89e 100644 --- a/test/irb/test_color.rb +++ b/test/irb/test_color.rb @@ -109,14 +109,11 @@ module TestIRB "<<A+1\nA" => "#{RED}<<A#{CLEAR}+#{BLUE}#{BOLD}1#{CLEAR}\n#{RED}A#{CLEAR}", } - # specific to Ruby 2.7+ - if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7.0') - tests.merge!({ - "4.5.6" => "#{MAGENTA}#{BOLD}4.5#{CLEAR}#{RED}#{REVERSE}.6#{CLEAR}", - "\e[0m\n" => "#{RED}#{REVERSE}^[#{CLEAR}[#{BLUE}#{BOLD}0#{CLEAR}#{RED}#{REVERSE}m#{CLEAR}\n", - "<<EOS\nhere\nEOS" => "#{RED}<<EOS#{CLEAR}\n#{RED}here#{CLEAR}\n#{RED}EOS#{CLEAR}", - }) - end + tests.merge!({ + "4.5.6" => "#{MAGENTA}#{BOLD}4.5#{CLEAR}#{RED}#{REVERSE}.6#{CLEAR}", + "\e[0m\n" => "#{RED}#{REVERSE}^[#{CLEAR}[#{BLUE}#{BOLD}0#{CLEAR}#{RED}#{REVERSE}m#{CLEAR}\n", + "<<EOS\nhere\nEOS" => "#{RED}<<EOS#{CLEAR}\n#{RED}here#{CLEAR}\n#{RED}EOS#{CLEAR}", + }) # specific to Ruby 3.0+ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.0.0') @@ -136,18 +133,9 @@ module TestIRB }) end else - if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7.0') - tests.merge!({ - "[1]]]\u0013" => "[#{BLUE}#{BOLD}1#{CLEAR}]#{RED}#{REVERSE}]#{CLEAR}]^S", - "def req(true) end" => "#{GREEN}def#{CLEAR} #{BLUE}#{BOLD}req#{CLEAR}(#{RED}#{REVERSE}true#{CLEAR}) end", - }) - else - tests.merge!({ - "[1]]]\u0013" => "[#{BLUE}#{BOLD}1#{CLEAR}]]]^S", - "def req(true) end" => "#{GREEN}def#{CLEAR} #{BLUE}#{BOLD}req#{CLEAR}(#{CYAN}#{BOLD}true#{CLEAR}) end", - }) - end tests.merge!({ + "[1]]]\u0013" => "[#{BLUE}#{BOLD}1#{CLEAR}]#{RED}#{REVERSE}]#{CLEAR}]^S", + "def req(true) end" => "#{GREEN}def#{CLEAR} #{BLUE}#{BOLD}req#{CLEAR}(#{RED}#{REVERSE}true#{CLEAR}) end", "nil = 1" => "#{CYAN}#{BOLD}nil#{CLEAR} = #{BLUE}#{BOLD}1#{CLEAR}", "alias $x $1" => "#{GREEN}alias#{CLEAR} #{GREEN}#{BOLD}$x#{CLEAR} $1", "class bad; end" => "#{GREEN}class#{CLEAR} bad; #{GREEN}end#{CLEAR}", @@ -184,10 +172,6 @@ module TestIRB end def test_colorize_code_complete_true - unless complete_option_supported? - pend '`complete: true` is the same as `complete: false` in Ruby 2.6-' - end - # `complete: true` behaviors. Warn end-of-file. { "'foo' + 'bar" => "#{RED}#{BOLD}'#{CLEAR}#{RED}foo#{CLEAR}#{RED}#{BOLD}'#{CLEAR} + #{RED}#{BOLD}'#{CLEAR}#{RED}#{REVERSE}bar#{CLEAR}", @@ -216,16 +200,6 @@ module TestIRB assert_equal_with_term(code, code, complete: false, colorable: false) assert_equal_with_term(result, code, complete: false, tty: false, colorable: true) - - unless complete_option_supported? - assert_equal_with_term(result, code, complete: true) - - assert_equal_with_term(code, code, complete: true, tty: false) - - assert_equal_with_term(code, code, complete: true, colorable: false) - - assert_equal_with_term(result, code, complete: true, tty: false, colorable: true) - end end end @@ -251,11 +225,6 @@ module TestIRB private - # `complete: true` is the same as `complete: false` in Ruby 2.6- - def complete_option_supported? - Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7.0') - end - def with_term(tty: true) stdout = $stdout io = StringIO.new |