Skip to content

Commit

Permalink
Fix crash when running untracevar with not existing global variable
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Oct 13, 2020
1 parent 5a03428 commit 99c0d0a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixed

* [#741](https://github.com/deivid-rodriguez/byebug/pull/741): Small consistency issues in help messages.
* [#743](https://github.com/deivid-rodriguez/byebug/pull/743): `untracevar` command crashing when giving a non existent global variable.

### Removed

Expand Down
2 changes: 1 addition & 1 deletion lib/byebug/commands/untracevar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def execute
untrace_var(:"#{var}")
puts pr("trace.messages.undo", var: var)
else
errmsg pr("trace.errors.not_global", var: var)
errmsg pr("trace.errors.var_is_not_global", name: var)
end
end
end
Expand Down
7 changes: 7 additions & 0 deletions test/commands/untracevar_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,12 @@ def test_untracevar_help

check_output_includes "Stops tracing a global variable."
end

def test_untracevar_not_global
enter "untracevar $foo"
debug_code(minimal_program)

check_error_includes "'$foo' is not a global variable."
end
end
end

0 comments on commit 99c0d0a

Please sign in to comment.