diff options
| author | Jean Boussier <jean.boussier@gmail.com> | 2026-05-06 08:42:37 +0200 |
|---|---|---|
| committer | Jean Boussier <jean.boussier@gmail.com> | 2026-05-06 10:10:16 +0200 |
| commit | 4eeec614bb9379ebac78ecc4fa98238a8311d9eb (patch) | |
| tree | 5be48ea6e8a2cf631490d993ffa0ef4702513b44 /test | |
| parent | 678d86f5e46d57432169d0d5eaf71a41c6d21526 (diff) | |
shapes: Rename `TOO_COMPLEX` in just `COMPLEX`
The `too_` prefix wasn't consistently used and just make the
thing longer for no benefit.
Diffstat (limited to 'test')
| -rw-r--r-- | test/objspace/test_objspace.rb | 14 | ||||
| -rw-r--r-- | test/ruby/test_gc_compact.rb | 2 | ||||
| -rw-r--r-- | test/ruby/test_marshal.rb | 6 | ||||
| -rw-r--r-- | test/ruby/test_object.rb | 10 | ||||
| -rw-r--r-- | test/ruby/test_object_id.rb | 12 | ||||
| -rw-r--r-- | test/ruby/test_shapes.rb | 106 |
6 files changed, 75 insertions, 75 deletions
diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb index 8d019e587a..faa22f1424 100644 --- a/test/objspace/test_objspace.rb +++ b/test/objspace/test_objspace.rb @@ -376,7 +376,7 @@ class TestObjSpace < Test::Unit::TestCase if defined?(RubyVM::Shape) class TooComplex; end - def test_dump_too_complex_shape + def test_dump_complex_shape omit "flaky test" RubyVM::Shape::SHAPE_MAX_VARIATIONS.times do @@ -385,26 +385,26 @@ class TestObjSpace < Test::Unit::TestCase tc = TooComplex.new info = ObjectSpace.dump(tc) - assert_not_match(/"too_complex_shape"/, info) + assert_not_match(/"complex_shape"/, info) tc.instance_variable_set(:@new_ivar, 1) info = ObjectSpace.dump(tc) - assert_match(/"too_complex_shape":true/, info) + assert_match(/"complex_shape":true/, info) if defined?(JSON) - assert_true(JSON.parse(info)["too_complex_shape"]) + assert_true(JSON.parse(info)["complex_shape"]) end end end class NotTooComplex ; end - def test_dump_not_too_complex_shape + def test_dump_not_complex_shape tc = NotTooComplex.new tc.instance_variable_set(:@new_ivar, 1) info = ObjectSpace.dump(tc) - assert_not_match(/"too_complex_shape"/, info) + assert_not_match(/"complex_shape"/, info) if defined?(JSON) - assert_nil(JSON.parse(info)["too_complex_shape"]) + assert_nil(JSON.parse(info)["complex_shape"]) end end diff --git a/test/ruby/test_gc_compact.rb b/test/ruby/test_gc_compact.rb index b8d53d7197..cb5e9d6ccb 100644 --- a/test/ruby/test_gc_compact.rb +++ b/test/ruby/test_gc_compact.rb @@ -469,7 +469,7 @@ class TestGCCompact < Test::Unit::TestCase end; end - def test_moving_too_complex_generic_ivar + def test_moving_complex_generic_ivar omit "not compiled with SHAPE_DEBUG" unless defined?(RubyVM::Shape) assert_separately([], <<~RUBY) diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index 9ee7331e6c..1e4de74503 100644 --- a/test/ruby/test_marshal.rb +++ b/test/ruby/test_marshal.rb @@ -471,7 +471,7 @@ class TestMarshal < Test::Unit::TestCase class TooComplex def initialize - @marshal_too_complex = 1 + @marshal_complex = 1 end end @@ -487,10 +487,10 @@ class TestMarshal < Test::Unit::TestCase obj.instance_variable_set(ivar, 1) if defined?(RubyVM::Shape) - assert_predicate(RubyVM::Shape.of(obj), :too_complex?) + assert_predicate(RubyVM::Shape.of(obj), :complex?) end obj.object_id - assert_equal "\x04\bo:\x1CTestMarshal::TooComplex\a:\x19@marshal_too_complexi\x06:\f#{ivar}i\x06".b, Marshal.dump(obj) + assert_equal "\x04\bo:\x1CTestMarshal::TooComplex\a:\x15@marshal_complexi\x06:\f#{ivar}i\x06".b, Marshal.dump(obj) end def test_marshal_complex diff --git a/test/ruby/test_object.rb b/test/ruby/test_object.rb index 35b4547135..53ae4fb110 100644 --- a/test/ruby/test_object.rb +++ b/test/ruby/test_object.rb @@ -985,8 +985,8 @@ class TestObject < Test::Unit::TestCase 10.times { |i| assert_include result, "@v#{i}=0" } end - def test_inspect_mutating_ivar_too_complex - # Force too_complex by creating many shape variations on the same class + def test_inspect_mutating_ivar_complex + # Force complex by creating many shape variations on the same class c = Class.new 50.times do |i| o = c.new @@ -1001,11 +1001,11 @@ class TestObject < Test::Unit::TestCase end obj.instance_variable_set(:@evil, evil) 10.times { |i| obj.instance_variable_set(:"@v#{i}", 0) } - # too_complex objects use st_foreach which handles mutation gracefully + # complex objects use st_foreach which handles mutation gracefully obj.inspect end - def test_inspect_too_complex + def test_inspect_complex kernel_inspect = Kernel.instance_method(:inspect) klasses = [ @@ -1015,7 +1015,7 @@ class TestObject < Test::Unit::TestCase Class.new(Hash), Struct.new(:x), Class.new(Thread::Mutex), - # It's very difficult to get a too_complex T_CLASS, so that isn't tested here + # It's very difficult to get a complex T_CLASS, so that isn't tested here ] klasses.each_with_index do |klass, idx| diff --git a/test/ruby/test_object_id.rb b/test/ruby/test_object_id.rb index adb819febc..034674e5be 100644 --- a/test/ruby/test_object_id.rb +++ b/test/ruby/test_object_id.rb @@ -140,7 +140,7 @@ end class TestObjectIdTooComplex < TestObjectId class TooComplex def initialize - @too_complex_obj_id_test = 1 + @complex_obj_id_test = 1 end end @@ -155,7 +155,7 @@ class TestObjectIdTooComplex < TestObjectId @obj.instance_variable_set("@a#{rand(10_000)}", 1) if defined?(RubyVM::Shape) - assert_predicate(RubyVM::Shape.of(@obj), :too_complex?) + assert_predicate(RubyVM::Shape.of(@obj), :complex?) end end end @@ -181,7 +181,7 @@ class TestObjectIdTooComplexClass < TestObjectId @obj.instance_variable_set("@test", 1) if defined?(RubyVM::Shape) - assert_predicate(RubyVM::Shape.of(@obj), :too_complex?) + assert_predicate(RubyVM::Shape.of(@obj), :complex?) end end end @@ -202,7 +202,7 @@ class TestObjectIdTooComplexGeneric < TestObjectId @obj.instance_variable_set("@a#{rand(10_000)}", 1) if defined?(RubyVM::Shape) - assert_predicate(RubyVM::Shape.of(@obj), :too_complex?) + assert_predicate(RubyVM::Shape.of(@obj), :complex?) end end end @@ -282,7 +282,7 @@ end class TestObjectIdStructTooComplex < TestObjectId StructTooComplex = Struct.new(:a) do def initialize - @too_complex_obj_id_test = 1 + @complex_obj_id_test = 1 end end @@ -297,7 +297,7 @@ class TestObjectIdStructTooComplex < TestObjectId @obj.instance_variable_set("@a#{rand(10_000)}", 1) if defined?(RubyVM::Shape) - assert_predicate(RubyVM::Shape.of(@obj), :too_complex?) + assert_predicate(RubyVM::Shape.of(@obj), :complex?) end end end diff --git a/test/ruby/test_shapes.rb b/test/ruby/test_shapes.rb index 374a8bff7e..ef5dbd9fb1 100644 --- a/test/ruby/test_shapes.rb +++ b/test/ruby/test_shapes.rb @@ -117,12 +117,12 @@ class TestShapes < Test::Unit::TestCase assert_equal obj.expected_ivs, iv_list.map(&:to_s) end - def test_too_complex + def test_complex ensure_complex tc = TooComplex.new tc.send("a#{RubyVM::Shape::SHAPE_MAX_VARIATIONS}_m") - assert_predicate RubyVM::Shape.of(tc), :too_complex? + assert_predicate RubyVM::Shape.of(tc), :complex? end def test_ordered_alloc_is_not_complex @@ -185,7 +185,7 @@ class TestShapes < Test::Unit::TestCase obj.instance_variable_set(:@c, 1) obj.instance_variable_set(:@d, 1) - assert_predicate RubyVM::Shape.of(obj), :too_complex? + assert_predicate RubyVM::Shape.of(obj), :complex? end; end @@ -193,13 +193,13 @@ class TestShapes < Test::Unit::TestCase obj = Class.new obj.instance_variable_set(:@test_too_many_ivs_on_class, 1) - refute_predicate RubyVM::Shape.of(obj), :too_complex? + refute_predicate RubyVM::Shape.of(obj), :complex? MANY_IVS.times do obj.instance_variable_set(:"@a#{_1}", 1) end - assert_predicate RubyVM::Shape.of(obj), :too_complex? + assert_predicate RubyVM::Shape.of(obj), :complex? end def test_removing_when_too_many_ivs_on_class @@ -228,7 +228,7 @@ class TestShapes < Test::Unit::TestCase assert_empty obj.instance_variables end - def test_too_complex_geniv + def test_complex_geniv assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") begin; class TooComplex < Hash @@ -628,7 +628,7 @@ class TestShapes < Test::Unit::TestCase end; end - def test_too_complex_ractor + def test_complex_ractor assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") begin; $VERBOSE = nil @@ -643,14 +643,14 @@ class TestShapes < Test::Unit::TestCase tc = TooComplex.new tc.instance_variable_set(:"@very_unique", 3) - assert_predicate RubyVM::Shape.of(tc), :too_complex? + assert_predicate RubyVM::Shape.of(tc), :complex? assert_equal 3, tc.very_unique assert_equal 3, Ractor.new(tc) { |x| x.very_unique }.value assert_equal tc.instance_variables.sort, Ractor.new(tc) { |x| x.instance_variables }.value.sort end; end - def test_too_complex_ractor_shareable + def test_complex_ractor_shareable assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") begin; $VERBOSE = nil @@ -665,13 +665,13 @@ class TestShapes < Test::Unit::TestCase tc = TooComplex.new tc.instance_variable_set(:"@very_unique", 3) - assert_predicate RubyVM::Shape.of(tc), :too_complex? + assert_predicate RubyVM::Shape.of(tc), :complex? assert_equal 3, tc.very_unique assert_equal 3, Ractor.make_shareable(tc).very_unique end; end - def test_too_complex_and_frozen + def test_complex_and_frozen assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") begin; $VERBOSE = nil @@ -687,12 +687,12 @@ class TestShapes < Test::Unit::TestCase tc.instance_variable_set(:"@very_unique", 3) shape = RubyVM::Shape.of(tc) - assert_predicate shape, :too_complex? + assert_predicate shape, :complex? refute_predicate shape, :shape_frozen? tc.freeze frozen_shape = RubyVM::Shape.of(tc) refute_equal shape.id, frozen_shape.id - assert_predicate frozen_shape, :too_complex? + assert_predicate frozen_shape, :complex? assert_predicate frozen_shape, :shape_frozen? assert_equal 3, tc.very_unique @@ -700,7 +700,7 @@ class TestShapes < Test::Unit::TestCase end; end - def test_object_id_transition_too_complex + def test_object_id_transition_complex assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") begin; obj = Object.new @@ -724,7 +724,7 @@ class TestShapes < Test::Unit::TestCase end; end - def test_too_complex_and_frozen_and_object_id + def test_complex_and_frozen_and_object_id assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") begin; $VERBOSE = nil @@ -740,12 +740,12 @@ class TestShapes < Test::Unit::TestCase tc.instance_variable_set(:"@very_unique", 3) shape = RubyVM::Shape.of(tc) - assert_predicate shape, :too_complex? + assert_predicate shape, :complex? refute_predicate shape, :shape_frozen? tc.freeze frozen_shape = RubyVM::Shape.of(tc) refute_equal shape.id, frozen_shape.id - assert_predicate frozen_shape, :too_complex? + assert_predicate frozen_shape, :complex? assert_predicate frozen_shape, :shape_frozen? refute_predicate frozen_shape, :has_object_id? @@ -753,7 +753,7 @@ class TestShapes < Test::Unit::TestCase id_shape = RubyVM::Shape.of(tc) refute_equal frozen_shape.id, id_shape.id - assert_predicate id_shape, :too_complex? + assert_predicate id_shape, :complex? assert_predicate id_shape, :has_object_id? assert_predicate id_shape, :shape_frozen? @@ -762,7 +762,7 @@ class TestShapes < Test::Unit::TestCase end; end - def test_too_complex_obj_ivar_ractor_share + def test_complex_obj_ivar_ractor_share assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") begin; $VERBOSE = nil @@ -780,7 +780,7 @@ class TestShapes < Test::Unit::TestCase end; end - def test_too_complex_generic_ivar_ractor_share + def test_complex_generic_ivar_ractor_share assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") begin; $VERBOSE = nil @@ -803,7 +803,7 @@ class TestShapes < Test::Unit::TestCase tc = TooComplex.new tc.send("a#{RubyVM::Shape::SHAPE_MAX_VARIATIONS}_m") - assert_predicate RubyVM::Shape.of(tc), :too_complex? + assert_predicate RubyVM::Shape.of(tc), :complex? assert_equal 3, tc.a3_m end @@ -812,7 +812,7 @@ class TestShapes < Test::Unit::TestCase tc = TooComplex.new tc.send("a#{RubyVM::Shape::SHAPE_MAX_VARIATIONS}_m") - assert_predicate RubyVM::Shape.of(tc), :too_complex? + assert_predicate RubyVM::Shape.of(tc), :complex? assert_equal 3, tc.a3_m assert_equal 3, tc.a3 end @@ -822,7 +822,7 @@ class TestShapes < Test::Unit::TestCase tc = TooComplex.new tc.send("a#{RubyVM::Shape::SHAPE_MAX_VARIATIONS}_m") - assert_predicate RubyVM::Shape.of(tc), :too_complex? + assert_predicate RubyVM::Shape.of(tc), :complex? tc.write_iv_method tc.write_iv_method assert_equal 12345, tc.a3_m @@ -834,7 +834,7 @@ class TestShapes < Test::Unit::TestCase tc = TooComplex.new tc.send("a#{RubyVM::Shape::SHAPE_MAX_VARIATIONS}_m") - assert_predicate RubyVM::Shape.of(tc), :too_complex? + assert_predicate RubyVM::Shape.of(tc), :complex? tc.write_iv tc.write_iv assert_equal 12345, tc.a3_m @@ -846,7 +846,7 @@ class TestShapes < Test::Unit::TestCase tc = TooComplex.new tc.send("a#{RubyVM::Shape::SHAPE_MAX_VARIATIONS}_m") - assert_predicate RubyVM::Shape.of(tc), :too_complex? + assert_predicate RubyVM::Shape.of(tc), :complex? assert_equal 3, tc.a3_m assert_equal 3, tc.instance_variable_get(:@a3) end @@ -856,7 +856,7 @@ class TestShapes < Test::Unit::TestCase tc = TooComplex.new tc.send("a#{RubyVM::Shape::SHAPE_MAX_VARIATIONS}_m") - assert_predicate RubyVM::Shape.of(tc), :too_complex? + assert_predicate RubyVM::Shape.of(tc), :complex? assert_equal 3, tc.a3_m # make sure IV is initialized assert tc.instance_variable_defined?(:@a3) @@ -870,7 +870,7 @@ class TestShapes < Test::Unit::TestCase tc = TooComplex.new tc.send("a#{RubyVM::Shape::SHAPE_MAX_VARIATIONS}_m") - assert_predicate RubyVM::Shape.of(tc), :too_complex? + assert_predicate RubyVM::Shape.of(tc), :complex? assert_equal 3, tc.a3_m # make sure IV is initialized assert tc.instance_variable_defined?(:@a3) @@ -885,7 +885,7 @@ class TestShapes < Test::Unit::TestCase tc = TooComplex.new tc.send("a#{RubyVM::Shape::SHAPE_MAX_VARIATIONS}_m") - assert_predicate RubyVM::Shape.of(tc), :too_complex? + assert_predicate RubyVM::Shape.of(tc), :complex? assert_equal 3, tc.a3_m # make sure IV is initialized assert tc.instance_variable_defined?(:@a3) @@ -902,7 +902,7 @@ class TestShapes < Test::Unit::TestCase tc = TooComplex.new tc.send("a#{RubyVM::Shape::SHAPE_MAX_VARIATIONS}_m") - assert_predicate RubyVM::Shape.of(tc), :too_complex? + assert_predicate RubyVM::Shape.of(tc), :complex? refute tc.instance_variable_defined?(:@a3) assert_raise(NameError) do @@ -996,11 +996,11 @@ class TestShapes < Test::Unit::TestCase tc = TooComplex.new tc.send("a#{RubyVM::Shape::SHAPE_MAX_VARIATIONS}_m") - assert_predicate RubyVM::Shape.of(tc), :too_complex? + assert_predicate RubyVM::Shape.of(tc), :complex? tc.freeze assert_raise(FrozenError) { tc.a3_m } # doesn't transition to frozen shape in this case - assert_predicate RubyVM::Shape.of(tc), :too_complex? + assert_predicate RubyVM::Shape.of(tc), :complex? end def test_read_undefined_iv_after_complex @@ -1008,9 +1008,9 @@ class TestShapes < Test::Unit::TestCase tc = TooComplex.new tc.send("a#{RubyVM::Shape::SHAPE_MAX_VARIATIONS}_m") - assert_predicate RubyVM::Shape.of(tc), :too_complex? + assert_predicate RubyVM::Shape.of(tc), :complex? assert_equal nil, tc.iv_not_defined - assert_predicate RubyVM::Shape.of(tc), :too_complex? + assert_predicate RubyVM::Shape.of(tc), :complex? end def test_shape_order @@ -1128,7 +1128,7 @@ class TestShapes < Test::Unit::TestCase assert_shape_equal(RubyVM::Shape.of(obj), RubyVM::Shape.of(obj2)) end - def test_duplicating_too_complex_objects_memory_leak + def test_duplicating_complex_objects_memory_leak assert_no_memory_leak([], "#{<<~'begin;'}", "#{<<~'end;'}", "[Bug #20162]", rss: true) RubyVM::Shape.exhaust_shapes @@ -1226,52 +1226,52 @@ class TestShapes < Test::Unit::TestCase end end - def assert_too_complex_during_delete(obj) + def assert_complex_during_delete(obj) obj.instance_variable_set("@___#{SecureRandom.hex}", 1) (RubyVM::Shape::SHAPE_MAX_VARIATIONS * 2).times do |i| obj.instance_variable_set("@ivar#{i}", i) end - refute_predicate RubyVM::Shape.of(obj), :too_complex? + refute_predicate RubyVM::Shape.of(obj), :complex? (RubyVM::Shape::SHAPE_MAX_VARIATIONS * 2).times do |i| obj.remove_instance_variable("@ivar#{i}") end - assert_predicate RubyVM::Shape.of(obj), :too_complex? + assert_predicate RubyVM::Shape.of(obj), :complex? end - def test_object_too_complex_during_delete - assert_too_complex_during_delete(Class.new.new) + def test_object_complex_during_delete + assert_complex_during_delete(Class.new.new) end - def test_class_too_complex_during_delete - assert_too_complex_during_delete(Module.new) + def test_class_complex_during_delete + assert_complex_during_delete(Module.new) end - def test_generic_too_complex_during_delete - assert_too_complex_during_delete(Class.new(Array).new) + def test_generic_complex_during_delete + assert_complex_during_delete(Class.new(Array).new) end - def assert_too_complex_max_fields(obj) + def assert_complex_max_fields(obj) extra_fields = RubyVM::Shape::SHAPE_MAX_FIELDS - obj.instance_variables.size extra_fields.times do |i| obj.instance_variable_set("@camel_ivar#{i}", i) end - refute_predicate RubyVM::Shape.of(obj), :too_complex? + refute_predicate RubyVM::Shape.of(obj), :complex? obj.instance_variable_set("@camel_straw", true) - assert_predicate RubyVM::Shape.of(obj), :too_complex? + assert_predicate RubyVM::Shape.of(obj), :complex? end def test_max_fields_complex - assert_too_complex_max_fields(Class.new(Object).new) + assert_complex_max_fields(Class.new(Object).new) end def test_generic_max_fields_complex - assert_too_complex_max_fields(Class.new(Array).new) + assert_complex_max_fields(Class.new(Array).new) end def test_class_max_fields_complex - assert_too_complex_max_fields(Class.new(Module).new) + assert_complex_max_fields(Class.new(Module).new) end def test_max_initial_fields @@ -1284,9 +1284,9 @@ class TestShapes < Test::Unit::TestCase end end RUBY - assert_predicate RubyVM::Shape.of(klass.new), :too_complex? - assert_predicate RubyVM::Shape.of(klass.new.dup), :too_complex? - assert_predicate RubyVM::Shape.of(klass.new(true)), :too_complex? - assert_predicate RubyVM::Shape.of(klass.new(true).dup), :too_complex? + assert_predicate RubyVM::Shape.of(klass.new), :complex? + assert_predicate RubyVM::Shape.of(klass.new.dup), :complex? + assert_predicate RubyVM::Shape.of(klass.new(true)), :complex? + assert_predicate RubyVM::Shape.of(klass.new(true).dup), :complex? end end if defined?(RubyVM::Shape) |
