Skip to content

Commit

Permalink
path option should supersede skip_path config
Browse files Browse the repository at this point in the history
  • Loading branch information
st0012 committed Nov 22, 2021
1 parent 74db2f7 commit fcfa180
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/debug/breakpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,15 @@ def initialize pat, cond: nil, command: nil, path: nil

def setup
@tp = TracePoint.new(:raise){|tp|
next if skip_path?(tp.path)
exc = tp.raised_exception
next if SystemExit === exc
next if @path && !tp.path.match?(@path)

if @path
next if !tp.path.match?(@path)
elsif skip_path?(tp.path)
next
end

next if !safe_eval(tp.binding, @cond) if @cond
should_suspend = false

Expand Down
19 changes: 19 additions & 0 deletions test/debug/catch_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,5 +186,24 @@ def test_catch_only_stops_when_path_matches
end
end
end

def test_the_path_option_supersede_skip_path_config
with_extra_tempfile do |extra_file|
debug_code(program(extra_file.path)) do
type "config set skip_path #{extra_file.path}"
type 'c'
assert_finish
end

debug_code(program(extra_file.path)) do
type "config set skip_path #{extra_file.path}"
type "catch RuntimeError path: #{extra_file.path}"
type 'c'
assert_line_text(/bar/)
type 'c'
assert_finish
end
end
end
end
end

0 comments on commit fcfa180

Please sign in to comment.