Skip to content

Commit 6d9f231

Browse files
ono-maxko1
authored andcommitted
Make sure to fail when remote debuggee does not exit after scenarios
Remote debuggee begin to exit when readable stream or writable stream is closed. Thus, tests do not fail even though remote debuggee does not exit after scenarios. We need to close streams after `kill_safely` method.
1 parent 4cb5a4a commit 6d9f231

22 files changed

+142
-104
lines changed

test/console/backtrace_test.rb

+10-10
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_backtrace_prints_c_method_frame
3434
type 'c'
3535
type 'bt'
3636
assert_line_text(/\[C\] Integer#times/)
37-
type 'q!'
37+
type 'kill!'
3838
end
3939
end
4040

@@ -44,7 +44,7 @@ def test_backtrace_prints_the_return_value
4444
type 'c'
4545
type 'bt'
4646
assert_line_text(/Foo#first_call .* #=> 30/)
47-
type 'q!'
47+
type 'kill!'
4848
end
4949
end
5050

@@ -54,7 +54,7 @@ def test_backtrace_prints_method_arguments
5454
type 'c'
5555
type 'bt'
5656
assert_line_text(/Foo#second_call\(num=20\)/)
57-
type 'q!'
57+
type 'kill!'
5858
end
5959
end
6060

@@ -64,7 +64,7 @@ def test_backtrace_prints_block_arguments
6464
type 'c'
6565
type 'bt'
6666
assert_line_text(/block {\|ten=10\|}/)
67-
type 'q!'
67+
type 'kill!'
6868
end
6969
end
7070

@@ -76,7 +76,7 @@ def test_backtrace_prints_a_given_number_of_traces
7676
assert_line_text(/Foo#third_call_with_block/)
7777
assert_line_text(/Foo#second_call/)
7878
assert_no_line_text(/Foo#first_call/)
79-
type 'q!'
79+
type 'kill!'
8080
end
8181
end
8282

@@ -88,7 +88,7 @@ def test_backtrace_filters_traces_with_location
8888
assert_line_text(/Foo#second_call/)
8989
assert_line_text(/Foo#first_call/)
9090
assert_no_line_text(/Foo#third_call_with_block/)
91-
type 'q!'
91+
type 'kill!'
9292
end
9393
end
9494

@@ -100,7 +100,7 @@ def test_backtrace_filters_traces_with_method_name
100100
assert_line_text(/Foo#second_call/)
101101
assert_no_line_text(/Foo#first_call/)
102102
assert_no_line_text(/Foo#third_call_with_block/)
103-
type 'q!'
103+
type 'kill!'
104104
end
105105
end
106106

@@ -111,7 +111,7 @@ def test_backtrace_takes_both_number_and_pattern
111111
type 'bt 1 /rb:\d\z/'
112112
assert_line_text(/Foo#second_call/)
113113
assert_no_line_text(/Foo#first_call/)
114-
type 'q!'
114+
type 'kill!'
115115
end
116116
end
117117

@@ -166,7 +166,7 @@ def test_backtrace_prints_block_label_correctly
166166
type 'c'
167167
type 'bt'
168168
assert_line_text(/block in <main> at/)
169-
type 'q!'
169+
type 'kill!'
170170
end
171171
end
172172

@@ -176,7 +176,7 @@ def test_backtrace_prints_nested_block_label_correctly
176176
type 'c'
177177
type 'bt'
178178
assert_line_text(/block in <main> \(2 levels\) at/)
179-
type 'q!'
179+
type 'kill!'
180180
end
181181
end
182182
end

test/console/break_test.rb

+11-11
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def test_break_with_namespaced_instance_method_stops_at_correct_place
4040
assert_line_text(/#0 BP - Method \(pending\) Foo::Bar#b/)
4141
type 'continue'
4242
assert_line_num 8
43-
type 'quit!'
43+
type 'kill!'
4444
end
4545
end
4646

@@ -49,7 +49,7 @@ def test_break_with_namespaced_class_method_stops_at_correct_place
4949
type 'break Foo::Bar.a'
5050
type 'continue'
5151
assert_line_num 4
52-
type 'quit!'
52+
type 'kill!'
5353
end
5454
end
5555

@@ -58,7 +58,7 @@ def test_break_with_namespaced_module_method_stops_at_correct_place
5858
type 'break Foo::Baz.c'
5959
type 'continue'
6060
assert_line_num 15
61-
type 'quit!'
61+
type 'kill!'
6262
end
6363
end
6464

@@ -70,7 +70,7 @@ def test_break_with_a_method_does_not_stop_at_blocks_in_the_method
7070
type 'break 9'
7171
type 'continue'
7272
assert_line_num 9
73-
type 'quit!'
73+
type 'kill!'
7474
end
7575
end
7676

@@ -90,7 +90,7 @@ def test_break_command_isnt_repeatable
9090
type 'break Foo::Baz.c'
9191
type ''
9292
assert_no_line_text(/duplicated breakpoint/)
93-
type 'quit!'
93+
type 'kill!'
9494
end
9595
end
9696
end
@@ -502,7 +502,7 @@ def test_break_with_instance_method_stops_at_correct_place_a
502502
type 'break Foo::Bar#a'
503503
type 'continue'
504504
assert_line_num 3
505-
type 'quit!'
505+
type 'kill!'
506506
end
507507
end
508508

@@ -513,7 +513,7 @@ def test_break_with_instance_method_stops_at_correct_place_b
513513
type 'break Foo::Bar#b'
514514
type 'continue'
515515
assert_line_num 6
516-
type 'quit!'
516+
type 'kill!'
517517
end
518518
end
519519

@@ -522,7 +522,7 @@ def test_break_with_class_method_stops_at_correct_place
522522
type 'break Foo::Bar.c'
523523
type 'continue'
524524
assert_line_num 9
525-
type 'quit!'
525+
type 'kill!'
526526
end
527527
end
528528
end
@@ -663,7 +663,7 @@ def test_debugger_rejects_duplicated_line_breakpoints
663663
assert_line_num 18
664664
type 'continue'
665665
assert_line_num 19
666-
type 'quit!'
666+
type 'kill!'
667667
end
668668
end
669669

@@ -673,7 +673,7 @@ def test_break_with_colon_between_file_and_line_stops_at_correct_place
673673
assert_line_text(/\#0 BP \- Line .*/)
674674
type 'c'
675675
assert_line_num 4
676-
type 'q!'
676+
type 'kill!'
677677
end
678678
end
679679

@@ -683,7 +683,7 @@ def test_break_with_space_between_file_and_line_stops_at_correct_place
683683
assert_line_text(/\#0 BP \- Line .*/)
684684
type 'c'
685685
assert_line_num 9
686-
type 'q!'
686+
type 'kill!'
687687
end
688688
end
689689
end

test/console/catch_test.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test_debugger_stops_when_the_exception_raised
2020
assert_line_text(/#0 BP - Catch "ZeroDivisionError"/)
2121
type 'continue'
2222
assert_line_text('Integer#/')
23-
type 'q!'
23+
type 'kill!'
2424
end
2525
end
2626

@@ -29,7 +29,7 @@ def test_debugger_stops_when_child_exception_raised
2929
type 'catch StandardError'
3030
type 'continue'
3131
assert_line_text('Integer#/')
32-
type 'q!'
32+
type 'kill!'
3333
end
3434
end
3535

@@ -38,7 +38,7 @@ def test_catch_command_isnt_repeatable
3838
type 'catch StandardError'
3939
type ''
4040
assert_no_line_text(/duplicated breakpoint/)
41-
type 'q!'
41+
type 'kill!'
4242
end
4343
end
4444

@@ -110,7 +110,7 @@ def test_debugger_stops_when_the_exception_raised
110110
assert_line_text('Integer#/')
111111
type 's'
112112
assert_line_text('Object#bar')
113-
type 'q!'
113+
type 'kill!'
114114
end
115115
end
116116
end

test/console/config_test.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_config_show
3030
assert_line_text([
3131
/show_frames = \d+/
3232
])
33-
type 'q!'
33+
type 'kill!'
3434
end
3535
end
3636

@@ -47,7 +47,7 @@ def test_config_show_frames_set_with_eq
4747
assert_line_text([
4848
/ # and 2 frames \(use `bt' command for all frames\)/,
4949
])
50-
type 'q!'
50+
type 'kill!'
5151
end
5252
end
5353

@@ -64,7 +64,7 @@ def test_config_show_frames_set
6464
assert_line_text([
6565
/ # and 2 frames \(use `bt' command for all frames\)/,
6666
])
67-
type 'q!'
67+
type 'kill!'
6868
end
6969
end
7070
end
@@ -331,7 +331,7 @@ def test_p_with_keep_alloc_site
331331
assert_line_text([
332332
/allocated at/
333333
])
334-
type 'q!'
334+
type 'kill!'
335335
end
336336
end
337337
end

test/console/control_flow_commands_test.rb

+8-8
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def test_finish_leaves_the_current_frame
117117
assert_line_num 7
118118
type 'fin'
119119
assert_line_num 8
120-
type 'q!'
120+
type 'kill!'
121121
end
122122
end
123123
end
@@ -194,7 +194,7 @@ def test_finish
194194
assert_line_num 8
195195
type 'finish'
196196
assert_line_num 9
197-
type 'q!'
197+
type 'kill!'
198198
end
199199
end
200200

@@ -205,7 +205,7 @@ def test_finish_0
205205
assert_line_num 8
206206
type 'fin 0'
207207
assert_line_text(/finish command with 0 does not make sense/)
208-
type 'q!'
208+
type 'kill!'
209209
end
210210
end
211211

@@ -216,7 +216,7 @@ def test_finish_1
216216
assert_line_num 8
217217
type 'fin 1'
218218
assert_line_num 9
219-
type 'q!'
219+
type 'kill!'
220220
end
221221
end
222222

@@ -227,7 +227,7 @@ def test_finish_2
227227
assert_line_num 8
228228
type 'fin 2'
229229
assert_line_num 6
230-
type 'q!'
230+
type 'kill!'
231231
end
232232
end
233233

@@ -238,7 +238,7 @@ def test_finish_3
238238
assert_line_num 8
239239
type 'fin 3'
240240
assert_line_num 3
241-
type 'q!'
241+
type 'kill!'
242242
end
243243
end
244244

@@ -485,7 +485,7 @@ def test_next
485485
assert_line_num 13
486486
type 'n'
487487
assert_line_num 15
488-
type 'q!'
488+
type 'kill!'
489489
end
490490
end
491491

@@ -498,7 +498,7 @@ def test_finish
498498
assert_line_num 7
499499
type 'fin'
500500
assert_line_num 11
501-
type 'q!'
501+
type 'kill!'
502502
end
503503
end
504504
end

test/console/debug_statement_test.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_breakpoint_fires_correctly
3131
debug_code(program) do
3232
type 'continue'
3333
assert_line_text('Foo#bar')
34-
type 'q!'
34+
type 'kill!'
3535
end
3636
end
3737
end
@@ -72,7 +72,7 @@ def test_debugger_doesnt_complain_about_duplicated_breakpoint
7272
debug_code(program) do
7373
type 'continue'
7474
assert_no_line_text(/duplicated breakpoint:/)
75-
type 'q!'
75+
type 'kill!'
7676
end
7777
end
7878
end
@@ -109,7 +109,7 @@ def test_debugger_doesnt_complain_about_duplicated_breakpoint
109109
debug_code(program) do
110110
type 'continue'
111111
assert_no_line_text(/duplicated breakpoint:/)
112-
type 'q!'
112+
type 'kill!'
113113
end
114114
end
115115

test/console/delete_test.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_delete_deletes_a_specific_breakpoint
3434

3535
type "continue"
3636
assert_line_num(3)
37-
type "q!"
37+
type 'kill!'
3838
end
3939
end
4040

@@ -56,7 +56,7 @@ def test_delete_keeps_current_breakpoints_if_not_confirmed
5656
/\#0 BP \- Line .*/,
5757
/\#1 BP \- Line .*/
5858
])
59-
type 'q!'
59+
type 'kill!'
6060
end
6161
end
6262
end

0 commit comments

Comments
 (0)