File: test_helper.rb

package info (click to toggle)
ruby-liquid-c 4.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 504 kB
  • sloc: ansic: 3,866; ruby: 1,151; makefile: 7
file content (20 lines) | stat: -rw-r--r-- 605 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

require "minitest/autorun"
require "liquid/c"

if GC.respond_to?(:verify_compaction_references)
  # This method was added in Ruby 3.0.0. Calling it this way asks the GC to
  # move objects around, helping to find object movement bugs.
  begin
    GC.verify_compaction_references(double_heap: true, toward: :empty)
    # Enable auto-compaction in the GC if supported.
    if GC.respond_to?(:auto_compact=)
      GC.auto_compact = true
    end
  rescue NotImplementedError
    puts "W: GC compaction not suppported by platform"
  end
end

GC.stress = true if ENV["GC_STRESS"]