ruby-changes:65736
From: aycabta <ko1@a...>
Date: Sat, 3 Apr 2021 01:16:42 +0900 (JST)
Subject: [ruby-changes:65736] 254cd937c2 (master): [ruby/irb] Add test for multiline paste
https://git.ruby-lang.org/ruby.git/commit/?id=254cd937c2 From 254cd937c240281b4283bacb61b944eb52120ba5 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Sat, 3 Apr 2021 00:46:01 +0900 Subject: [ruby/irb] Add test for multiline paste https://github.com/ruby/irb/commit/e93c9cb54d --- test/irb/yamatanooroti/test_rendering.rb | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/test/irb/yamatanooroti/test_rendering.rb b/test/irb/yamatanooroti/test_rendering.rb index 19c6c9a..171bfea 100644 --- a/test/irb/yamatanooroti/test_rendering.rb +++ b/test/irb/yamatanooroti/test_rendering.rb @@ -42,6 +42,41 @@ begin https://github.com/ruby/ruby/blob/trunk/test/irb/yamatanooroti/test_rendering.rb#L42 EOC end + def test_multiline_paste + write_irbrc <<~'LINES' + puts 'start IRB' + LINES + start_terminal(25, 80, %W{ruby -I#{@pwd}/lib -I#{@pwd}/../reline/lib #{@pwd}/exe/irb}, startup_message: 'start IRB') + write(<<~EOC) + class A + def a; self; end + def b; true; end + end + + a = A.new + + a + .a + .b + EOC + close + assert_screen(<<~EOC) + start IRB + irb(main):001:1* class A + irb(main):002:1* def a; self; end + irb(main):003:1* def b; true; end + irb(main):004:0> end + irb(main):005:0* + irb(main):006:0> a = A.new + irb(main):007:0* + irb(main):008:0> a + irb(main):009:0> .a + irb(main):010:0> .b + => true + irb(main):011:0> + EOC + end + private def write_irbrc(content) File.open(@irbrc_file, 'w') do |f| f.write content -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/