byebug 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/GUIDE.md +231 -0
- data/README.md +195 -7
- data/bin/byebug +1 -5
- data/byebug.gemspec +34 -35
- data/lib/byebug.rb +2 -5
- data/lib/byebug/command.rb +13 -13
- data/lib/byebug/commands/breakpoints.rb +1 -1
- data/lib/byebug/commands/control.rb +1 -1
- data/lib/byebug/commands/frame.rb +1 -1
- data/lib/byebug/commands/info.rb +1 -1
- data/lib/byebug/commands/list.rb +5 -5
- data/lib/byebug/commands/reload.rb +7 -10
- data/lib/byebug/commands/{irb.rb → repl.rb} +49 -13
- data/lib/byebug/commands/set.rb +10 -6
- data/lib/byebug/commands/show.rb +4 -7
- data/lib/byebug/commands/trace.rb +2 -2
- data/lib/byebug/context.rb +3 -5
- data/lib/byebug/helper.rb +2 -2
- data/lib/byebug/interface.rb +3 -0
- data/lib/byebug/processor.rb +2 -2
- data/lib/byebug/version.rb +1 -1
- data/old_doc/byebug.1 +1 -2
- data/old_doc/byebug.texi +125 -126
- data/old_doc/hanoi.rb +2 -3
- data/old_doc/triangle.rb +6 -7
- data/test/breakpoints_test.rb +43 -33
- data/test/display_test.rb +1 -1
- data/test/edit_test.rb +20 -15
- data/test/eval_test.rb +32 -26
- data/test/examples/list.rb +12 -1
- data/test/frame_test.rb +56 -43
- data/test/help_test.rb +11 -8
- data/test/info_test.rb +18 -13
- data/test/list_test.rb +74 -80
- data/test/method_test.rb +1 -3
- data/test/reload_test.rb +3 -3
- data/test/repl_test.rb +112 -0
- data/test/restart_test.rb +72 -70
- data/test/set_test.rb +43 -27
- data/test/show_test.rb +97 -102
- data/test/source_test.rb +6 -10
- data/test/stepping_test.rb +45 -49
- data/test/support/test_dsl.rb +47 -55
- data/test/test_helper.rb +2 -2
- data/test/trace_test.rb +4 -4
- data/test/variables_test.rb +10 -8
- metadata +9 -10
- data/old_doc/Makefile +0 -20
- data/test/examples/edit2.rb +0 -3
- data/test/irb_test.rb +0 -85
data/test/restart_test.rb
CHANGED
@@ -9,31 +9,35 @@ describe 'Restart Command' do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
describe 'usual restarting' do
|
12
|
-
|
13
|
-
force_set_const Byebug, 'BYEBUG_SCRIPT', 'byebug_script'
|
14
|
-
end
|
12
|
+
temporary_change_const Byebug, 'BYEBUG_SCRIPT', 'byebug_script'
|
15
13
|
|
16
14
|
it 'must be restarted with arguments' do
|
17
15
|
Byebug::RestartCommand.any_instance.expects(:exec).
|
18
|
-
with("#{Byebug::BYEBUG_SCRIPT} 1 2 3")
|
16
|
+
with("#{Byebug::BYEBUG_SCRIPT} #{Byebug::PROG_SCRIPT} 1 2 3")
|
19
17
|
enter 'restart 1 2 3'
|
20
18
|
debug_file 'restart'
|
21
19
|
end
|
22
20
|
|
23
|
-
|
24
|
-
Byebug::Command.settings
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
describe 'when arguments have spaces' do
|
22
|
+
temporary_change_hash Byebug::Command.settings, :argv, ['argv1', 'argv 2']
|
23
|
+
|
24
|
+
it 'must be correctly escaped' do
|
25
|
+
Byebug::RestartCommand.any_instance.expects(:exec).with \
|
26
|
+
"#{Byebug::BYEBUG_SCRIPT} #{Byebug::PROG_SCRIPT} argv1 argv\\ 2"
|
27
|
+
enter 'restart'
|
28
|
+
debug_file 'restart'
|
29
|
+
end
|
29
30
|
end
|
30
31
|
|
31
|
-
|
32
|
-
Byebug::Command.settings
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
describe 'when arguments specified by set command' do
|
33
|
+
temporary_change_hash Byebug::Command.settings, :argv, []
|
34
|
+
|
35
|
+
it 'must specify arguments by "set" command' do
|
36
|
+
Byebug::RestartCommand.any_instance.expects(:exec).
|
37
|
+
with("#{Byebug::BYEBUG_SCRIPT} #{Byebug::PROG_SCRIPT} 1 2 3")
|
38
|
+
enter 'set args 1 2 3', 'restart'
|
39
|
+
debug_file 'restart'
|
40
|
+
end
|
37
41
|
end
|
38
42
|
end
|
39
43
|
|
@@ -41,71 +45,70 @@ describe 'Restart Command' do
|
|
41
45
|
before { enter 'restart' }
|
42
46
|
|
43
47
|
describe 'reexecing' do
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
temporary_change_const Byebug, 'BYEBUG_SCRIPT', 'byebug_script'
|
49
|
+
|
50
|
+
describe 'with set args' do
|
51
|
+
temporary_change_hash Byebug::Command.settings, :argv, ['argv']
|
52
|
+
|
53
|
+
it 'must restart and show a message about reexecing' do
|
54
|
+
must_restart
|
55
|
+
debug_file 'restart'
|
56
|
+
check_output_includes \
|
57
|
+
"Re exec'ing:\n" \
|
58
|
+
"\t#{Byebug::BYEBUG_SCRIPT} #{Byebug::PROG_SCRIPT} argv"
|
59
|
+
end
|
51
60
|
end
|
52
61
|
end
|
53
62
|
|
54
|
-
describe 'no script specified
|
55
|
-
|
56
|
-
force_unset_const Byebug, 'PROG_SCRIPT'
|
57
|
-
force_set_const Byebug,
|
58
|
-
'DEFAULT_START_SETTINGS',
|
59
|
-
init: false, post_mortem: false, tracing: nil
|
60
|
-
end
|
63
|
+
describe 'no script specified' do
|
64
|
+
temporary_change_const Byebug, 'PROG_SCRIPT', :__undefined__
|
61
65
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
check_output_includes 'Don\'t know name of debugged program',
|
66
|
-
interface.error_queue
|
67
|
-
end
|
68
|
-
end
|
66
|
+
describe 'and no $0 used' do
|
67
|
+
temporary_change_const Byebug, 'DEFAULT_START_SETTINGS',
|
68
|
+
{ init: false, post_mortem: false, tracing: nil }
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
70
|
+
it 'must not restart and show error messages instead' do
|
71
|
+
must_restart.never
|
72
|
+
debug_file 'restart'
|
73
|
+
check_output_includes 'Don\'t know name of debugged program',
|
74
|
+
interface.error_queue
|
75
|
+
end
|
75
76
|
end
|
76
|
-
after { $0 = @old_prog_name }
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
78
|
+
describe 'but initialized from $0' do
|
79
|
+
it 'must use prog_script from $0' do
|
80
|
+
old_prog_name = $0
|
81
|
+
$0 = 'prog-0'
|
82
|
+
debug_file 'restart'
|
83
|
+
check_output_includes 'Ruby program prog-0 doesn\'t exist',
|
84
|
+
interface.error_queue
|
85
|
+
$0 = old_prog_name
|
86
|
+
end
|
82
87
|
end
|
83
88
|
end
|
84
89
|
|
85
90
|
describe 'no script at the specified path' do
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
91
|
+
temporary_change_const Byebug, 'PROG_SCRIPT', 'blabla'
|
92
|
+
|
93
|
+
describe 'and no restart params set' do
|
94
|
+
temporary_change_const Byebug, 'DEFAULT_START_SETTINGS',
|
95
|
+
init: false, post_mortem: false, tracing: nil
|
96
|
+
|
97
|
+
it 'must not restart' do
|
98
|
+
must_restart.never
|
99
|
+
debug_file 'restart'
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'must show an error message' do
|
103
|
+
debug_file 'restart'
|
104
|
+
check_output_includes 'Ruby program blabla doesn\'t exist',
|
105
|
+
interface.error_queue
|
106
|
+
end
|
102
107
|
end
|
103
108
|
end
|
104
109
|
|
105
110
|
describe 'byebug runner script is not specified' do
|
106
|
-
before
|
107
|
-
must_restart
|
108
|
-
end
|
111
|
+
before { must_restart }
|
109
112
|
|
110
113
|
it 'must restart anyway' do
|
111
114
|
debug_file 'restart'
|
@@ -124,16 +127,15 @@ describe 'Restart Command' do
|
|
124
127
|
end
|
125
128
|
|
126
129
|
describe 'when can\'t change the dir to INITIAL_DIR' do
|
127
|
-
|
128
|
-
force_set_const(Byebug, 'INITIAL_DIR', '/unexistent/path')
|
129
|
-
must_restart
|
130
|
-
end
|
130
|
+
temporary_change_const Byebug, 'INITIAL_DIR', '/unexistent/path'
|
131
131
|
|
132
132
|
it 'must restart anyway' do
|
133
|
+
must_restart
|
133
134
|
debug_file 'restart'
|
134
135
|
end
|
135
136
|
|
136
137
|
it 'must show an error message ' do
|
138
|
+
must_restart
|
137
139
|
debug_file 'restart'
|
138
140
|
check_output_includes \
|
139
141
|
'Failed to change initial directory /unexistent/path'
|
data/test/set_test.rb
CHANGED
@@ -4,7 +4,7 @@ describe 'Set Command' do
|
|
4
4
|
include TestDsl
|
5
5
|
|
6
6
|
describe 'setting to on' do
|
7
|
-
Byebug::Command.settings
|
7
|
+
temporary_change_hash Byebug::Command.settings, :autolist, 0
|
8
8
|
|
9
9
|
it 'must set a setting to on' do
|
10
10
|
enter 'set autolist on'
|
@@ -32,7 +32,7 @@ describe 'Set Command' do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
describe 'setting to off' do
|
35
|
-
Byebug::Command.settings
|
35
|
+
temporary_change_hash Byebug::Command.settings, :autolist, 1
|
36
36
|
|
37
37
|
it 'must set a setting to off' do
|
38
38
|
enter 'set autolist off'
|
@@ -51,10 +51,16 @@ describe 'Set Command' do
|
|
51
51
|
debug_file 'set'
|
52
52
|
Byebug::Command.settings[:autolist].must_equal 0
|
53
53
|
end
|
54
|
+
|
55
|
+
it 'must set a setting to off by "no" prefix and shortcut' do
|
56
|
+
enter 'set noautol'
|
57
|
+
debug_file 'set'
|
58
|
+
Byebug::Command.settings[:autolist].must_equal 0
|
59
|
+
end
|
54
60
|
end
|
55
61
|
|
56
62
|
describe 'messages' do
|
57
|
-
Byebug::Command.settings
|
63
|
+
temporary_change_hash Byebug::Command.settings, :autolist, 0
|
58
64
|
|
59
65
|
it 'must show a message after setting' do
|
60
66
|
enter 'set autolist on'
|
@@ -64,23 +70,35 @@ describe 'Set Command' do
|
|
64
70
|
end
|
65
71
|
|
66
72
|
describe 'testing' do
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
73
|
+
describe '$byebug_state' do
|
74
|
+
describe 'when setting "testing" to on' do
|
75
|
+
temporary_change_hash Byebug::Command.settings, :testing, 0
|
76
|
+
|
77
|
+
it 'must get set' do
|
78
|
+
enter 'set testing', 'break 3', 'cont'
|
79
|
+
debug_file('set') {
|
80
|
+
$byebug_state.must_be_kind_of Byebug::CommandProcessor::State }
|
81
|
+
end
|
82
|
+
end
|
72
83
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
84
|
+
describe 'when setting "testing" to off' do
|
85
|
+
temporary_change_hash Byebug::Command.settings, :testing, 1
|
86
|
+
|
87
|
+
it 'must get unset' do
|
88
|
+
enter 'set notesting', 'break 3', 'cont'
|
89
|
+
debug_file('set') { $byebug_state.must_be_nil }
|
90
|
+
end
|
78
91
|
end
|
79
92
|
end
|
80
93
|
|
81
|
-
|
82
|
-
|
83
|
-
|
94
|
+
describe 'basename' do
|
95
|
+
temporary_change_hash Byebug::Command.settings, :basename, false
|
96
|
+
|
97
|
+
it 'must get set if "testing" is on' do
|
98
|
+
enter 'set testing'
|
99
|
+
debug_file('set')
|
100
|
+
Byebug::Command.settings[:basename].must_equal true
|
101
|
+
end
|
84
102
|
end
|
85
103
|
end
|
86
104
|
|
@@ -120,19 +138,19 @@ describe 'Set Command' do
|
|
120
138
|
end
|
121
139
|
|
122
140
|
describe 'filename' do
|
141
|
+
let(:filename) {
|
142
|
+
File.join(ENV['HOME']||ENV['HOMEPATH']||'.', '.byebug-hist') }
|
143
|
+
|
123
144
|
it 'must set history filename' do
|
124
145
|
enter 'set history filename .byebug-hist'
|
125
146
|
debug_file 'set'
|
126
|
-
interface.histfile.must_equal
|
127
|
-
File.join(ENV['HOME']||ENV['HOMEPATH']||'.', '.byebug-hist')
|
147
|
+
interface.histfile.must_equal filename
|
128
148
|
end
|
129
149
|
|
130
150
|
it 'must show a message' do
|
131
151
|
enter 'set history filename .byebug-hist'
|
132
152
|
debug_file 'set'
|
133
|
-
check_output_includes \
|
134
|
-
'The filename in which to record the command history is ' \
|
135
|
-
"\"#{File.join(ENV['HOME']||ENV['HOMEPATH']||'.', '.byebug-hist')}\""
|
153
|
+
check_output_includes "The command history file is \"#{filename}\""
|
136
154
|
end
|
137
155
|
end
|
138
156
|
|
@@ -151,14 +169,13 @@ describe 'Set Command' do
|
|
151
169
|
end
|
152
170
|
|
153
171
|
describe 'width' do
|
154
|
-
Byebug::Command.settings
|
172
|
+
temporary_change_hash Byebug::Command.settings, :width, 20
|
173
|
+
let(:old_columns) { ENV['COLUMNS'] }
|
155
174
|
|
156
175
|
it 'must set ENV[\'COLUMNS\'] by the "set width" command' do
|
157
|
-
old_columns = ENV['COLUMNS']
|
158
176
|
begin
|
159
177
|
enter 'set width 10'
|
160
|
-
debug_file
|
161
|
-
ENV['COLUMNS'].must_equal '10'
|
178
|
+
debug_file('set') { ENV['COLUMNS'].must_equal '10' }
|
162
179
|
ensure
|
163
180
|
ENV['COLUMNS'] = old_columns
|
164
181
|
end
|
@@ -174,7 +191,7 @@ describe 'Set Command' do
|
|
174
191
|
end
|
175
192
|
|
176
193
|
describe 'Post Mortem' do
|
177
|
-
Byebug::Command.settings
|
194
|
+
temporary_change_hash Byebug::Command.settings, :autolist, 0
|
178
195
|
|
179
196
|
it 'must work in post-mortem mode' do
|
180
197
|
enter 'cont', 'set autolist on'
|
@@ -182,5 +199,4 @@ describe 'Set Command' do
|
|
182
199
|
check_output_includes 'autolist is on.'
|
183
200
|
end
|
184
201
|
end
|
185
|
-
|
186
202
|
end
|
data/test/show_test.rb
CHANGED
@@ -13,19 +13,21 @@ describe 'Show Command' do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
describe 'args' do
|
16
|
-
|
17
|
-
Byebug::Command.settings[:argv] = %w{foo bar}
|
18
|
-
end
|
16
|
+
temporary_change_hash Byebug::Command.settings, :argv, %w{foo bar}
|
19
17
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
describe 'default behaviour' do
|
19
|
+
it 'must show args' do
|
20
|
+
enter 'show args'
|
21
|
+
debug_file 'show'
|
22
|
+
check_output_includes 'Argument list to give program being debugged ' \
|
24
23
|
'when it is started is "foo bar".'
|
24
|
+
end
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
describe 'when BYEBUG_SCRIPT is defined' do
|
28
|
+
temporary_change_const Byebug, 'BYEBUG_SCRIPT', 'bla'
|
29
|
+
|
30
|
+
it 'must not show the first arg' do
|
29
31
|
enter 'show args'
|
30
32
|
debug_file 'show'
|
31
33
|
check_output_includes 'Argument list to give program being debugged ' \
|
@@ -34,141 +36,128 @@ describe 'Show Command' do
|
|
34
36
|
end
|
35
37
|
end
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
temporary_change_hash_value(Byebug::Command.settings, :autolist, 1) do
|
39
|
+
describe 'autolist' do
|
40
|
+
it 'must show default value' do
|
40
41
|
enter 'show autolist'
|
41
42
|
debug_file 'show'
|
42
43
|
check_output_includes 'autolist is on.'
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
46
|
-
|
47
|
-
|
47
|
+
describe 'autoeval' do
|
48
|
+
it 'must show default value' do
|
48
49
|
enter 'show autoeval'
|
49
50
|
debug_file 'show'
|
50
51
|
check_output_includes 'autoeval is on.'
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
54
|
-
|
55
|
-
|
55
|
+
describe 'autoreload' do
|
56
|
+
it 'must show default value' do
|
56
57
|
enter 'show autoreload'
|
57
58
|
debug_file 'show'
|
58
59
|
check_output_includes 'autoreload is on.'
|
59
60
|
end
|
60
61
|
end
|
61
62
|
|
62
|
-
|
63
|
-
Byebug::IRBCommand.any_instance.stubs(:execute)
|
64
|
-
|
63
|
+
describe 'autoirb' do
|
64
|
+
before { Byebug::IRBCommand.any_instance.stubs(:execute) }
|
65
|
+
|
66
|
+
it 'must show default value' do
|
65
67
|
enter 'show autoirb'
|
66
68
|
debug_file 'show'
|
67
|
-
check_output_includes 'autoirb is
|
69
|
+
check_output_includes 'autoirb is off.'
|
68
70
|
end
|
69
71
|
end
|
70
72
|
|
71
|
-
|
72
|
-
|
73
|
+
describe 'basename' do
|
74
|
+
it 'must show default value' do
|
73
75
|
enter 'show basename'
|
74
76
|
debug_file 'show'
|
75
|
-
check_output_includes 'basename is
|
77
|
+
check_output_includes 'basename is off.'
|
76
78
|
end
|
77
79
|
end
|
78
80
|
|
79
|
-
|
80
|
-
|
81
|
+
describe 'callstyle' do
|
82
|
+
it 'must show default value' do
|
81
83
|
enter 'show callstyle'
|
82
84
|
debug_file 'show'
|
83
|
-
check_output_includes 'Frame call-display style is
|
85
|
+
check_output_includes 'Frame call-display style is last.'
|
84
86
|
end
|
85
87
|
end
|
86
88
|
|
87
|
-
|
88
|
-
|
89
|
+
describe 'forcestep' do
|
90
|
+
it 'must show default value' do
|
89
91
|
enter 'show forcestep'
|
90
92
|
debug_file 'show'
|
91
|
-
check_output_includes 'force-stepping is
|
93
|
+
check_output_includes 'force-stepping is off.'
|
92
94
|
end
|
93
95
|
end
|
94
96
|
|
95
|
-
|
96
|
-
|
97
|
+
describe 'fullpath' do
|
98
|
+
it 'must show default value' do
|
97
99
|
enter 'show fullpath'
|
98
100
|
debug_file 'show'
|
99
101
|
check_output_includes 'Displaying frame\'s full file names is on.'
|
100
102
|
end
|
101
103
|
end
|
102
104
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
105
|
+
describe 'linetrace' do
|
106
|
+
it 'must show default value' do
|
107
|
+
enter 'show linetrace'
|
108
|
+
debug_file 'show'
|
109
|
+
check_output_includes 'line tracing is off.'
|
110
|
+
end
|
107
111
|
end
|
108
112
|
|
109
113
|
describe 'linetrace+' do
|
110
|
-
it 'must show
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
check_output_includes 'line tracing style is different consecutive lines.'
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
it 'must show a message when linetrace+ is off' do
|
119
|
-
temporary_change_hash_value(Byebug::Command.settings, :tracing_plus, false) do
|
120
|
-
enter 'show linetrace+'
|
121
|
-
debug_file 'show'
|
122
|
-
check_output_includes 'line tracing style is every line.'
|
123
|
-
end
|
114
|
+
it 'must show default value' do
|
115
|
+
enter 'show linetrace+'
|
116
|
+
debug_file 'show'
|
117
|
+
check_output_includes 'line tracing style is every line.'
|
124
118
|
end
|
125
119
|
end
|
126
120
|
|
127
|
-
|
128
|
-
|
121
|
+
describe 'listsize' do
|
122
|
+
it 'must show listsize' do
|
129
123
|
enter 'show listsize'
|
130
124
|
debug_file 'show'
|
131
125
|
check_output_includes 'Number of source lines to list is 10.'
|
132
126
|
end
|
133
127
|
end
|
134
128
|
|
135
|
-
|
136
|
-
|
137
|
-
enter 'show
|
129
|
+
describe 'trace' do
|
130
|
+
it 'must show trace' do
|
131
|
+
enter 'show trace'
|
138
132
|
debug_file 'show'
|
139
|
-
check_output_includes '
|
133
|
+
check_output_includes 'Displaying stack trace is off.'
|
140
134
|
end
|
141
135
|
end
|
142
136
|
|
143
|
-
|
144
|
-
|
145
|
-
enter 'show
|
137
|
+
describe 'version' do
|
138
|
+
it 'must show version' do
|
139
|
+
enter 'show version'
|
146
140
|
debug_file 'show'
|
147
|
-
check_output_includes
|
141
|
+
check_output_includes "byebug #{Byebug::VERSION}"
|
148
142
|
end
|
149
143
|
end
|
150
144
|
|
151
|
-
|
152
|
-
|
153
|
-
debug_file 'show'
|
154
|
-
check_output_includes "byebug #{Byebug::VERSION}"
|
155
|
-
end
|
156
|
-
|
157
|
-
it 'must show forcestep' do
|
158
|
-
temporary_change_hash_value(Byebug::Command.settings, :width, 35) do
|
145
|
+
describe 'width' do
|
146
|
+
it 'must show width' do
|
159
147
|
enter 'show width'
|
160
148
|
debug_file 'show'
|
161
|
-
check_output_includes 'width is
|
149
|
+
check_output_includes 'width is 80.'
|
162
150
|
end
|
163
151
|
end
|
164
152
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
153
|
+
describe 'unknown command' do
|
154
|
+
it 'must show a message' do
|
155
|
+
enter 'show bla'
|
156
|
+
debug_file 'show'
|
157
|
+
check_output_includes 'Unknown show command bla'
|
158
|
+
end
|
169
159
|
end
|
170
160
|
|
171
|
-
|
172
161
|
describe 'history' do
|
173
162
|
describe 'without arguments' do
|
174
163
|
before do
|
@@ -181,7 +170,7 @@ describe 'Show Command' do
|
|
181
170
|
|
182
171
|
it 'must show history file' do
|
183
172
|
check_output_includes \
|
184
|
-
/
|
173
|
+
/filename: The command history file is "hist_file\.txt"/
|
185
174
|
end
|
186
175
|
|
187
176
|
it 'must show history save setting' do
|
@@ -198,8 +187,7 @@ describe 'Show Command' do
|
|
198
187
|
interface.histfile = 'hist_file.txt'
|
199
188
|
enter 'show history filename'
|
200
189
|
debug_file 'show'
|
201
|
-
check_output_includes 'The
|
202
|
-
'history is "hist_file.txt"'
|
190
|
+
check_output_includes 'The command history file is "hist_file.txt"'
|
203
191
|
end
|
204
192
|
|
205
193
|
it 'must show history save setting' do
|
@@ -219,37 +207,46 @@ describe 'Show Command' do
|
|
219
207
|
end
|
220
208
|
|
221
209
|
describe 'commands' do
|
222
|
-
|
223
|
-
|
224
|
-
it 'must not show records from readline if there is no readline support' do
|
225
|
-
interface.readline_support = false
|
226
|
-
enter 'show commands'
|
227
|
-
debug_file 'show'
|
228
|
-
check_output_includes 'No readline support'
|
229
|
-
end
|
210
|
+
describe 'no readline support' do
|
211
|
+
before { interface.readline_support = false }
|
230
212
|
|
231
|
-
|
232
|
-
temporary_set_const(Readline, 'HISTORY', %w{aaa bbb ccc ddd eee fff}) do
|
213
|
+
it 'must not show records from readline' do
|
233
214
|
enter 'show commands'
|
234
215
|
debug_file 'show'
|
235
|
-
check_output_includes
|
236
|
-
check_output_includes /6 fff/
|
216
|
+
check_output_includes 'No readline support'
|
237
217
|
end
|
238
218
|
end
|
239
219
|
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
220
|
+
describe 'readline support' do
|
221
|
+
before { interface.readline_support = true }
|
222
|
+
|
223
|
+
describe 'show records' do
|
224
|
+
temporary_change_const Readline, 'HISTORY', %w{aaa bbb ccc ddd eee fff}
|
225
|
+
|
226
|
+
it 'must show records from readline history' do
|
227
|
+
enter 'show commands'
|
228
|
+
debug_file 'show'
|
229
|
+
check_output_includes /1 aaa/
|
230
|
+
check_output_includes /6 fff/
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
describe 'max records' do
|
235
|
+
temporary_change_const Readline, 'HISTORY', %w{aaa bbb ccc ddd eee fff ggg hhh iii jjj kkk lll mmm nnn}
|
236
|
+
|
237
|
+
it 'must show last 10 records from readline history' do
|
238
|
+
enter 'show commands'
|
239
|
+
debug_file 'show'
|
240
|
+
check_output_doesnt_include /3 ddd/
|
241
|
+
check_output_includes /4 eee/
|
242
|
+
check_output_includes /13 nnn/
|
243
|
+
end
|
247
244
|
end
|
248
|
-
end
|
249
245
|
|
250
|
-
|
251
|
-
|
252
|
-
|
246
|
+
describe 'with specified positions' do
|
247
|
+
temporary_change_const Readline, 'HISTORY', %w{aaa bbb ccc ddd eee fff ggg hhh iii jjj kkk lll mmm nnn}
|
248
|
+
|
249
|
+
it 'must show records within boundaries' do
|
253
250
|
# Really don't know why it substracts 4, and shows starting from position 6
|
254
251
|
enter 'show commands 10'
|
255
252
|
debug_file 'show'
|
@@ -257,10 +254,8 @@ describe 'Show Command' do
|
|
257
254
|
check_output_includes /6 ggg/
|
258
255
|
check_output_includes /13 nnn/
|
259
256
|
end
|
260
|
-
end
|
261
257
|
|
262
|
-
|
263
|
-
temporary_set_const(Readline, 'HISTORY', %w{aaa bbb ccc ddd eee fff ggg hhh iii jjj kkk lll mmm nnn}) do
|
258
|
+
it 'must adjust first line if it is < 0' do
|
264
259
|
enter 'show commands 3'
|
265
260
|
debug_file 'show'
|
266
261
|
check_output_includes /1 bbb/
|