diff options
author | lukeg <[email protected]> | 2023-01-12 12:05:07 -0500 |
---|---|---|
committer | Jemma Issroff <[email protected]> | 2023-10-26 13:07:12 -0300 |
commit | b57b7acc20f46b77809d9882ba3fc9169c2610ce () | |
tree | e17bda5482a6ad6f24056e9dcbffa0e28edd0de3 /test | |
parent | 4f8a33eb055d5fed76851ac8194851ffb8f79b48 (diff) |
add more shapes tests
-rw-r--r-- | test/ruby/test_shapes.rb | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -388,6 +388,8 @@ class TestShapes < Test::Unit::TestCase assert_predicate RubyVM::Shape.of(tc), :too_complex? tc.freeze assert_raise(FrozenError) { tc.a3_m } end def test_read_undefined_iv_after_complex @@ -397,6 +399,7 @@ class TestShapes < Test::Unit::TestCase tc.send("a#{RubyVM::Shape::SHAPE_MAX_VARIATIONS}_m") assert_predicate RubyVM::Shape.of(tc), :too_complex? assert_equal nil, tc.iv_not_defined end def test_shape_order @@ -447,7 +450,10 @@ class TestShapes < Test::Unit::TestCase class TestObject; end def test_new_obj_has_t_object_shape - assert_shape_equal(RubyVM::Shape.root_shape, RubyVM::Shape.of(TestObject.new).parent) end def test_str_has_root_shape @@ -474,6 +480,10 @@ class TestShapes < Test::Unit::TestCase assert_equal(RubyVM::Shape::SPECIAL_CONST_SHAPE_ID, RubyVM::Shape.of(nil).id) end def test_basic_shape_transition omit "Failing with RJIT for some reason" if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? obj = Example.new @@ -487,7 +497,7 @@ class TestShapes < Test::Unit::TestCase shape = shape.parent assert_equal(RubyVM::Shape.root_shape.id, shape.id) - assert_equal(obj.instance_variable_get(:@a), 1) end def test_different_objects_make_same_transition @@ -538,6 +548,15 @@ class TestShapes < Test::Unit::TestCase assert_shape_equal(RubyVM::Shape.of(obj), RubyVM::Shape.of(obj2)) end def test_freezing_and_cloning_object_with_ivars obj = Example.new.freeze obj2 = obj.clone(freeze: true) |