mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
32 lines
542 B
Ruby
32 lines
542 B
Ruby
class Object
|
|
def test_method
|
|
end
|
|
end
|
|
|
|
class InputTester
|
|
def initialize(*actions)
|
|
@orig_actions = actions.dup
|
|
@actions = actions
|
|
end
|
|
|
|
def read(*)
|
|
@actions.shift
|
|
end
|
|
|
|
def rewind
|
|
@actions = @orig_actions
|
|
end
|
|
end
|
|
|
|
class CommandTester
|
|
def commands
|
|
@commands ||= {
|
|
"command1" => proc { |opts| opts[:output].puts "command1"; opts[:val].clear },
|
|
/command2\s*(.*)/ => proc do |opts|
|
|
arg = opts[:captures].first
|
|
opts[:output].puts arg
|
|
opts[:val].clear
|
|
end
|
|
}
|
|
end
|
|
end
|