Sha256: cbd8a2de3889b267c9f3bc41f0f7b3144b70184d82795778111f74ee68f3f82d

Contents?: true

Size: 925 Bytes

Versions: 25

Compression:

Stored size: 925 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'test_helper'
require 'hexapdf/tokenizer'
require 'stringio'
require_relative 'common_tokenizer_tests'

describe HexaPDF::Tokenizer do
  include CommonTokenizerTests

  def create_tokenizer(str)
    @tokenizer = HexaPDF::Tokenizer.new(StringIO.new(str.b))
  end

  it "handles object references" do
    create_tokenizer("1 0 R 2 15 R ")
    assert_equal(HexaPDF::Reference.new(1, 0), @tokenizer.next_token)
    assert_equal(HexaPDF::Reference.new(2, 15), @tokenizer.next_token)
    @tokenizer.pos = 0
    assert_equal(HexaPDF::Reference.new(1, 0), @tokenizer.next_object)
    assert_equal(HexaPDF::Reference.new(2, 15), @tokenizer.next_object)
  end

  it "next_token: should not fail when resetting the position (due to use of an internal buffer)" do
    create_tokenizer("0 1 2 3 4 " * 4000)
    4000.times do
      5.times {|i| assert_equal(i, @tokenizer.next_token) }
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
hexapdf-0.14.2 test/hexapdf/test_tokenizer.rb
hexapdf-0.14.1 test/hexapdf/test_tokenizer.rb
hexapdf-0.14.0 test/hexapdf/test_tokenizer.rb
hexapdf-0.13.0 test/hexapdf/test_tokenizer.rb
hexapdf-0.12.3 test/hexapdf/test_tokenizer.rb
hexapdf-0.12.2 test/hexapdf/test_tokenizer.rb
hexapdf-0.12.1 test/hexapdf/test_tokenizer.rb
hexapdf-0.12.0 test/hexapdf/test_tokenizer.rb
hexapdf-0.11.9 test/hexapdf/test_tokenizer.rb
hexapdf-0.11.8 test/hexapdf/test_tokenizer.rb
hexapdf-0.11.7 test/hexapdf/test_tokenizer.rb
hexapdf-0.11.6 test/hexapdf/test_tokenizer.rb
hexapdf-0.11.5 test/hexapdf/test_tokenizer.rb
hexapdf-0.11.4 test/hexapdf/test_tokenizer.rb
hexapdf-0.11.3 test/hexapdf/test_tokenizer.rb
hexapdf-0.11.2 test/hexapdf/test_tokenizer.rb
hexapdf-0.11.1 test/hexapdf/test_tokenizer.rb
hexapdf-0.11.0 test/hexapdf/test_tokenizer.rb
hexapdf-0.10.0 test/hexapdf/test_tokenizer.rb
hexapdf-0.9.3 test/hexapdf/test_tokenizer.rb