2010-12-21 14:03:52 +00:00
|
|
|
class Object
|
|
|
|
def test_method
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class InputTester
|
2010-12-24 08:30:51 +00:00
|
|
|
def initialize(*actions)
|
|
|
|
@orig_actions = actions.dup
|
|
|
|
@actions = actions
|
2010-12-21 14:03:52 +00:00
|
|
|
end
|
|
|
|
|
2011-01-09 11:51:45 +00:00
|
|
|
def readline(*)
|
2010-12-21 14:03:52 +00:00
|
|
|
@actions.shift
|
|
|
|
end
|
|
|
|
|
|
|
|
def rewind
|
2011-01-07 12:18:09 +00:00
|
|
|
@actions = @orig_actions.dup
|
2010-12-21 14:03:52 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-01-05 03:23:11 +00:00
|
|
|
class CommandTester
|
|
|
|
def commands
|
|
|
|
@commands ||= {
|
2011-01-05 22:07:06 +00:00
|
|
|
"command1" => proc { |opts| opts[:output].puts "command1"; opts[:val].clear },
|
|
|
|
/command2\s*(.*)/ => proc do |opts|
|
2011-01-05 03:23:11 +00:00
|
|
|
arg = opts[:captures].first
|
|
|
|
opts[:output].puts arg
|
2011-01-05 22:07:06 +00:00
|
|
|
opts[:val].clear
|
2011-01-05 03:23:11 +00:00
|
|
|
end
|
|
|
|
}
|
2010-12-21 14:03:52 +00:00
|
|
|
end
|
|
|
|
end
|