1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00
pry--pry/test/test_helper.rb
John Mair aa03df81ca * added tests (test.rb and test_helper.rb files)
* defined input/output accessors for Pry class to set global defaults for input and output (overridable by specific instances).
* Added reset_defaults method to set input/output and prompt lambdas back to defaults
* added output callback for 'cd' command
* changed eval_string += val to eval_string << val in Pry#r method, for performance reasons (no copy made with <<)
2010-12-24 01:16:04 +13:00

38 lines
550 B
Ruby

class Object
def test_method
end
end
class InputTester
def initialize(actions)
@orig_actions = Array(actions.dup)
@actions = Array(actions)
end
def read(*)
@actions.shift
end
def rewind
@actions = @orig_actions
end
end
class OutputTester
attr_reader :output_buffer
def initialize
@output_buffer = ""
end
def print(val)
@output_buffer = val
puts val.inspect
end
def method_missing(meth_name, *args, &block)
define_singleton_method("#{meth_name}_invoked") { true }
end
end