File tree 2 files changed +42
-1
lines changed
2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
3
return if ENV [ 'RUBY_DEBUG_ENABLE' ] == '0'
4
- return if defined? ( ::DEBUGGER__ )
4
+ return if defined? ( ::DEBUGGER__ :: Session )
5
5
6
6
# Put the following line in your login script (e.g. ~/.bash_profile) with modified path:
7
7
#
Original file line number Diff line number Diff line change @@ -177,4 +177,45 @@ def test_step_in_stops_the_program
177
177
end
178
178
end
179
179
end
180
+
181
+ class PreludeTest < ConsoleTestCase
182
+ def program
183
+ <<~RUBY
184
+ 1| require "debug/prelude"
185
+ 2| debugger_source = Kernel.method(:debugger).source_location
186
+ 3| a = 100
187
+ 4| b = 20
188
+ 5| debugger
189
+ 6|
190
+ 7| __END__
191
+ RUBY
192
+ end
193
+
194
+ def test_prelude_defines_debugger_statements
195
+ run_ruby ( program , options : "-Ilib" ) do
196
+ assert_line_num ( 5 )
197
+ type "a + b"
198
+ assert_line_text ( /120/ )
199
+ type "c"
200
+ end
201
+ end
202
+
203
+ def test_prelude_doesnt_override_debugger
204
+ run_ruby ( program , options : "-Ilib -rdebug" ) do
205
+ assert_line_num ( 5 )
206
+ type "debugger_source"
207
+ assert_line_text ( /debug\/ session\. rb/ )
208
+ type "c"
209
+ end
210
+ end
211
+
212
+ def test_require_config_doesnt_cancel_prelude
213
+ run_ruby ( program , options : "-Ilib -rdebug/config" ) do
214
+ assert_line_num ( 5 )
215
+ type "a + b"
216
+ assert_line_text ( /120/ )
217
+ type "c"
218
+ end
219
+ end
220
+ end
180
221
end
You can’t perform that action at this time.
0 commit comments