InputTestDriver
# File lib/fluent/test/output_test.rb, line 100 def emit(record, time=Time.now) slicer = @instance.instance_eval{@time_slicer} key = slicer.call(time.to_i) @entries[key] = [] unless @entries.has_key?(key) @entries[key] << [time.to_i, record] self end
# File lib/fluent/test/output_test.rb, line 108 def expect_format(str) (@expected_buffer ||= '') << str end
# File lib/fluent/test/output_test.rb, line 112 def run(&block) result = [] super { buffer = '' @entries.keys.each {|key| es = ArrayEventStream.new(@entries[key]) @instance.emit(@tag, es, NullOutputChain.instance) buffer << @instance.format_stream(@tag, es) } block.call if block if @expected_buffer assert_equal(@expected_buffer, buffer) end chunks = @instance.instance_eval { @buffer.instance_eval { chunks = [] @map.keys.each {|key| chunks.push(@map.delete(key)) } chunks } } chunks.each { |chunk| result.push(@instance.write(chunk)) } } result end
Generated with the Darkfish Rdoc Generator 2.