Sha256: 38c44a62fcd8716c849f3a1cd30508a549df62442a08475bc0c7bec55c1522f6

Contents?: true

Size: 696 Bytes

Versions: 1

Compression:

Stored size: 696 Bytes

Contents

require 'helper'

module Syck
  class TestGC < Test::Unit::TestCase
    def setup
      @big_array = 20.times.map do |i|
        h = {}
        %w[a b c].each do |k|
          h[k] = Random.bytes(16).unpack('H*').first
        end
        %w[d e f].each do |k|
          h[k] = Random.rand(0...100_000)
        end
        h
      end
      GC.stress = true
    end

    def teardown
      GC.stress = false
    end

    def test_dump_load_many_hashes
      yaml = Syck.dump(@big_array)
      2.times { Syck.load(yaml) }
      # If it doesn't segfault, it passed
    end

    def test_dump_parse_many_hashes
      yaml = Syck.dump(@big_array)
      2.times { Syck.parse(yaml) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
syck-1.5.1 test/test_gc.rb