diff --git a/test/irb/yamatanooroti/test_rendering.rb b/test/irb/yamatanooroti/test_rendering.rb index 6d1a0a1d7..9e0994886 100644 --- a/test/irb/yamatanooroti/test_rendering.rb +++ b/test/irb/yamatanooroti/test_rendering.rb @@ -17,8 +17,6 @@ def setup @irbrc_backup = ENV['IRBRC'] @irbrc_file = ENV['IRBRC'] = File.join(@tmpdir, 'temporaty_irbrc') File.unlink(@irbrc_file) if File.exist?(@irbrc_file) - @ruby_file = File.join(@tmpdir, 'ruby_file.rb') - File.unlink(@ruby_file) if File.exist?(@ruby_file) end def teardown @@ -237,234 +235,13 @@ def test_assignment_expression_truncate EOC end - def test_debug - write_ruby <<~'RUBY' - puts "start IRB" - binding.irb - puts "Hello" - RUBY - start_terminal(25, 80, %W{ruby -I#{@pwd}/lib #{@ruby_file}}, startup_message: 'start IRB') - write("debug\n") - write("next\n") - close - assert_include_screen(<<~EOC) - (rdbg) next # command - [1, 3] in #{@ruby_file} - 1| puts "start IRB" - 2| binding.irb - => 3| puts "Hello" - EOC - end - - def test_break - write_ruby <<~'RUBY' - puts "start IRB" - binding.irb - puts "Hello" - puts "World" - RUBY - start_terminal(25, 80, %W{ruby -I#{@pwd}/lib #{@ruby_file}}, startup_message: 'start IRB') - write("break 3\n") - write("continue\n") - close - assert_include_screen(<<~EOC) - (rdbg:irb) break 3 - #0 BP - Line #{@ruby_file}:3 (line) - EOC - assert_include_screen(<<~EOC) - (rdbg) continue # command - [1, 4] in #{@ruby_file} - 1| puts "start IRB" - 2| binding.irb - => 3| puts "Hello" - 4| puts "World" - =>#0
at #{@ruby_file}:3 - - Stop by #0 BP - Line #{@ruby_file}:3 (line) - EOC - end - - def test_delete - write_ruby <<~'RUBY' - puts "start IRB" - binding.irb - puts "Hello" - binding.irb - puts "World" - RUBY - start_terminal(25, 80, %W{ruby -I#{@pwd}/lib #{@ruby_file}}, startup_message: 'start IRB') - write("break 5\n") - write("continue\n") - write("delete 0\n") - close - assert_include_screen(<<~EOC.strip) - (rdbg:irb) delete 0 - deleted: #0 BP - Line - EOC - end - - def test_next - write_ruby <<~'RUBY' - puts "start IRB" - binding.irb - puts "Hello" - puts "World" - RUBY - start_terminal(25, 80, %W{ruby -I#{@pwd}/lib #{@ruby_file}}, startup_message: 'start IRB') - write("next\n") - close - assert_include_screen(<<~EOC) - (rdbg:irb) next - [1, 4] in #{@ruby_file} - 1| puts "start IRB" - 2| binding.irb - => 3| puts "Hello" - 4| puts "World" - =>#0
at #{@ruby_file}:3 - EOC - end - - def test_step - write_ruby <<~'RUBY' - puts "start IRB" - def foo - puts "Hello" - end - binding.irb - foo - puts "World" - RUBY - start_terminal(25, 80, %W{ruby -I#{@pwd}/lib #{@ruby_file}}, startup_message: 'start IRB') - write("step\n") - close - assert_include_screen(<<~EOC) - (rdbg:irb) step - [1, 7] in #{@ruby_file} - 1| puts "start IRB" - 2| def foo - => 3| puts "Hello" - 4| end - 5| binding.irb - EOC - end - - def test_continue - write_ruby <<~'RUBY' - puts "start IRB" - binding.irb - puts "Hello" - binding.irb - puts "World" - RUBY - start_terminal(25, 80, %W{ruby -I#{@pwd}/lib #{@ruby_file}}, startup_message: 'start IRB') - write("continue\n") - close - assert_include_screen(<<~EOC) - (rdbg:irb) continue - Hello - - From: #{@ruby_file} @ line 4 : - - 1: puts "start IRB" - 2: binding.irb - 3: puts "Hello" - => 4: binding.irb - 5: puts "World" - EOC - end - - def test_finish - write_ruby <<~'RUBY' - puts "start IRB" - def foo - binding.irb - puts "Hello" - end - foo - puts "World" - RUBY - start_terminal(25, 80, %W{ruby -I#{@pwd}/lib #{@ruby_file}}, startup_message: 'start IRB') - write("finish\n") - close - assert_include_screen(<<~EOC) - (rdbg:irb) finish - Hello - [1, 7] in #{@ruby_file} - 1| puts "start IRB" - 2| def foo - 3| binding.irb - 4| puts "Hello" - => 5| end - 6| foo - EOC - end - - def test_backtrace - write_ruby <<~'RUBY' - puts "start IRB" - def foo - binding.irb - end - foo - RUBY - start_terminal(25, 80, %W{ruby -I#{@pwd}/lib #{@ruby_file}}, startup_message: 'start IRB') - write("backtrace\n") - close - assert_include_screen(<<~EOC) - (rdbg:irb) backtrace - =>#0 Object#foo at #{@ruby_file}:3 - #1
at #{@ruby_file}:5 - EOC - end - - def test_info - write_ruby <<~'RUBY' - puts "start IRB" - a = 1 - binding.irb - RUBY - start_terminal(25, 80, %W{ruby -I#{@pwd}/lib #{@ruby_file}}, startup_message: 'start IRB') - write("info\n") - close - assert_include_screen(<<~EOC) - (rdbg:irb) info - %self = main - a = 1 - EOC - end - - def test_catch - write_ruby <<~'RUBY' - puts "start IRB" - binding.irb - raise NotImplementedError - RUBY - start_terminal(25, 80, %W{ruby -I#{@pwd}/lib #{@ruby_file}}, startup_message: 'start IRB') - write("catch NotImplementedError\n") - write("continue\n") - close - assert_include_screen(<<~EOC) - Stop by #0 BP - Catch "NotImplementedError" - EOC - end - private - def assert_include_screen(expected) - assert_include(result.join("\n"), expected) - end - def write_irbrc(content) File.open(@irbrc_file, 'w') do |f| f.write content end end - - def write_ruby(content) - File.open(@ruby_file, 'w') do |f| - f.write content - end - end end rescue LoadError, NameError # On Ruby repository, this test suit doesn't run because Ruby repo doesn't