Sha256: d9fa57d271bcd95d5d7e9aac8e3909edcbbe57dd0783ba0f2e02fd81057f0919

Contents?: true

Size: 709 Bytes

Versions: 1

Compression:

Stored size: 709 Bytes

Contents

require 'marshal/structure/test_case'

class TestMarshalStructure < Marshal::Structure::TestCase

  def test_class_load
    ary = %W[\x04 \x08 T]
    def ary.getc
      shift
    end

    result = @MS.load ary

    assert_equal :true, result
  end

  def test_count_allocations
    assert_equal 1, @MS.new("\x04\x08[\x06T").count_allocations
  end

  def test_load
    assert_equal [true], @MS.new("\x04\x08[\x06T").load
  end

  def test_structure
    assert_equal [:array, 0, 1, :true], @MS.new("\x04\x08[\x06T").structure
  end

  def test_token_stream
    stream = @MS.new("\x04\x08[\x06T").token_stream

    assert_kind_of Enumerator, stream

    assert_equal [:array, 1, :true], stream.to_a
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
marshal-structure-2.0 test/test_marshal_structure.rb