Skip to content

Instantly share code, notes, and snippets.

@nagachika
Created September 30, 2011 16:36
Show Gist options
  • Save nagachika/1254301 to your computer and use it in GitHub Desktop.
Save nagachika/1254301 to your computer and use it in GitHub Desktop.
test for #5380
diff --git a/test/ruby/envutil.rb b/test/ruby/envutil.rb
index de9055f..4a8451a 100644
--- a/test/ruby/envutil.rb
+++ b/test/ruby/envutil.rb
@@ -122,7 +122,13 @@ module Test
module Assertions
public
def assert_normal_exit(testsrc, message = '', opt = {})
- out, _, status = EnvUtil.invoke_ruby(%W'-W0', testsrc, true, :merge_to_stdout, opt)
+ if opt.include?(:child_env)
+ opt = opt.dup
+ child_env = [opt.delete(:child_env)] || []
+ else
+ child_env = []
+ end
+ out, _, status = EnvUtil.invoke_ruby(child_env + %W'-W0', testsrc, true, :merge_to_stdout, opt)
pid = status.pid
faildesc = proc do
signo = status.termsig
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb
index 32b6e9f..b294c54 100644
--- a/test/ruby/test_gc.rb
+++ b/test/ruby/test_gc.rb
@@ -1,5 +1,7 @@
require 'test/unit'
+require_relative "envutil"
+
class TestGc < Test::Unit::TestCase
class S
def initialize(a)
@@ -78,4 +80,12 @@ class TestGc < Test::Unit::TestCase
ensure
GC.stress = prev_stress
end
+
+ def test_gc_parameter
+ env = {
+ "RUBY_GC_MALLOC_LIMIT" => "60000000",
+ "RUBY_HEAP_MIN_SLOTS" => "100000"
+ }
+ assert_normal_exit("1", "[ruby-core:39777]", :child_env => env)
+ end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment