summaryrefslogtreecommitdiff
path: root/test/objspace/test_objspace.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/objspace/test_objspace.rb')
-rw-r--r--test/objspace/test_objspace.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb
index 3c22dae551..345b00f737 100644
--- a/test/objspace/test_objspace.rb
+++ b/test/objspace/test_objspace.rb
@@ -1,5 +1,6 @@
require "test/unit"
require "objspace"
+require_relative "../ruby/envutil"
class TestObjSpace < Test::Unit::TestCase
def test_memsize_of
@@ -23,6 +24,17 @@ class TestObjSpace < Test::Unit::TestCase
ObjectSpace.memsize_of(//.match("")))
end
+ def test_argf_memsize
+ size = ObjectSpace.memsize_of(ARGF)
+ assert_kind_of(Integer, size)
+ assert_operator(size, :>, 0)
+ argf = ARGF.dup
+ argf.inplace_mode = nil
+ size = ObjectSpace.memsize_of(argf)
+ argf.inplace_mode = "inplace_mode_suffix"
+ assert_equal(size + 20, ObjectSpace.memsize_of(argf))
+ end
+
def test_memsize_of_all
assert_kind_of(Integer, a = ObjectSpace.memsize_of_all)
assert_kind_of(Integer, b = ObjectSpace.memsize_of_all(String))