Skip to content

Commit

Permalink
Remove debug command related yamatanooroti tests
Browse files Browse the repository at this point in the history
As discussed in ruby#449 (review),
we should avoid adding new tests that need yamatanooroti because it's
not maintained by the Ruby org. And since debug commands are now tested
in `test/irb/test_debug_cmd.rb`, we don't need these tests anymore.
  • Loading branch information
st0012 committed Dec 1, 2022
1 parent ffc39b6 commit d55b999
Showing 1 changed file with 0 additions and 221 deletions.
221 changes: 0 additions & 221 deletions test/irb/yamatanooroti/test_rendering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,234 +237,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 <main> 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 <main> 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 <main> 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
Expand Down

0 comments on commit d55b999

Please sign in to comment.