diff options
author | Kyrylo Silin <silin@kyrylo.org> | 2019-05-04 18:09:57 +0300 |
---|---|---|
committer | Kyrylo Silin <silin@kyrylo.org> | 2019-05-04 23:17:59 +0300 |
commit | e6ac84e99c0e32dc2641f85945594feeaf68051b (patch) | |
tree | a6c128fc53b871f83b1b286343e47d3779fefa3e /spec/commands/cd_spec.rb | |
parent | 8f6c792ae39d130fe132ef1d50ac9dd4a8469a6f (diff) | |
download | pry-e6ac84e99c0e32dc2641f85945594feeaf68051b.tar.gz |
control_d_handler: don't mutate eval_string within the handler
This is a preparational step for #1824
(Enabling `# frozen_string_literal: true` in `~/.pryc` crashes most operations)
Alternative to https://github.com/pry/pry/pull/2030
(config: delete the `control_d_handler` option)
We had to jump a few hoops to change how the handler works. The problem is that
mutation is the default expected behaviour. Therefore, we had to change its
API. There's no need to pass `eval_string` because `pry_instance` already has it
as an attribute.
`config.control_d_handler` is a proxy proc, to preserve backwards compatibility
with users of old signature (one known user is Pry Byebug). The handler will
emit a warning if the old signature is used.
Diffstat (limited to 'spec/commands/cd_spec.rb')
-rw-r--r-- | spec/commands/cd_spec.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/commands/cd_spec.rb b/spec/commands/cd_spec.rb index ae715a3a..5ea64861 100644 --- a/spec/commands/cd_spec.rb +++ b/spec/commands/cd_spec.rb @@ -129,7 +129,7 @@ describe 'cd' do describe 'when using ^D (Control-D) key press' do it 'should keep correct old binding' do @t.eval 'cd :john_dogg', 'cd :mon_dogg', 'cd :kyr_dogg', - 'Pry.config.control_d_handler.call("", pry_instance)' + 'Pry.config.control_d_handler.call(pry_instance)' expect(@t.mapped_binding_stack).to eq [@o, :john_dogg, :mon_dogg] @t.eval 'cd -' |