33require_relative '../support/console_test_case'
44
55module DEBUGGER__
6- class DebugStatementTest < ConsoleTestCase
7- STATEMENT_PLACE_HOLDER = "__BREAK_STATEMENT__ "
8- SUPPORTED_DEBUG_STATEMENTS = %w( binding.break binding.b debugger ) . freeze
6+ class DebuggerMethodTest < ConsoleTestCase
7+ METHOD_PLACE_HOLDER = "__BREAK_METHOD__ "
8+ SUPPORTED_DEBUG_METHODS = %w( debugger binding.break binding.b ) . freeze
99
1010 def debug_code ( program )
11- SUPPORTED_DEBUG_STATEMENTS . each do |statement |
12- super ( program . gsub ( STATEMENT_PLACE_HOLDER , statement ) )
11+ SUPPORTED_DEBUG_METHODS . each do |mid |
12+ super ( program . gsub ( METHOD_PLACE_HOLDER , mid ) )
1313 end
1414 end
1515 end
1616
17- class BasicTest < DebugStatementTest
17+ class DebuggerMethodBasicTest < DebuggerMethodTest
1818 def program
1919 <<~RUBY
2020 1| class Foo
2121 2| def bar
22- 3| #{ STATEMENT_PLACE_HOLDER }
22+ 3| #{ METHOD_PLACE_HOLDER }
2323 4| end
2424 5| end
2525 6|
@@ -36,17 +36,17 @@ def test_breakpoint_fires_correctly
3636 end
3737 end
3838
39- class DebugStatementWithPreCommandTest < DebugStatementTest
39+ class DebuggerMethodWithPreCommandTest < DebuggerMethodTest
4040 def program
4141 <<~RUBY
4242 1| class Foo
4343 2| def bar
44- 3| #{ STATEMENT_PLACE_HOLDER } (pre: "p 'aaaaa'")
44+ 3| #{ METHOD_PLACE_HOLDER } (pre: "p 'aaaaa'")
4545 4| baz
4646 5| end
4747 6|
4848 7| def baz
49- 8| #{ STATEMENT_PLACE_HOLDER }
49+ 8| #{ METHOD_PLACE_HOLDER }
5050 9| end
5151 10| end
5252 11|
@@ -77,17 +77,17 @@ def test_debugger_doesnt_complain_about_duplicated_breakpoint
7777 end
7878 end
7979
80- class DebugStatementWithDoCommandTest < DebugStatementTest
80+ class DebuggerMethodWithDoCommandTest < DebuggerMethodTest
8181 def program
8282 <<~RUBY
8383 1| class Foo
8484 2| def bar
85- 3| #{ STATEMENT_PLACE_HOLDER } (do: "p 'aaaaa'")
85+ 3| #{ METHOD_PLACE_HOLDER } (do: "p 'aaaaa'")
8686 4| baz
8787 5| end
8888 6|
8989 7| def baz
90- 8| #{ STATEMENT_PLACE_HOLDER }
90+ 8| #{ METHOD_PLACE_HOLDER }
9191 9| end
9292 10| end
9393 11|
@@ -113,18 +113,18 @@ def test_debugger_doesnt_complain_about_duplicated_breakpoint
113113 end
114114 end
115115
116- class ThreadManagementTest < DebugStatementTest
116+ class ThreadManagementTest < DebuggerMethodTest
117117 def program
118118 <<~RUBY
119119 1| Thread.new do
120- 2| #{ STATEMENT_PLACE_HOLDER } (do: "p 'foo' + 'bar'")
120+ 2| #{ METHOD_PLACE_HOLDER } (do: "p 'foo' + 'bar'")
121121 3| end.join
122122 4|
123123 5| Thread.new do
124- 6| #{ STATEMENT_PLACE_HOLDER } (do: "p 'bar' + 'baz'")
124+ 6| #{ METHOD_PLACE_HOLDER } (do: "p 'bar' + 'baz'")
125125 7| end.join
126126 8|
127- 9| #{ STATEMENT_PLACE_HOLDER }
127+ 9| #{ METHOD_PLACE_HOLDER }
128128 RUBY
129129 end
130130
0 commit comments