Sha256: 2de5de94c3434e2307221340121bea64328bb90921726ea6c5909112f9ff934e

Contents?: true

Size: 722 Bytes

Versions: 31

Compression:

Stored size: 722 Bytes

Contents

# encoding: utf-8
require_relative 'spec_helper'

describe FileWatch::BufferedTokenizer do

  context "when using the default delimiter" do
    it "splits the lines correctly" do
      expect(subject.extract("hello\nworld\n")).to eq ["hello", "world"]
    end

    it "holds partial lines back until a token is found" do
      buffer = described_class.new
      expect(buffer.extract("hello\nwor")).to eq ["hello"]
      expect(buffer.extract("ld\n")).to eq ["world"]
    end
  end

  context "when passing a custom delimiter" do
    subject { FileWatch::BufferedTokenizer.new("\r\n") }

    it "splits the lines correctly" do
      expect(subject.extract("hello\r\nworld\r\n")).to eq ["hello", "world"]
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
logstash-input-file-4.4.6 spec/filewatch/buftok_spec.rb
logstash-input-file-4.4.5 spec/filewatch/buftok_spec.rb
logstash-input-file-4.4.4 spec/filewatch/buftok_spec.rb
logstash-input-file-4.4.3 spec/filewatch/buftok_spec.rb
logstash-input-file-4.4.2 spec/filewatch/buftok_spec.rb
logstash-input-file-4.4.1 spec/filewatch/buftok_spec.rb
logstash-input-file-4.4.0 spec/filewatch/buftok_spec.rb
logstash-input-file-4.3.1 spec/filewatch/buftok_spec.rb
logstash-input-file-4.3.0 spec/filewatch/buftok_spec.rb
logstash-input-file-4.2.4 spec/filewatch/buftok_spec.rb
logstash-input-file-4.2.3 spec/filewatch/buftok_spec.rb
logstash-input-file-4.2.2 spec/filewatch/buftok_spec.rb
logstash-input-file-4.2.1 spec/filewatch/buftok_spec.rb
logstash-input-file-4.2.0 spec/filewatch/buftok_spec.rb
logstash-input-file-4.1.18 spec/filewatch/buftok_spec.rb
logstash-input-file-4.1.17 spec/filewatch/buftok_spec.rb
logstash-input-file-4.1.16 spec/filewatch/buftok_spec.rb
logstash-input-file-4.1.15 spec/filewatch/buftok_spec.rb
logstash-input-file-4.1.14 spec/filewatch/buftok_spec.rb
logstash-input-file-4.1.13 spec/filewatch/buftok_spec.rb