Skip to content

Commit

Permalink
Change skip_breakpoint to only skip
Browse files Browse the repository at this point in the history
  • Loading branch information
renatocassino committed Jan 20, 2019
1 parent 4967e5f commit 4b95ef1
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 54 deletions.
74 changes: 37 additions & 37 deletions GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1441,43 +1441,43 @@ display a short list of named classes of commands
```bash
(byebug) help
break -- Sets breakpoints in the source code
catch -- Handles exception catchpoints
condition -- Sets conditions on breakpoints
continue -- Runs until program ends, hits a breakpoint or reaches a line
delete -- Deletes breakpoints
disable -- Disables breakpoints or displays
display -- Evaluates expressions every time the debugger stops
down -- Moves to a lower frame in the stack trace
edit -- Edits source files
enable -- Enables breakpoints or displays
finish -- Runs the program until frame returns
frame -- Moves to a frame in the call stack
help -- Helps you using byebug
history -- Shows byebug's history of commands
info -- Shows several informations about the program being debugged
interrupt -- Interrupts the program
irb -- Starts an IRB session
kill -- Sends a signal to the current process
list -- Lists lines of source code
method -- Shows methods of an object, class or module
next -- Runs one or more lines of code
pry -- Starts a Pry session
quit -- Exits byebug
restart -- Restarts the debugged program
save -- Saves current byebug session to a file
set -- Modifies byebug settings
show -- Shows byebug settings
skipbreakpoint -- Runs until the next breakpoint as long as it is different from the current one
source -- Restores a previously saved byebug session
step -- Steps into blocks or methods one or more times
thread -- Commands to manipulate threads
tracevar -- Enables tracing of a global variable
undisplay -- Stops displaying all or some expressions when program stops
untracevar -- Stops tracing a global variable
up -- Moves to a higher frame in the stack trace
var -- Shows variables and its values
where -- Displays the backtrace
break -- Sets breakpoints in the source code
catch -- Handles exception catchpoints
condition -- Sets conditions on breakpoints
continue -- Runs until program ends, hits a breakpoint or reaches a line
delete -- Deletes breakpoints
disable -- Disables breakpoints or displays
display -- Evaluates expressions every time the debugger stops
down -- Moves to a lower frame in the stack trace
edit -- Edits source files
enable -- Enables breakpoints or displays
finish -- Runs the program until frame returns
frame -- Moves to a frame in the call stack
help -- Helps you using byebug
history -- Shows byebug's history of commands
info -- Shows several informations about the program being debugged
interrupt -- Interrupts the program
irb -- Starts an IRB session
kill -- Sends a signal to the current process
list -- Lists lines of source code
method -- Shows methods of an object, class or module
next -- Runs one or more lines of code
pry -- Starts a Pry session
quit -- Exits byebug
restart -- Restarts the debugged program
save -- Saves current byebug session to a file
set -- Modifies byebug settings
show -- Shows byebug settings
skip -- Runs until the next breakpoint as long as it is different from the current one
source -- Restores a previously saved byebug session
step -- Steps into blocks or methods one or more times
thread -- Commands to manipulate threads
tracevar -- Enables tracing of a global variable
undisplay -- Stops displaying all or some expressions when program stops
untracevar -- Stops tracing a global variable
up -- Moves to a higher frame in the stack trace
var -- Shows variables and its values
where -- Displays the backtrace
```
Expand Down
2 changes: 1 addition & 1 deletion lib/byebug/commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
require "byebug/commands/save"
require "byebug/commands/set"
require "byebug/commands/show"
require "byebug/commands/skip_breakpoint"
require "byebug/commands/skip"
require "byebug/commands/source"
require "byebug/commands/step"
require "byebug/commands/thread"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

module Byebug
#
# Allows the user to continue execution until the next breakpoint, if
# the breakpoint file or line be different, stop again
# Allows the user to continue execution until the next breakpoint, as
# long as it is different from the current one
#
class SkipBreakpointCommand < Command
class SkipCommand < Command
include Helpers::ParseHelper

class << self
Expand All @@ -24,12 +24,12 @@ def file_path
end

def self.regexp
/^\s* s(?:kip_)?(?:b(?:reak(?:point)?)?) \s*$/x
/^\s* sk(?:ip)? \s*$/x
end

def self.description
<<-DESCRIPTION
s[kip_]b[reak[point]]
sk[ip]
#{short_description}
DESCRIPTION
Expand All @@ -39,8 +39,8 @@ def self.short_description
"Runs until the next breakpoint as long as it is different from the current one"
end

def keep_execution(file, line)
[self.class.file_path, self.class.file_line] == [file, line]
def keep_execution
[self.class.file_path, self.class.file_line] == [frame.file, frame.line]
end

def reset_attributes
Expand All @@ -50,7 +50,7 @@ def reset_attributes
def auto_run
return false unless self.class.always_run == 2

keep_execution(frame.file, frame.line) ? processor.proceed! : reset_attributes
keep_execution ? processor.proceed! : reset_attributes
true
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Byebug
#
# Tests for continue command
#
class SkipBreakpointTest < TestCase
class SkipTest < TestCase
def program
strip_line_numbers <<-RUBY
1: module Byebug
Expand All @@ -25,22 +25,21 @@ def program
14: c = 5
15:
16: result = #{example_class}.new.factor(c)
17: byebug
18: "Result is: " + result.to_s
19: end
17: "Result is: " + result.to_s
18: end
RUBY
end

def test_continues_until_the_end_if_no_line_specified_and_no_breakpoints
enter "skip_breakpoint"
enter "break 17", "skip"

debug_code(program) { assert_location example_path, 18 }
debug_code(program) { assert_location example_path, 17 }
end

def test_works_in_abbreviated_mode_too
enter "sb"
enter "break 17", "sk"

debug_code(program) { assert_location example_path, 18 }
debug_code(program) { assert_location example_path, 17 }
end
end
end

0 comments on commit 4b95ef1

Please sign in to comment.