summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAugustin Gottlieb <33221555+aguspe@users.noreply.github.com>2026-01-23 03:00:37 +0100
committerGitHub <noreply@github.com>2026-01-23 11:00:37 +0900
commit6ef0eb29c6579db58e2cf3407b41d58c687ee742 (patch)
tree1c8adf12caf9f2d0a83763bdddc1b64b559e123c /test
parent1d497946af51e49e84da6a60096364bf1ad277f8 (diff)
Add early type validation for ObjectSpace.memsize_of_all klass argument
Diffstat (limited to 'test')
-rw-r--r--test/objspace/test_objspace.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb
index 78947a095b..8b369c3894 100644
--- a/test/objspace/test_objspace.rb
+++ b/test/objspace/test_objspace.rb
@@ -54,7 +54,11 @@ class TestObjSpace < Test::Unit::TestCase
assert_operator(a, :>, b)
assert_operator(a, :>, 0)
assert_operator(b, :>, 0)
- assert_raise(TypeError) {ObjectSpace.memsize_of_all('error')}
+ assert_kind_of(Integer, ObjectSpace.memsize_of_all(Enumerable))
+ end
+
+ def test_memsize_of_all_with_wrong_type
+ assert_raise(TypeError) { ObjectSpace.memsize_of_all(Object.new) }
end
def test_count_objects_size