1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

updated tests for new _pry_ parameter being passed to before_session hook

This commit is contained in:
John Mair 2011-09-08 03:26:06 +12:00
parent c27bd40188
commit 0eca0f1aa9
3 changed files with 8 additions and 9 deletions

View file

@ -137,7 +137,7 @@ class Pry
# Initialize the repl session.
# @param [Binding] target The target binding for the session.
def repl_prologue(target)
exec_hook :before_session, output, target
exec_hook :before_session, output, target, self
initialize_special_locals(target)
@input_array << nil # add empty input so inp and out match
@ -150,7 +150,7 @@ class Pry
# @param [Binding] target The target binding for the session.
# @return [Object] The return value of the repl session (if one exists).
def repl_epilogue(target, break_data)
exec_hook :after_session, output, target
exec_hook :after_session, output, target, self
Pry.active_sessions -= 1
binding_stack.pop

View file

@ -19,7 +19,6 @@ describe Pry::InputCompleter do
if !jruby?
it "should not crash if there's a Module that has a symbolic name." do
completer = Pry::InputCompleter.build_completion_proc(Pry.binding_for(Object.new))
binding.pry
lambda{ completer.call "a.to_s." }.should.not.raise Exception
end
end

View file

@ -1199,8 +1199,8 @@ describe Pry do
it 'should set the hooks default, and the default should be overridable' do
Pry.input = InputTester.new("exit-all")
Pry.hooks = {
:before_session => proc { |out,_| out.puts "HELLO" },
:after_session => proc { |out,_| out.puts "BYE" }
:before_session => proc { |out,_,_| out.puts "HELLO" },
:after_session => proc { |out,_,_| out.puts "BYE" }
}
str_output = StringIO.new
@ -1213,8 +1213,8 @@ describe Pry do
str_output = StringIO.new
Pry.new(:output => str_output,
:hooks => {
:before_session => proc { |out,_| out.puts "MORNING" },
:after_session => proc { |out,_| out.puts "EVENING" }
:before_session => proc { |out,_,_| out.puts "MORNING" },
:after_session => proc { |out,_,_| out.puts "EVENING" }
}
).repl
@ -1226,7 +1226,7 @@ describe Pry do
str_output = StringIO.new
Pry.new(:output => str_output,
:hooks => {
:before_session => proc { |out,_| out.puts "OPEN" }
:before_session => proc { |out,_,_| out.puts "OPEN" }
}
).repl
@ -1236,7 +1236,7 @@ describe Pry do
str_output = StringIO.new
Pry.new(:output => str_output,
:hooks => {
:after_session => proc { |out,_| out.puts "CLOSE" }
:after_session => proc { |out,_,_| out.puts "CLOSE" }
}
).repl