byebug 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/.gitignore +10 -0
  2. data/.travis.yml +8 -0
  3. data/AUTHORS +10 -0
  4. data/CHANGELOG.md +2 -0
  5. data/CONTRIBUTING.md +1 -0
  6. data/Gemfile +3 -0
  7. data/LICENSE +20 -0
  8. data/README.md +5 -0
  9. data/Rakefile +28 -0
  10. data/bin/byebug +395 -0
  11. data/byebug.gemspec +29 -0
  12. data/doc/hanoi.rb +35 -0
  13. data/doc/primes.rb +28 -0
  14. data/doc/rdebug-emacs.texi +1030 -0
  15. data/doc/test-tri2.rb +18 -0
  16. data/doc/tri3.rb +8 -0
  17. data/doc/triangle.rb +12 -0
  18. data/ext/byebug/breakpoint.c +476 -0
  19. data/ext/byebug/byebug.c +512 -0
  20. data/ext/byebug/byebug.h +131 -0
  21. data/ext/byebug/context.c +424 -0
  22. data/ext/byebug/extconf.rb +21 -0
  23. data/ext/byebug/locker.c +53 -0
  24. data/lib/byebug.rb +404 -0
  25. data/lib/byebug/command.rb +232 -0
  26. data/lib/byebug/commands/breakpoints.rb +153 -0
  27. data/lib/byebug/commands/catchpoint.rb +56 -0
  28. data/lib/byebug/commands/condition.rb +49 -0
  29. data/lib/byebug/commands/continue.rb +38 -0
  30. data/lib/byebug/commands/control.rb +110 -0
  31. data/lib/byebug/commands/display.rb +122 -0
  32. data/lib/byebug/commands/edit.rb +48 -0
  33. data/lib/byebug/commands/enable.rb +202 -0
  34. data/lib/byebug/commands/eval.rb +176 -0
  35. data/lib/byebug/commands/finish.rb +43 -0
  36. data/lib/byebug/commands/frame.rb +303 -0
  37. data/lib/byebug/commands/help.rb +56 -0
  38. data/lib/byebug/commands/info.rb +462 -0
  39. data/lib/byebug/commands/irb.rb +123 -0
  40. data/lib/byebug/commands/jump.rb +66 -0
  41. data/lib/byebug/commands/kill.rb +51 -0
  42. data/lib/byebug/commands/list.rb +94 -0
  43. data/lib/byebug/commands/method.rb +84 -0
  44. data/lib/byebug/commands/quit.rb +39 -0
  45. data/lib/byebug/commands/reload.rb +40 -0
  46. data/lib/byebug/commands/save.rb +90 -0
  47. data/lib/byebug/commands/set.rb +210 -0
  48. data/lib/byebug/commands/show.rb +246 -0
  49. data/lib/byebug/commands/skip.rb +35 -0
  50. data/lib/byebug/commands/source.rb +36 -0
  51. data/lib/byebug/commands/stepping.rb +83 -0
  52. data/lib/byebug/commands/threads.rb +189 -0
  53. data/lib/byebug/commands/tmate.rb +36 -0
  54. data/lib/byebug/commands/trace.rb +56 -0
  55. data/lib/byebug/commands/variables.rb +199 -0
  56. data/lib/byebug/context.rb +58 -0
  57. data/lib/byebug/helper.rb +69 -0
  58. data/lib/byebug/interface.rb +223 -0
  59. data/lib/byebug/processor.rb +468 -0
  60. data/lib/byebug/version.rb +3 -0
  61. data/man/rdebug.1 +241 -0
  62. data/test/breakpoints_test.rb +357 -0
  63. data/test/conditions_test.rb +77 -0
  64. data/test/continue_test.rb +44 -0
  65. data/test/display_test.rb +141 -0
  66. data/test/edit_test.rb +56 -0
  67. data/test/eval_test.rb +92 -0
  68. data/test/examples/breakpoint1.rb +15 -0
  69. data/test/examples/breakpoint2.rb +7 -0
  70. data/test/examples/conditions.rb +4 -0
  71. data/test/examples/continue.rb +4 -0
  72. data/test/examples/display.rb +5 -0
  73. data/test/examples/edit.rb +3 -0
  74. data/test/examples/edit2.rb +3 -0
  75. data/test/examples/eval.rb +4 -0
  76. data/test/examples/finish.rb +20 -0
  77. data/test/examples/frame.rb +20 -0
  78. data/test/examples/frame_threads.rb +31 -0
  79. data/test/examples/help.rb +2 -0
  80. data/test/examples/info.rb +38 -0
  81. data/test/examples/info2.rb +3 -0
  82. data/test/examples/info_threads.rb +48 -0
  83. data/test/examples/irb.rb +6 -0
  84. data/test/examples/jump.rb +14 -0
  85. data/test/examples/kill.rb +2 -0
  86. data/test/examples/list.rb +12 -0
  87. data/test/examples/method.rb +15 -0
  88. data/test/examples/post_mortem.rb +19 -0
  89. data/test/examples/quit.rb +2 -0
  90. data/test/examples/reload.rb +6 -0
  91. data/test/examples/restart.rb +6 -0
  92. data/test/examples/save.rb +3 -0
  93. data/test/examples/set.rb +3 -0
  94. data/test/examples/set_annotate.rb +12 -0
  95. data/test/examples/settings.rb +1 -0
  96. data/test/examples/show.rb +2 -0
  97. data/test/examples/source.rb +3 -0
  98. data/test/examples/stepping.rb +21 -0
  99. data/test/examples/thread.rb +32 -0
  100. data/test/examples/tmate.rb +10 -0
  101. data/test/examples/trace.rb +7 -0
  102. data/test/examples/trace_threads.rb +20 -0
  103. data/test/examples/variables.rb +26 -0
  104. data/test/finish_test.rb +48 -0
  105. data/test/frame_test.rb +143 -0
  106. data/test/help_test.rb +50 -0
  107. data/test/info_test.rb +313 -0
  108. data/test/irb_test.rb +81 -0
  109. data/test/jump_test.rb +70 -0
  110. data/test/kill_test.rb +48 -0
  111. data/test/list_test.rb +145 -0
  112. data/test/method_test.rb +70 -0
  113. data/test/post_mortem_test.rb +27 -0
  114. data/test/quit_test.rb +56 -0
  115. data/test/reload_test.rb +44 -0
  116. data/test/restart_test.rb +164 -0
  117. data/test/save_test.rb +92 -0
  118. data/test/set_test.rb +177 -0
  119. data/test/show_test.rb +293 -0
  120. data/test/source_test.rb +45 -0
  121. data/test/stepping_test.rb +130 -0
  122. data/test/support/breakpoint.rb +13 -0
  123. data/test/support/context.rb +14 -0
  124. data/test/support/matchers.rb +67 -0
  125. data/test/support/mocha_extensions.rb +72 -0
  126. data/test/support/processor.rb +7 -0
  127. data/test/support/test_dsl.rb +206 -0
  128. data/test/support/test_interface.rb +68 -0
  129. data/test/test_helper.rb +10 -0
  130. data/test/tmate_test.rb +44 -0
  131. data/test/trace_test.rb +159 -0
  132. data/test/variables_test.rb +119 -0
  133. metadata +265 -0
