byebug 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/GUIDE.md +2 -2
- data/LICENSE +3 -3
- data/README.md +5 -4
- data/byebug.gemspec +1 -1
- data/ext/byebug/byebug.c +20 -19
- data/lib/byebug.rb +2 -53
- data/lib/byebug/command.rb +9 -109
- data/lib/byebug/commands/breakpoints.rb +1 -1
- data/lib/byebug/commands/control.rb +20 -21
- data/lib/byebug/commands/display.rb +2 -3
- data/lib/byebug/commands/eval.rb +6 -16
- data/lib/byebug/commands/finish.rb +1 -1
- data/lib/byebug/commands/frame.rb +9 -9
- data/lib/byebug/commands/help.rb +2 -3
- data/lib/byebug/commands/history.rb +28 -0
- data/lib/byebug/commands/info.rb +3 -3
- data/lib/byebug/commands/list.rb +2 -13
- data/lib/byebug/commands/method.rb +5 -45
- data/lib/byebug/commands/reload.rb +1 -12
- data/lib/byebug/commands/repl.rb +6 -15
- data/lib/byebug/commands/save.rb +2 -7
- data/lib/byebug/commands/set.rb +45 -116
- data/lib/byebug/commands/show.rb +22 -126
- data/lib/byebug/commands/stepping.rb +1 -1
- data/lib/byebug/commands/trace.rb +14 -25
- data/lib/byebug/commands/variables.rb +3 -41
- data/lib/byebug/helper.rb +11 -42
- data/lib/byebug/history.rb +5 -13
- data/lib/byebug/processors/command_processor.rb +6 -6
- data/lib/byebug/setting.rb +82 -0
- data/lib/byebug/settings/autoeval.rb +20 -0
- data/lib/byebug/settings/autoirb.rb +19 -0
- data/lib/byebug/settings/autolist.rb +19 -0
- data/lib/byebug/settings/autoreload.rb +11 -0
- data/lib/byebug/settings/autosave.rb +11 -0
- data/lib/byebug/settings/basename.rb +7 -0
- data/lib/byebug/settings/callstyle.rb +15 -0
- data/lib/byebug/settings/forcestep.rb +11 -0
- data/lib/byebug/settings/fullpath.rb +11 -0
- data/lib/byebug/settings/histfile.rb +16 -0
- data/lib/byebug/settings/histsize.rb +18 -0
- data/lib/byebug/settings/linetrace.rb +15 -0
- data/lib/byebug/settings/listsize.rb +15 -0
- data/lib/byebug/settings/post_mortem.rb +15 -0
- data/lib/byebug/settings/stack_on_error.rb +7 -0
- data/lib/byebug/settings/testing.rb +7 -0
- data/lib/byebug/settings/tracing_plus.rb +7 -0
- data/lib/byebug/settings/verbose.rb +7 -0
- data/lib/byebug/settings/width.rb +29 -0
- data/lib/byebug/version.rb +1 -1
- data/test/breakpoints_test.rb +345 -324
- data/test/conditions_test.rb +61 -48
- data/test/continue_test.rb +38 -27
- data/test/debugger_alias_test.rb +5 -3
- data/test/display_test.rb +103 -92
- data/test/edit_test.rb +42 -34
- data/test/eval_test.rb +91 -75
- data/test/finish_test.rb +51 -40
- data/test/frame_test.rb +197 -184
- data/test/help_test.rb +47 -38
- data/test/history_test.rb +54 -0
- data/test/info_test.rb +306 -293
- data/test/interrupt_test.rb +44 -38
- data/test/kill_test.rb +40 -31
- data/test/list_test.rb +166 -133
- data/test/method_test.rb +67 -60
- data/test/post_mortem_test.rb +56 -48
- data/test/quit_test.rb +44 -35
- data/test/reload_test.rb +36 -24
- data/test/repl_test.rb +57 -47
- data/test/restart_test.rb +56 -69
- data/test/save_test.rb +62 -53
- data/test/set_test.rb +140 -118
- data/test/show_test.rb +68 -201
- data/test/source_test.rb +39 -29
- data/test/stepping_test.rb +163 -136
- data/test/support/test_dsl.rb +9 -11
- data/test/test_helper.rb +2 -7
- data/test/thread_test.rb +121 -107
- data/test/trace_test.rb +86 -83
- data/test/variables_test.rb +104 -98
- metadata +27 -86
- data/test/examples/breakpoint.rb +0 -6
- data/test/examples/breakpoint_deep.rb +0 -4
- data/test/examples/conditions.rb +0 -4
- data/test/examples/continue.rb +0 -5
- data/test/examples/display.rb +0 -5
- data/test/examples/edit.rb +0 -4
- data/test/examples/eval.rb +0 -4
- data/test/examples/finish.rb +0 -3
- data/test/examples/frame.rb +0 -4
- data/test/examples/frame_deep.rb +0 -1
- data/test/examples/gcd.rb +0 -15
- data/test/examples/hanoi.rb +0 -34
- data/test/examples/help.rb +0 -1
- data/test/examples/info.rb +0 -6
- data/test/examples/info2.rb +0 -3
- data/test/examples/interrupt.rb +0 -8
- data/test/examples/kill.rb +0 -2
- data/test/examples/list.rb +0 -23
- data/test/examples/method.rb +0 -4
- data/test/examples/post_mortem.rb +0 -4
- data/test/examples/primes.rb +0 -25
- data/test/examples/quit.rb +0 -2
- data/test/examples/reload.rb +0 -6
- data/test/examples/repl.rb +0 -6
- data/test/examples/restart.rb +0 -6
- data/test/examples/save.rb +0 -3
- data/test/examples/set.rb +0 -3
- data/test/examples/settings.rb +0 -1
- data/test/examples/show.rb +0 -1
- data/test/examples/source.rb +0 -3
- data/test/examples/stepping.rb +0 -8
- data/test/examples/stepping_raise_from_c_method.rb +0 -3
- data/test/examples/stepping_raise_from_ruby_method.rb +0 -3
- data/test/examples/test-triangle.rb +0 -14
- data/test/examples/thread.rb +0 -5
- data/test/examples/tmate.rb +0 -10
- data/test/examples/trace.rb +0 -8
- data/test/examples/tri3.rb +0 -6
- data/test/examples/triangle.rb +0 -13
- data/test/examples/variables.rb +0 -4
- data/test/timeout_test.rb +0 -9
data/test/restart_test.rb
CHANGED
@@ -1,59 +1,36 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
a
|
4
|
-
|
5
|
-
end
|
6
|
-
|
7
|
-
class TestRestart < TestDsl::TestCase
|
8
|
-
describe 'usual restarting' do
|
9
|
-
temporary_change_const Byebug, 'BYEBUG_SCRIPT', 'byebug_script'
|
10
|
-
|
11
|
-
it 'must be restarted with arguments' do
|
12
|
-
Byebug::RestartCommand.any_instance.expects(:exec).
|
13
|
-
with("#{Byebug::BYEBUG_SCRIPT} #{Byebug::PROG_SCRIPT} 1 2 3")
|
14
|
-
enter 'restart 1 2 3'
|
15
|
-
debug_file 'restart'
|
1
|
+
module RestartTest
|
2
|
+
class Example
|
3
|
+
def concat_args(a, b, c)
|
4
|
+
a.to_s + b.to_s + c.to_s
|
16
5
|
end
|
6
|
+
end
|
17
7
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
8
|
+
class RestartTestCase < TestDsl::TestCase
|
9
|
+
before do
|
10
|
+
@example = -> do
|
11
|
+
byebug
|
12
|
+
a = ARGV[0]
|
13
|
+
b = ARGV[1]
|
14
|
+
c = ARGV[2]
|
15
|
+
Example.new.concat_args(a, b, c)
|
26
16
|
end
|
27
17
|
end
|
28
18
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
Byebug::RestartCommand.any_instance.expects(:exec).
|
34
|
-
with("#{Byebug::BYEBUG_SCRIPT} #{Byebug::PROG_SCRIPT} 1 2 3")
|
35
|
-
enter 'set args 1 2 3', 'restart'
|
36
|
-
debug_file 'restart'
|
37
|
-
end
|
19
|
+
def must_restart(cmd = nil)
|
20
|
+
expectation = Byebug::RestartCommand.any_instance.expects(:exec)
|
21
|
+
expectation = expectation.with(cmd) if cmd
|
22
|
+
expectation
|
38
23
|
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe 'messaging' do
|
42
|
-
before { enter 'restart' }
|
43
24
|
|
44
|
-
describe '
|
25
|
+
describe 'usual restarting' do
|
45
26
|
temporary_change_const Byebug, 'BYEBUG_SCRIPT', 'byebug_script'
|
46
27
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
check_output_includes \
|
54
|
-
"Re exec'ing:\n" \
|
55
|
-
"\t#{Byebug::BYEBUG_SCRIPT} #{Byebug::PROG_SCRIPT} argv"
|
56
|
-
end
|
28
|
+
it 'must be restarted with arguments' do
|
29
|
+
cmd = "#{Byebug::BYEBUG_SCRIPT} #{Byebug::PROG_SCRIPT} 1 2 3"
|
30
|
+
must_restart(cmd)
|
31
|
+
enter 'restart 1 2 3'
|
32
|
+
debug_proc(@example)
|
33
|
+
check_output_includes "Re exec'ing:\n\t#{cmd}"
|
57
34
|
end
|
58
35
|
end
|
59
36
|
|
@@ -62,9 +39,9 @@ class TestRestart < TestDsl::TestCase
|
|
62
39
|
|
63
40
|
it 'must not restart and show error messages instead' do
|
64
41
|
must_restart.never
|
65
|
-
|
66
|
-
|
67
|
-
|
42
|
+
enter 'restart'
|
43
|
+
debug_proc(@example)
|
44
|
+
check_error_includes 'Don\'t know name of debugged program'
|
68
45
|
end
|
69
46
|
end
|
70
47
|
|
@@ -73,32 +50,40 @@ class TestRestart < TestDsl::TestCase
|
|
73
50
|
|
74
51
|
it 'must not restart' do
|
75
52
|
must_restart.never
|
76
|
-
|
53
|
+
enter 'restart'
|
54
|
+
debug_proc(@example)
|
77
55
|
end
|
78
56
|
|
79
57
|
it 'must show an error message' do
|
80
|
-
|
81
|
-
|
82
|
-
|
58
|
+
enter 'restart'
|
59
|
+
debug_proc(@example)
|
60
|
+
check_error_includes 'Ruby program blabla doesn\'t exist'
|
83
61
|
end
|
84
62
|
end
|
85
63
|
|
86
|
-
describe '
|
87
|
-
|
64
|
+
describe 'when no runner script specified' do
|
65
|
+
temporary_change_const Byebug, 'BYEBUG_SCRIPT', :__undefined__
|
88
66
|
|
89
|
-
|
90
|
-
|
91
|
-
|
67
|
+
describe 'restarting' do
|
68
|
+
before do
|
69
|
+
must_restart
|
70
|
+
enter 'restart'
|
71
|
+
end
|
92
72
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
73
|
+
it 'must restart anyways' do
|
74
|
+
debug_proc(@example)
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'must show a warning message' do
|
78
|
+
debug_proc(@example)
|
79
|
+
check_output_includes 'Byebug was not called from the outset...'
|
80
|
+
end
|
97
81
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
82
|
+
it 'must show a warning message when prog script is not executable' do
|
83
|
+
debug_proc(@example)
|
84
|
+
check_output_includes "Ruby program #{Byebug::PROG_SCRIPT} not " \
|
85
|
+
"executable... We'll wrap it in a ruby call"
|
86
|
+
end
|
102
87
|
end
|
103
88
|
end
|
104
89
|
|
@@ -107,12 +92,14 @@ class TestRestart < TestDsl::TestCase
|
|
107
92
|
|
108
93
|
it 'must restart anyway' do
|
109
94
|
must_restart
|
110
|
-
|
95
|
+
enter 'restart'
|
96
|
+
debug_proc(@example)
|
111
97
|
end
|
112
98
|
|
113
99
|
it 'must show an error message ' do
|
114
100
|
must_restart
|
115
|
-
|
101
|
+
enter 'restart'
|
102
|
+
debug_proc(@example)
|
116
103
|
check_output_includes \
|
117
104
|
'Failed to change initial directory /unexistent/path'
|
118
105
|
end
|
data/test/save_test.rb
CHANGED
@@ -1,74 +1,83 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe 'successful saving' do
|
4
|
-
let(:file_name) { 'save_output.txt' }
|
5
|
-
let(:file_contents) { File.read(file_name) }
|
1
|
+
module SaveTest
|
2
|
+
class SaveTestCase < TestDsl::TestCase
|
6
3
|
before do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
File.delete(file_name)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'must save usual breakpoints' do
|
16
|
-
file_contents.must_include "break #{fullpath('save')}:2"
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'must save conditinal breakpoints' do
|
20
|
-
file_contents.must_include "break #{fullpath('save')}:3 if true"
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'must save catchpoints' do
|
24
|
-
file_contents.must_include 'catch NoMethodError'
|
4
|
+
@example = -> do
|
5
|
+
byebug
|
6
|
+
a = 2
|
7
|
+
a = 3
|
8
|
+
end
|
25
9
|
end
|
26
10
|
|
27
|
-
|
28
|
-
|
29
|
-
|
11
|
+
describe 'successful saving' do
|
12
|
+
let(:file_name) { 'save_output.txt' }
|
13
|
+
let(:file_contents) { File.read(file_name) }
|
14
|
+
before do
|
15
|
+
enter 'break 2', 'break 3 if true', 'catch NoMethodError',
|
16
|
+
'display 2 + 3', 'display 5 + 6', "save #{file_name}"
|
17
|
+
debug_proc(@example)
|
18
|
+
end
|
19
|
+
after do
|
20
|
+
File.delete(file_name)
|
21
|
+
end
|
30
22
|
|
31
|
-
|
32
|
-
|
33
|
-
file_contents.must_include 'set autoeval on'
|
23
|
+
it 'must save usual breakpoints' do
|
24
|
+
file_contents.must_include "break #{__FILE__}:2"
|
34
25
|
end
|
35
26
|
|
36
|
-
it 'must save
|
37
|
-
file_contents.must_include
|
27
|
+
it 'must save conditinal breakpoints' do
|
28
|
+
file_contents.must_include "break #{__FILE__}:3 if true"
|
38
29
|
end
|
39
30
|
|
40
|
-
it 'must save
|
41
|
-
file_contents.must_include '
|
31
|
+
it 'must save catchpoints' do
|
32
|
+
file_contents.must_include 'catch NoMethodError'
|
42
33
|
end
|
43
34
|
|
44
|
-
it 'must save
|
45
|
-
file_contents.must_include '
|
35
|
+
it 'must save displays' do
|
36
|
+
file_contents.must_include 'display 2 + 3'
|
46
37
|
end
|
47
38
|
|
48
|
-
|
49
|
-
|
39
|
+
describe 'saving settings' do
|
40
|
+
it 'must save autoeval' do
|
41
|
+
file_contents.must_include 'set autoeval true'
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'must save basename' do
|
45
|
+
file_contents.must_include 'set basename false'
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'must save testing' do
|
49
|
+
file_contents.must_include 'set testing true'
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'must save autolist' do
|
53
|
+
file_contents.must_include 'set autolist true'
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'must save autoirb' do
|
57
|
+
file_contents.must_include 'set autoirb false'
|
58
|
+
end
|
50
59
|
end
|
51
|
-
end
|
52
60
|
|
53
|
-
|
54
|
-
|
61
|
+
it 'must show a message about successful saving' do
|
62
|
+
check_output_includes "Saved to '#{file_name}'"
|
63
|
+
end
|
55
64
|
end
|
56
|
-
end
|
57
65
|
|
58
|
-
|
59
|
-
|
60
|
-
|
66
|
+
describe 'without filename' do
|
67
|
+
let(:file_contents) { File.read(interface.restart_file) }
|
68
|
+
after { FileUtils.rm(interface.restart_file) }
|
61
69
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
70
|
+
it 'must fabricate a filename if not provided' do
|
71
|
+
enter 'save'
|
72
|
+
debug_proc(@example)
|
73
|
+
file_contents.must_include 'set autoirb'
|
74
|
+
end
|
67
75
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
76
|
+
it 'must show a message where the file is saved' do
|
77
|
+
enter 'save'
|
78
|
+
debug_proc(@example)
|
79
|
+
check_output_includes "Saved to '#{interface.restart_file}'"
|
80
|
+
end
|
72
81
|
end
|
73
82
|
end
|
74
83
|
end
|
data/test/set_test.rb
CHANGED
@@ -1,161 +1,183 @@
|
|
1
|
-
|
1
|
+
module SetTest
|
2
|
+
class SetTestCase < TestDsl::TestCase
|
3
|
+
before do
|
4
|
+
@example = -> do
|
5
|
+
byebug
|
6
|
+
a = 2
|
7
|
+
a += 1
|
8
|
+
end
|
9
|
+
end
|
2
10
|
|
3
|
-
|
4
|
-
|
11
|
+
[:autoeval, :autolist, :autoreload, :autosave, :basename, :forcestep,
|
12
|
+
:fullpath, :post_mortem, :stack_on_error, :testing, :linetrace,
|
13
|
+
:tracing_plus].each do |setting|
|
14
|
+
describe "setting boolean #{setting} to on" do
|
15
|
+
temporary_change_hash Byebug::Setting, setting, false
|
5
16
|
|
6
|
-
|
7
|
-
|
17
|
+
it "must set #{setting} to on using on" do
|
18
|
+
enter "set #{setting} on"
|
19
|
+
debug_proc(@example)
|
20
|
+
Byebug::Setting[setting].must_equal true
|
21
|
+
end
|
8
22
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
23
|
+
it "must set #{setting} to on using 1" do
|
24
|
+
enter "set #{setting} 1"
|
25
|
+
debug_proc(@example)
|
26
|
+
Byebug::Setting[setting].must_equal true
|
27
|
+
end
|
14
28
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
29
|
+
it "must set #{setting} to on by default" do
|
30
|
+
enter "set #{setting}"
|
31
|
+
debug_proc(@example)
|
32
|
+
Byebug::Setting[setting].must_equal true
|
33
|
+
end
|
19
34
|
end
|
20
35
|
|
21
|
-
|
22
|
-
|
23
|
-
debug_file 'set'
|
24
|
-
Byebug.settings[setting].must_equal true
|
25
|
-
end
|
36
|
+
describe "setting boolean #{setting} to off" do
|
37
|
+
temporary_change_hash Byebug::Setting, setting, true
|
26
38
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
39
|
+
it "must set #{setting} to off using off" do
|
40
|
+
enter "set #{setting} off"
|
41
|
+
debug_proc(@example)
|
42
|
+
Byebug::Setting[setting].must_equal false
|
43
|
+
end
|
34
44
|
|
35
|
-
|
36
|
-
|
45
|
+
it "must set #{setting} to on using 0" do
|
46
|
+
enter "set #{setting} 0"
|
47
|
+
debug_proc(@example)
|
48
|
+
Byebug::Setting[setting].must_equal false
|
49
|
+
end
|
37
50
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
51
|
+
it "must set #{setting} to off using 'no' prefix" do
|
52
|
+
enter "set no#{setting}"
|
53
|
+
debug_proc(@example)
|
54
|
+
Byebug::Setting[setting].must_equal false
|
55
|
+
end
|
42
56
|
end
|
57
|
+
end
|
43
58
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
Byebug.settings[setting].must_equal false
|
48
|
-
end
|
59
|
+
describe 'shortcuts' do
|
60
|
+
describe 'setting' do
|
61
|
+
temporary_change_hash Byebug::Setting, :autosave, false
|
49
62
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
63
|
+
it 'must set setting if shortcut not ambiguous' do
|
64
|
+
enter 'set autos'
|
65
|
+
debug_proc(@example)
|
66
|
+
Byebug::Setting[:autosave].must_equal true
|
67
|
+
end
|
55
68
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
69
|
+
it 'must not set setting if shortcut is ambiguous' do
|
70
|
+
enter 'set auto'
|
71
|
+
debug_proc(@example)
|
72
|
+
Byebug::Setting[:autosave].must_equal false
|
73
|
+
end
|
61
74
|
end
|
62
|
-
end
|
63
|
-
end
|
64
75
|
|
65
|
-
|
66
|
-
|
76
|
+
describe 'unsetting' do
|
77
|
+
temporary_change_hash Byebug::Setting, :autosave, true
|
78
|
+
|
79
|
+
it 'must unset setting if shortcut not ambiguous' do
|
80
|
+
enter 'set noautos'
|
81
|
+
debug_proc(@example)
|
82
|
+
Byebug::Setting[:autosave].must_equal false
|
83
|
+
end
|
67
84
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
85
|
+
it 'must not set setting to off if shortcut ambiguous' do
|
86
|
+
enter 'set noauto'
|
87
|
+
debug_proc(@example)
|
88
|
+
Byebug::Setting[:autosave].must_equal true
|
89
|
+
end
|
90
|
+
end
|
72
91
|
end
|
73
|
-
end
|
74
92
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
93
|
+
describe 'testing' do
|
94
|
+
describe 'state' do
|
95
|
+
describe 'when setting "testing" to on' do
|
96
|
+
temporary_change_hash Byebug::Setting, :testing, false
|
79
97
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
98
|
+
it 'must get set' do
|
99
|
+
enter 'set testing', 'break 7', 'cont'
|
100
|
+
debug_proc(@example) {
|
101
|
+
state.must_be_kind_of Byebug::CommandProcessor::State }
|
102
|
+
end
|
84
103
|
end
|
85
|
-
end
|
86
104
|
|
87
|
-
|
88
|
-
|
105
|
+
describe 'when setting "testing" to off' do
|
106
|
+
temporary_change_hash Byebug::Setting, :testing, true
|
89
107
|
|
90
|
-
|
91
|
-
|
92
|
-
|
108
|
+
it 'must get unset' do
|
109
|
+
enter 'set notesting', 'break 7', 'cont'
|
110
|
+
debug_proc(@example) { state.must_be_nil }
|
111
|
+
end
|
93
112
|
end
|
94
113
|
end
|
95
114
|
end
|
96
|
-
end
|
97
115
|
|
98
|
-
|
99
|
-
|
116
|
+
describe 'histsize' do
|
117
|
+
temporary_change_hash Byebug::Setting, :histsize, 1
|
100
118
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
119
|
+
it 'must set maximum history size' do
|
120
|
+
enter 'set histsize 250'
|
121
|
+
debug_proc(@example)
|
122
|
+
Byebug::Setting[:histsize].must_equal 250
|
123
|
+
end
|
106
124
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
125
|
+
it 'must show a message' do
|
126
|
+
enter 'set histsize 250'
|
127
|
+
debug_proc(@example)
|
128
|
+
check_output_includes "Maximum size of byebug's command history is 250"
|
129
|
+
end
|
112
130
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
131
|
+
it 'must show an error message if no size provided' do
|
132
|
+
enter 'set histsize'
|
133
|
+
debug_proc(@example)
|
134
|
+
check_output_includes 'You must specify a value for setting :histsize'
|
135
|
+
end
|
117
136
|
end
|
118
|
-
end
|
119
137
|
|
120
|
-
|
121
|
-
|
138
|
+
describe 'histfile' do
|
139
|
+
let(:filename) { File.expand_path('.custom-byebug-hist') }
|
122
140
|
|
123
|
-
|
141
|
+
temporary_change_hash Byebug::Setting, :histfile, File.expand_path('.byebug-hist')
|
124
142
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
143
|
+
it 'must set history filename' do
|
144
|
+
enter "set histfile #{filename}"
|
145
|
+
debug_proc(@example)
|
146
|
+
Byebug::Setting[:histfile].must_equal filename
|
147
|
+
end
|
130
148
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
149
|
+
it 'must show a message' do
|
150
|
+
enter "set histfile #{filename}"
|
151
|
+
debug_proc(@example)
|
152
|
+
check_output_includes "The command history file is #{filename}"
|
153
|
+
end
|
136
154
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
155
|
+
it 'must show an error message if no filename provided' do
|
156
|
+
enter 'set histfile'
|
157
|
+
debug_proc(@example)
|
158
|
+
check_output_includes 'You must specify a value for setting :histfile'
|
159
|
+
end
|
141
160
|
end
|
142
|
-
end
|
143
161
|
|
144
|
-
|
145
|
-
|
162
|
+
[:listsize, :width].each do |setting|
|
163
|
+
describe "setting integer setting #{setting}" do
|
164
|
+
temporary_change_hash Byebug::Setting, setting, 80
|
146
165
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
166
|
+
it 'must get correctly set' do
|
167
|
+
enter "set #{setting} 120"
|
168
|
+
debug_proc(@example)
|
169
|
+
Byebug::Setting[setting].must_equal 120
|
170
|
+
end
|
171
|
+
end
|
151
172
|
end
|
152
|
-
end
|
153
173
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
174
|
+
describe 'Help' do
|
175
|
+
it 'must show help when typing just "set"' do
|
176
|
+
enter 'set', 'cont'
|
177
|
+
debug_proc(@example)
|
178
|
+
check_output_includes(/Modifies parts of byebug environment./)
|
179
|
+
check_output_includes(/List of settings supported in byebug/)
|
180
|
+
end
|
159
181
|
end
|
160
182
|
end
|
161
183
|
end
|