summaryrefslogtreecommitdiff
path: root/spec/ruby/core/array/delete_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/array/delete_spec.rb')
-rw-r--r--spec/ruby/core/array/delete_spec.rb24
1 files changed, 1 insertions, 23 deletions
diff --git a/spec/ruby/core/array/delete_spec.rb b/spec/ruby/core/array/delete_spec.rb
index 5d53c74e47..0d80b2839d 100644
--- a/spec/ruby/core/array/delete_spec.rb
+++ b/spec/ruby/core/array/delete_spec.rb
@@ -41,28 +41,6 @@ describe "Array#delete" do
end
it "raises a FrozenError on a frozen array" do
- -> { [1, 2, 3].freeze.delete(1) }.should raise_error(FrozenError)
- end
-
- ruby_version_is ''...'2.7' do
- it "keeps tainted status" do
- a = [1, 2]
- a.taint
- a.tainted?.should be_true
- a.delete(2)
- a.tainted?.should be_true
- a.delete(1) # now empty
- a.tainted?.should be_true
- end
-
- it "keeps untrusted status" do
- a = [1, 2]
- a.untrust
- a.untrusted?.should be_true
- a.delete(2)
- a.untrusted?.should be_true
- a.delete(1) # now empty
- a.untrusted?.should be_true
- end
+ -> { [1, 2, 3].freeze.delete(1) }.should.raise(FrozenError)
end
end
f the object (currently which instance variables are set and the "frozenness"). Shapes form a tree data structure, and when a new instance variable is set on an object, that object "transitions" to a new shape in the shape tree. Each shape has an ID that is used for caching. The shape structure is independent of class, so objects of different types can have the same shape. For example: ```ruby class Foo def initialize # Starts with shape id 0 @a = 1 # transitions to shape id 1 @b = 1 # transitions to shape id 2 end end class Bar def initialize # Starts with shape id 0 @a = 1 # transitions to shape id 1 @b = 1 # transitions to shape id 2 end end foo = Foo.new # `foo` has shape id 2 bar = Bar.new # `bar` has shape id 2 ``` Both `foo` and `bar` instances have the same shape because they both set instance variables of the same name in the same order. This technique can help to improve inline cache hits as well as generate more efficient machine code in JIT compilers. This commit also adds some methods for debugging shapes on objects. See `RubyVM::Shape` for more details. For more context on Object Shapes, see [Feature: #18776] Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org> Co-Authored-By: Eileen M. Uchitelle <eileencodes@gmail.com> Co-Authored-By: John Hawthorn <john@hawthorn.email> Notes: Merged: https://github.com/ruby/ruby/pull/6386 2022-07-15Implement Objects on VWAPeter Zhu This commit implements Objects on Variable Width Allocation. This allows Objects with more ivars to be embedded (i.e. contents directly follow the object header) which improves performance through better cache locality. Notes: Merged: https://github.com/ruby/ruby/pull/6117 2021-09-10include/ruby/internal/core/robject.h: add doxygen卜部昌平 Must not be a bad idea to improve documents. [ci skip] Notes: Merged: https://github.com/ruby/ruby/pull/4815 2021-09-10sed -i 's/. They/. They/'卜部昌平 Truly editorial fix for comments. This works better with Emacs' set-justification-full function. [ci skip] Notes: Merged: https://github.com/ruby/ruby/pull/4815 2020-10-17remove rb_obj_iv_index_tblKoichi Sasada (1) nobody uses it (gem-codesearch) (2) the data strucuture will be changed. Notes: Merged: https://github.com/ruby/ruby/pull/3662 2020-08-19ROBJECT_IV_INDEX_TBL: convert into an inline function卜部昌平 Former ROBJECT_IV_INDEX_TBL macro included RCLASS_IV_INDEX_TBL, which is not disclosed to extension libraies. The macro was kind of broken. Why not just deprecate it, and convert the internal use into an inline function. Notes: Merged: https://github.com/ruby/ruby/pull/3427 2020-05-26Use RUBY_DEBUG instead of NDEBUGKoichi Sasada Assertions in header files slows down an interpreter, so they should be turned off by default (simple `make`). To enable them, define a macro `RUBY_DEBUG=1` (e.g. `make cppflags=-DRUBY_DEBUG` or use `#define` at the very beggining of the file. Note that even if `NDEBUG=1` is defined, `RUBY_DEBUG=1` enables all assertions. [Feature #16837] related: https://github.com/ruby/ruby/pull/3120 `assert()` lines in MRI *.c is not disabled even if `RUBY_DEBUG=0` and it can be disabled with `NDEBUG=1`. So please consider to use `RUBY_ASSERT()` if you want to disable them when `RUBY_DEBUG=0`. Notes: Merged: https://github.com/ruby/ruby/pull/3124 2020-05-11sed -i 's|ruby/impl|ruby/internal|'卜部昌平 To fix build failures. Notes: Merged: https://github.com/ruby/ruby/pull/3079 2020-05-11mv include/ruby/{impl,internal}卜部昌平 Devs do not love "impl". Notes: Merged: https://github.com/ruby/ruby/pull/3079