summaryrefslogtreecommitdiff
path: root/test/test_set.rb
AgeCommit message (Collapse)Author
2020-01-03Call initialize_clone with freeze: false if clone called with freeze: falseJeremy Evans
This makes it possible to initialize_clone to correctly not freeze internal state if the freeze: false keyword is passed to clone. If clone is called with freeze: true or no keyword, do not pass a second argument to initialize_clone to keep backwards compatibility. This makes it so that external libraries that override initialize_clone but do not support the freeze keyword will fail with ArgumentError if passing freeze: false to clone. I think that is better than the current behavior, which succeeds but results in an unfrozen object with frozen internals. Fix related issues in set and delegate in stdlib. Fixes [Bug #14266] Notes: Merged: https://github.com/ruby/ruby/pull/2816
2019-11-18Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans
This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby. Notes: Merged: https://github.com/ruby/ruby/pull/2476
2018-02-25Add a new #filter alias for #selecteregon
* In Enumerable, Enumerator::Lazy, Array, Hash and Set [Feature #13784] [ruby-core:82285] * Share specs for the various #select#select! methods and reuse them for #filter/#filter!. * Add corresponding filter tests for select tests. * Update NEWS. [Fix GH-1824] From: Alexander Patrick <adp90@case.edu> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12Add FrozenError as a subclass of RuntimeErrorshyouhei
FrozenError will be used instead of RuntimeError for exceptions raised when there is an attempt to modify a frozen object. The reason for this change is to differentiate exceptions related to frozen objects from generic exceptions such as those generated by Kernel#raise without an exception class. From: Jeremy Evans <code@jeremyevans.net> Signed-off-by: Urabe Shyouhei <shyouhei@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-22Add `Set#reset`knu
This method resets the internal state of a set after modification to existing elements, reindexing and deduplicating them. [Feature #6589] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21Allow a SortedSet to be frozen and still functional [Bug #12091]knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-19Alias Set#=== to #include?knu
* set.rb (Set#===): Added via [Feature #13801] by davidarnold. Closes #1673. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-14Alias Set#to_s to #inspect [ruby-core:81753] [Feature #13676]knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-14Make tests for Set#inspect more straightforwardknu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05Add Set#compare_by_identity and Set#compare_by_identity?knu
* lib/set.rb (Set#compare_by_identity, Set#compare_by_identity?): New methods. [Feature #12210] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-04* lib/set.rb (Set#{delete_if,keep_if,collect!,reject!,select!,classify,divide},ktsj
SortedSet#{delete_if,keep_if}): Return sized enumerators. * test/test_set.rb: add test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-04* test/test_set.rb: add missing test of Set#select!.ktsj
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16Add frozen_string_literal: false for all filesnaruse
When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-16* lib/set.rb (#>=, #>, #<=, #<): Make use of Hash#>=, #>, #<, andknu
#<= when comparing against an instance of the same kind. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-15* lib/set.rb: Make Set#each and SortedSet#each generate a sizedknu
enumerator. [GH-931] by kachick (Kenichi Kamiya) * test/test_set.rb: Import tests from Set into SortedSet. [GH-931] by kachick (Kenichi Kamiya) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-02use assert_raisenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-06* lib/set.rb (Set#replace): Check if an object given is enumerableknu
before clearing self. Reported by yui-knk. [GH-675] https://github.com/ruby/ruby/pull/675 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-06Implement Set#clone. [Fixes GH-661]knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-27* test/test_set.rb: remove commented out code.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-30Add some more tests.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-30Add Set#intersect? and #disjoint?.knu
* lib/set.rb (Set#intersect?, Set#disjoint?): Add new methods for testing if two sets have any element in common. [ruby-core:45641] [Feature #6588] Based on the code by marcandre. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-19Define Set#to_set so that aSet.to_set returns self.knu
* lib/set.rb (Set#to_set): Define Set#to_set so that aSet.to_set returns self. [Fixes GH-359] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-01* lib/set.rb (Set#freeze, taint, untaint): Save a "self" byknu
utilizing super returning self, and add tests while at it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-18* lib/set.rb (Set#delete_if, Set#keep_if): Make Set#delete_if andknu
Set#keep_if more space and time efficient by avoiding to_a. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-24Move tests embedded in lib/set.rb to test/test_set.rb.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-02use require_relative.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-13 * test/test_*.rb: Pathname#parent -> Pathname#dirname.nahi
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-06 * test/inlinetest.rb, test/{test_generator.rb,test_ipaddr.rb,nahi
test_pathname.rb,test_pp.rb,test_prettyprint.rb,test_set.rb, test_time.rb,test_tsort.rb: added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e