@@ -0,0 +1,81 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe "Irb Command" do
4
+ include TestDsl
5
+ before do
6
+ interface.stubs(:kind_of?).with(Byebug::LocalInterface).returns(true)
7
+ IRB::Irb.stubs(:new).returns(irb)
8
+ Signal.trap("SIGINT", "IGNORE")
9
+ end
10
+ after do
11
+ Signal.trap("SIGINT", "DEFAULT")
12
+ end
13
+ let(:irb) { stub(context: ->{}) }
14
+
15
+ it "must support next command" do
16
+ irb.stubs(:eval_input).throws(:IRB_EXIT, :next)
17
+ enter 'irb'
18
+ debug_file('irb') { state.line.must_equal 3 }
19
+ end
20
+
21
+ it "must support step command" do
22
+ irb.stubs(:eval_input).throws(:IRB_EXIT, :step)
23
+ enter 'irb'
24
+ debug_file('irb') { state.line.must_equal 3 }
25
+ end
26
+
27
+ it "must support cont command" do
28
+ irb.stubs(:eval_input).throws(:IRB_EXIT, :cont)
29
+ enter 'break 4', 'irb'
30
+ debug_file('irb') { state.line.must_equal 4 }
31
+ end
32
+
33
+ describe "autoirb" do
34
+ temporary_change_hash_value(Byebug::Command.settings, :autoirb, 0)
35
+
36
+ it "must call irb automatically after breakpoint" do
37
+ irb.expects(:eval_input)
38
+ enter 'set autoirb', 'break 4', 'cont'
39
+ debug_file 'irb'
40
+ end
41
+ end
42
+
43
+ # TODO: Can't reliably test the signal, from time to time Signal.trap, which is defined in IRBCommand, misses
44
+ # the SIGINT signal, which makes the test suite exit. Not sure how to fix that...
45
+ it "must translate SIGINT into 'cont' command" # do
46
+ # irb.stubs(:eval_input).calls { Process.kill("SIGINT", Process.pid) }
47
+ # enter 'break 4', 'irb'
48
+ # debug_file('irb') { state.line.must_equal 4 }
49
+ #end
50
+
51
+ describe "setting context to $rdebug_state" do
52
+ before { $rdebug_state = nil }
53
+ temporary_change_hash_value(Byebug::Command.settings, :byebugtesting, false)
54
+
55
+ it "must set $rdebug_state if irb is in the debug mode" do
56
+ rdebug_state = nil
57
+ irb.stubs(:eval_input).calls { rdebug_state = $rdebug_state }
58
+ enter 'irb -d'
59
+ debug_file('irb')
60
+ rdebug_state.must_be_kind_of Byebug::CommandProcessor::State
61
+ end
62
+
63
+ it "must not set $rdebug_state if irb is not in the debug mode" do
64
+ rdebug_state = nil
65
+ irb.stubs(:eval_input).calls { rdebug_state = $rdebug_state }
66
+ enter 'irb'
67
+ debug_file('irb')
68
+ rdebug_state.must_be_nil
69
+ end
70
+ end
71
+
72
+ describe "Post Mortem" do
73
+ it "must work in post-mortem mode" do
74
+ skip("No post morten mode for now")
75
+ #irb.stubs(:eval_input).throws(:IRB_EXIT, :cont)
76
+ #enter 'cont', 'break 12', 'irb'
77
+ #debug_file("post_mortem") { state.line.must_equal 12 }
78
+ end
79
+ end
80
+
81
+ end
@@ -0,0 +1,70 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe "Jump Command" do
4
+ include TestDsl
5
+
6
+ describe "successful" do
7
+ it "must jump with absolute line number" do
8
+ enter 'break 6', 'cont', "jump 8 #{fullpath('jump')}"
9
+ debug_file('jump') { state.line.must_equal 8 }
10
+ end
11
+
12
+ it "must not initialize skipped variables during jump" do
13
+ enter 'break 6', 'cont', "jump 8 #{fullpath('jump')}", 'next'
14
+ enter 'var local'
15
+ debug_file('jump')
16
+ check_output_includes "a => 2", "b => nil", "c => nil", "d => 5"
17
+ end
18
+
19
+ it "must jump with relative line number (-)" do
20
+ enter 'break 8', 'cont', "jump -2 #{fullpath('jump')}"
21
+ debug_file('jump') { state.line.must_equal 6 }
22
+ end
23
+
24
+ it "must jump with relative line number (+)" do
25
+ enter 'break 8', 'cont', "jump +2 #{fullpath('jump')}"
26
+ debug_file('jump') { state.line.must_equal 10 }
27
+ end
28
+ end
29
+
30
+ describe "errors" do
31
+ it "must show an error if line number is invalid" do
32
+ enter 'jump bla'
33
+ debug_file('jump')
34
+ check_output_includes "Bad line number: bla", interface.error_queue
35
+ end
36
+
37
+ it "must show an error if line number is not specified" do
38
+ enter 'jump'
39
+ debug_file('jump')
40
+ check_output_includes '"jump" must be followed by a line number', interface.error_queue
41
+ end
42
+
43
+ describe "when there is no active code in specified line" do
44
+ it "must not jump to there" do
45
+ enter "jump 13 #{fullpath('jump')}"
46
+ debug_file('jump') { state.line.must_equal 3 }
47
+ end
48
+
49
+ it "must show an error" do
50
+ enter "jump 13 #{fullpath('jump')}"
51
+ debug_file('jump')
52
+ check_output_includes "Couldn't find active code at #{fullpath('jump')}:13", interface.error_queue
53
+ end
54
+ end
55
+ end
56
+
57
+ describe "Post Mortem" do
58
+ # TODO: This test fails with "Segmentation fault". Probably need to fix it somehow, or forbid this
59
+ # command in the post mortem mode. Seems like state.context.frame_file and state.context.frame_line
60
+ # cause that.
61
+ it "must work in post-mortem mode" do
62
+ skip("No post morten mode for now")
63
+ #enter 'cont', 'jump 12'
64
+ #debug_file 'post_mortem'
65
+ #pi
66
+ end
67
+ end
68
+
69
+
70
+ end
@@ -0,0 +1,48 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe "Kill Command" do
4
+ include TestDsl
5
+
6
+ it "must send signal to some pid" do
7
+ Process.expects(:kill).with("USR1", Process.pid)
8
+ enter 'kill USR1'
9
+ debug_file('kill')
10
+ end
11
+
12
+ it "must finalize interface when sending KILL signal explicitly" do
13
+ Process.stubs(:kill).with("KILL", Process.pid)
14
+ interface.expects(:finalize)
15
+ enter 'kill KILL'
16
+ debug_file('kill')
17
+ end
18
+
19
+ it "must ask confirmation when sending KILL implicitly" do
20
+ Process.expects(:kill).with("KILL", Process.pid)
21
+ enter 'kill', 'y'
22
+ debug_file('kill')
23
+ check_output_includes "Really kill? (y/n)", interface.confirm_queue
24
+ end
25
+
26
+ describe "unknown signal" do
27
+ it "must not send the signal" do
28
+ Process.expects(:kill).with("BLA", Process.pid).never
29
+ enter 'kill BLA'
30
+ debug_file('kill')
31
+ end
32
+
33
+ it "must show an error" do
34
+ enter 'kill BLA'
35
+ debug_file('kill')
36
+ check_output_includes "signal name BLA is not a signal I know about", interface.error_queue
37
+ end
38
+ end
39
+
40
+ describe "Post Mortem" do
41
+ it "must work in post-mortem mode" do
42
+ skip("No post morten mode for now")
43
+ #Process.expects(:kill).with("USR1", Process.pid)
44
+ #enter 'cont', 'kill USR1'
45
+ #debug_file "post_mortem"
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,145 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe "List Command" do
4
+ include TestDsl
5
+ temporary_change_hash_value(Byebug::Command.settings, :listsize, 3)
6
+ before { LineCache.clear_file_cache }
7
+ after { LineCache.clear_file_cache }
8
+
9
+ describe "listsize" do
10
+ it "must show lines according to :listsize setting" do
11
+ enter 'set listsize 4', 'break 5', 'cont', 'list'
12
+ debug_file 'list'
13
+ check_output_includes "[3, 6] in #{fullpath('list')}"
14
+ end
15
+
16
+ it "must not set it if the param is not an integer" do
17
+ enter 'set listsize 4.0', 'break 5', 'cont', 'list'
18
+ debug_file 'list'
19
+ check_output_includes "[4, 6] in #{fullpath('list')}"
20
+ end
21
+ end
22
+
23
+ describe "without arguments" do
24
+ it "must show surrounding lines with the first call" do
25
+ enter 'break 5', 'cont', 'list'
26
+ debug_file 'list'
27
+ check_output_includes "[4, 6] in #{fullpath('list')}", "4 4", "=> 5 5", "6 6"
28
+ end
29
+
30
+ it "must list forward after second call" do
31
+ enter 'break 5', 'cont', 'list', 'list'
32
+ debug_file 'list'
33
+ check_output_includes "[7, 9] in #{fullpath('list')}", "7 7", "8 8", "9 9"
34
+ end
35
+ end
36
+
37
+ describe "list backward" do
38
+ it "must show surrounding lines with the first call" do
39
+ enter 'break 5', 'cont', 'list -'
40
+ debug_file 'list'
41
+ check_output_includes "[4, 6] in #{fullpath('list')}", "4 4", "=> 5 5", "6 6"
42
+ end
43
+
44
+ it "must list backward after second call" do
45
+ enter 'break 5', 'cont', 'list -', 'list -'
46
+ debug_file 'list'
47
+ check_output_includes "[1, 3] in #{fullpath('list')}", "1 byebug", "2 2", "3 3"
48
+ end
49
+ end
50
+
51
+ it "must show the surrounding lines with =" do
52
+ enter 'break 5', 'cont', 'list ='
53
+ debug_file 'list'
54
+ check_output_includes "[4, 6] in #{fullpath('list')}", "4 4", "=> 5 5", "6 6"
55
+ end
56
+
57
+ describe "autolist" do
58
+ temporary_change_hash_value(Byebug::Command.settings, :autolist, 0)
59
+
60
+ it "must show the surronding lines even without 'list' command if autolist is enabled" do
61
+ enter 'set autolist', 'break 5', 'cont'
62
+ debug_file 'list'
63
+ check_output_includes "[4, 6] in #{fullpath('list')}", "4 4", "=> 5 5", "6 6"
64
+ end
65
+ end
66
+
67
+ describe "specified lines" do
68
+ it "must show with mm-nn" do
69
+ enter 'list 4-6'
70
+ debug_file 'list'
71
+ check_output_includes "[4, 6] in #{fullpath('list')}", "4 4", "5 5", "6 6"
72
+ end
73
+
74
+ it "must show with mm,nn" do
75
+ enter 'list 4,6'
76
+ debug_file 'list'
77
+ check_output_includes "[4, 6] in #{fullpath('list')}", "4 4", "5 5", "6 6"
78
+ end
79
+
80
+ it "must show surroundings with mm-" do
81
+ enter 'list 4-'
82
+ debug_file 'list'
83
+ check_output_includes "[3, 5] in #{fullpath('list')}", "3 3", "4 4", "5 5"
84
+ end
85
+
86
+ it "must show surroundings with mm," do
87
+ enter 'list 4,'
88
+ debug_file 'list'
89
+ check_output_includes "[3, 5] in #{fullpath('list')}", "3 3", "4 4", "5 5"
90
+ end
91
+
92
+ it "must show nothing if there is no such lines" do
93
+ enter 'list 44,44'
94
+ debug_file 'list'
95
+ check_output_includes "[44, 44] in #{fullpath('list')}"
96
+ check_output_doesnt_include /^44 \S/
97
+ end
98
+
99
+ it "must show nothing if range is incorrect" do
100
+ enter 'list 5,4'
101
+ debug_file 'list'
102
+ check_output_includes "[5, 4] in #{fullpath('list')}"
103
+ check_output_doesnt_include "5 5"
104
+ check_output_doesnt_include "4 4"
105
+ end
106
+ end
107
+
108
+ describe "reload source" do
109
+ temporary_change_hash_value(Byebug::Command.settings, :reload_source_on_change, false)
110
+
111
+ after { change_line_in_file(fullpath('list'), 4, '4') }
112
+ it "must not reload if setting is false" do
113
+ enter 'set noautoreload', -> do
114
+ change_line_in_file(fullpath('list'), 4, '100')
115
+ 'list 4-4'
116
+ end
117
+ debug_file 'list'
118
+ check_output_includes "4 4"
119
+ end
120
+
121
+ it "must reload if setting is true" do
122
+ enter 'set autoreload', -> do
123
+ change_line_in_file(fullpath('list'), 4, '100')
124
+ 'list 4-4'
125
+ end
126
+ debug_file 'list'
127
+ check_output_includes "4 100"
128
+ end
129
+ end
130
+
131
+ it "must show an error when there is no such file" do
132
+ enter ->{state.file = "blabla"; 'list 4-4'}
133
+ debug_file 'list'
134
+ check_output_includes "No sourcefile available for blabla", interface.error_queue
135
+ end
136
+
137
+ describe "Post Mortem" do
138
+ it "must work in post-mortem mode" do
139
+ skip("No post morten mode for now")
140
+ #enter 'cont', 'list'
141
+ #debug_file 'post_mortem'
142
+ #check_output_includes "[7, 9] in #{fullpath('post_mortem')}"
143
+ end
144
+ end
145
+ end
@@ -0,0 +1,70 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe "Method Command" do
4
+ include TestDsl
5
+
6
+ # TODO: Need to write tests for 'method signature' command, but I can't install the 'ruby-internal' gem
7
+ # on my machine, it fails to build gem native extension.
8
+
9
+ describe "show instance method of a class" do
10
+ it "must show using full command name" do
11
+ enter 'break 15', 'cont', 'm MethodEx'
12
+ debug_file 'method'
13
+ check_output_includes /bla/
14
+ check_output_doesnt_include /foo/
15
+ end
16
+
17
+ it "must show using shortcut" do
18
+ enter 'break 15', 'cont', 'method MethodEx'
19
+ debug_file 'method'
20
+ check_output_includes /bla/
21
+ end
22
+
23
+ it "must show an error if specified object is not a class or module" do
24
+ enter 'break 15', 'cont', 'm a'
25
+ debug_file 'method'
26
+ check_output_includes "Should be Class/Module: a"
27
+ end
28
+ end
29
+
30
+
31
+ describe "show methods of an object" do
32
+ it "must show using full command name" do
33
+ enter 'break 15', 'cont', 'method instance a'
34
+ debug_file 'method'
35
+ check_output_includes /bla/
36
+ check_output_doesnt_include /foo/
37
+ end
38
+
39
+ it "must show using shortcut" do
40
+ enter 'break 15', 'cont', 'm i a'
41
+ debug_file 'method'
42
+ check_output_includes /bla/
43
+ end
44
+ end
45
+
46
+
47
+ describe "show instance variables of an object" do
48
+ it "must show using full name command" do
49
+ enter 'break 15', 'cont', 'method iv a'
50
+ debug_file 'method'
51
+ check_output_includes '@a = "b"', '@c = "d"'
52
+ end
53
+
54
+ it "must show using shortcut" do
55
+ enter 'break 15', 'cont', 'm iv a'
56
+ debug_file 'method'
57
+ check_output_includes '@a = "b"', '@c = "d"'
58
+ end
59
+ end
60
+
61
+ describe "Post Mortem" do
62
+ it "must work in post-mortem mode" do
63
+ skip("No post morten mode for now")
64
+ #enter 'cont', 'm i self'
65
+ #debug_file 'post_mortem'
66
+ #check_output_includes /to_s/
67
+ end
68
+ end
69
+
70
+ end
@@ -0,0 +1,27 @@
1
+ require_relative 'test_helper'
2
+
3
+ # XXX: No post morten mode for now
4
+ #
5
+ #describe "Post Mortem" do
6
+ # include TestDsl
7
+ #
8
+ # it "must enter into port mortem mode" do
9
+ # enter 'cont'
10
+ # debug_file("post_mortem") { Byebug.post_mortem?.must_equal true }
11
+ # end
12
+ #
13
+ # it "must stop at the correct line" do
14
+ # enter 'cont'
15
+ # debug_file("post_mortem") { state.line.must_equal 8 }
16
+ # end
17
+ #
18
+ # it "must exit from post mortem mode after stepping command" do
19
+ # enter 'cont', 'break 12', 'cont'
20
+ # debug_file("post_mortem") { Byebug.post_mortem?.must_equal false }
21
+ # end
22
+ #
23
+ # it "must save the raised exception" do
24
+ # enter 'cont'
25
+ # debug_file("post_mortem") { Byebug.last_exception.must_be_kind_of RuntimeError }
26
+ # end
27
+ #end
@@ -0,0 +1,56 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe "Quit Command" do
4
+ include TestDsl
5
+
6
+ it "must quit if user confirmed" do
7
+ Byebug::QuitCommand.any_instance.expects(:exit!)
8
+ enter 'quit', 'y'
9
+ debug_file 'quit'
10
+ check_output_includes "Really quit? (y/n)", interface.confirm_queue
11
+ end
12
+
13
+ it "must not quit if user didn't confirm" do
14
+ Byebug::QuitCommand.any_instance.expects(:exit!).never
15
+ enter 'quit', 'n'
16
+ debug_file 'quit'
17
+ check_output_includes "Really quit? (y/n)", interface.confirm_queue
18
+ end
19
+
20
+ it "must quit immediatly if used with !" do
21
+ Byebug::QuitCommand.any_instance.expects(:exit!)
22
+ enter 'quit!'
23
+ debug_file 'quit'
24
+ check_output_doesnt_include "Really quit? (y/n)", interface.confirm_queue
25
+ end
26
+
27
+ it "must quit immediatly if used with 'unconditionally'" do
28
+ Byebug::QuitCommand.any_instance.expects(:exit!)
29
+ enter 'quit unconditionally'
30
+ debug_file 'quit'
31
+ check_output_doesnt_include "Really quit? (y/n)", interface.confirm_queue
32
+ end
33
+
34
+ it "must finalize interface before quitting" do
35
+ Byebug::QuitCommand.any_instance.stubs(:exit!)
36
+ interface.expects(:finalize)
37
+ enter 'quit!'
38
+ debug_file 'quit'
39
+ end
40
+
41
+ it "must quit if used 'exit' alias" do
42
+ Byebug::QuitCommand.any_instance.expects(:exit!)
43
+ enter 'exit!'
44
+ debug_file 'quit'
45
+ end
46
+
47
+ describe "Post Mortem" do
48
+ it "must work in post-mortem mode" do
49
+ skip("No post morten mode for now")
50
+ #Byebug::QuitCommand.any_instance.expects(:exit!)
51
+ #enter 'cont', 'exit!'
52
+ #debug_file 'post_mortem'
53
+ end
54
+ end
55
+
56
+ end