Skip to content

Commit

Permalink
Make to be able to handle -2 arity parser in ParserTestDriver
Browse files Browse the repository at this point in the history
TextParser::RegexpParser.method(:initialize).arity is -2.
  • Loading branch information
cosmo0920 committed Nov 18, 2015
1 parent 5401cd9 commit 41f4907
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/fluent/test/parser_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
module Fluent
module Test
class ParserTestDriver
def initialize(klass_or_str, format=nil, &block)
def initialize(klass_or_str, format=nil, conf={}, &block)
if klass_or_str.is_a?(Class)
if block
# Create new class for test w/ overwritten methods
Expand All @@ -27,6 +27,8 @@ def initialize(klass_or_str, format=nil, &block)
klass_or_str = Class.new(klass_or_str)
when 1
klass_or_str = Class.new(klass_or_str, format)
when -2
klass_or_str = Class.new(klass_or_str, format, conf)
end
klass_or_str.module_eval(&block)
end
Expand All @@ -35,6 +37,8 @@ def initialize(klass_or_str, format=nil, &block)
@instance = klass_or_str.new
when 1
@instance = klass_or_str.new(format)
when -2
@instance = klass_or_str.new(format, conf)
end
elsif klass_or_str.is_a?(String)
@instance = TextParser::TEMPLATE_REGISTRY.lookup(klass_or_str).call
Expand Down

0 comments on commit 41f4907

Please sign in to comment.