summaryrefslogtreecommitdiff
path: root/test/ruby/test_array.rb
AgeCommit message (Collapse)Author
2016-01-23Add test for Array#keep_ifnobu
* test/ruby/test_array.rb (test_keep_if): Add test for Array#keep_if separate from Array#select! [Fix GH-1218] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53639 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-12-12object.c: raise TypeErrornobu
* object.c (rb_obj_dig): raise TypeError if an element does not have #dig method. [ruby-core:71798] [Bug #11762] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-09dignobu
* array.c (rb_ary_dig): new method Array#dig. * hash.c (rb_hash_dig): new method Hash#dig. * object.c (rb_obj_dig): dig in nested arrays/hashes. [Feature #11643] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-28preserve encodings in error messagesnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-20vm_eval.c: share with rb_obj_respond_tonobu
* vm_eval.c (check_funcall_respond_to): share the behavior with rb_obj_respond_to. [ruby-core:70460] [Bug #11465] * vm_method.c (vm_respond_to): extract from rb_obj_respond_to and merge r39881. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-11* test/ruby/test_array.rb: Add test for `Array#flatten` with level 1hsbt
[fix GH-986] Patch @yui-knk git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-07* test/ruby/test_array.rbusa
(TestArray#test_short_heap_array_sort_bang_memory_leak): seems to need more margin. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-06* test/ruby/test_array.rbusa
(TestArray#test_short_heap_array_sort_bang_memory_leak): relax the threshold to get rid of a false positive failure of mswin CI. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-05test/ruby/test_array.rb: longer timeout for memory leak testnormal
This was causing CI failures on ko1's test box git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-05array.c: fix memory leaknobu
* array.c (rb_ary_sort_bang): the original array may not be embedded even if a substitution array is embedded, as it is embedded when the original array is short enough but not embedded. [ruby-dev:49166] [Bug #11332] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-12array.c: bsearch_indexnobu
* array.c (rb_ary_bsearch_index): Implement Array#bsearch_index method, which is similar to bsearch and returns the index or nil. [Feature #10730] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-11array.c: fix array size overflownobu
* array.c (ary_ensure_room_for_push): check if array size will exceed maxmum size to get rid of buffer overflow. [ruby-dev:49043] [Bug #11235] * array.c (ary_ensure_room_for_unshift, rb_ary_splice): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-25array.c: reduce to_ary callnobu
* array.c (flatten): no need to call to_ary method on elements beyond the given level. [ruby-core:67637] [Bug #10748] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-25test_array.rb split flatten testsnobu
* test/ruby/test_array.rb (test_flatten, test_flatten!): split. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-15array.c: linear performancenobu
* array.c (rb_ary_select_bang, ary_reject_bang): linear performance. [ruby-core:67418] [Feature #10714] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-11array.c: class name encodingnobu
* array.c (rb_ary_bsearch): preserve encoding of class name in an exception message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-10array.c: keep consistencynobu
* array.c (rb_ary_select_bang): keep the array consistent by removing unselected values soon. [ruby-dev:48805] [Bug #10722] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-03* array.c: Improve performance of Array#shift. use shared instead ofhsbt
MEMMOVE if with arguments. Patch by @ksss [fix GH-537] * test/ruby/test_array.rb: ditto. * benchmark/bm_array_shift.rb: Added benchmark of GH-537 issue. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-29test/ruby: suppress warningsnobu
* test/ruby/test_array.rb: (need_continuation): suppress warnings to require continuation. * test/ruby/test_continuation.rb: ditto. * test/ruby/test_enum.rb: ditto. * test/ruby/test_fiber.rb: ditto. * test/ruby/test_hash.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13* test/lib/envutil.rb: Moved from test/ruby/.akr
* test/lib/find_executable.rb: Ditto. * test/lib/memory_status.rb: Ditto. * test/lib/test/unit.rb: require envutil. * test/: Don't require envutil in test files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-14array.c: non-recursive rcombinate0nobu
* array.c (rcombinate0): remove recursion, by looping with indexes stored in `p`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-14array.c: non-recursive rpermute0nobu
* array.c (rpermute0): remove recursion, by looping with indexes stored in `p`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-14array.c: non-recursive permute0nobu
* array.c (permute0): remove recursion, by looping with indexes stored in `p`. [ruby-core:63103] [Bug #9932] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-13array.c: combination on a shared copynobu
* array.c (rb_ary_combination): iterate on a shared copy, and use array of indexes instead of array of chosen objects. [ruby-core:63149] [Bug #9939] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-11test_array.rb: skip if timed outnobu
* test/ruby/test_array.rb (test_shared_marking): skip if timed out, this test can just take a lot of time. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-11test_array.rb: expand timeoutnobu
* test/ruby/test_array.rb (test_shared_marking): expand timeout for less powerful machine. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-11array.c: maybe shared arraynobu
* array.c (ary_reject): may be turned into a shared array during the given block. [ruby-dev:48101] [Bug #9727] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-11test_array.rb: do minor GCnobu
* test/ruby/test_array.rb (test_shared_marking): do minor GC to reduce WB-missed messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-11test_array.rb: simplify test_shared_markingnobu
* test/ruby/test_array.rb (test_shared_marking): simplify with timeout option and no random, also reduce same messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-10* test/ruby/test_array.rb: remove useless `assert'.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-10* array.c (rb_ary_modify): remember shared array owner if a sharedko1
array owner is promoted and a shared array is not promoted. Now, shared array is WB-unprotected so that shared arrays are not promoted. All objects referred from shared array should be marked correctly. [ruby-core:61919] [ruby-trunk - Bug #9718] * test/ruby/test_array.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-13* test/ruby/test_array.rb: Ensure flatten! is used for test_flattenzzak
Patch by @ksss [Fixes GH-530] https://github.com/ruby/ruby/pull/530 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-06array.c: return first unique element in Array#uniqtmm1
* array.c (ary_add_hash): Fix consistency issue between Array#uniq and Array#uniq! [Bug #9340] [ruby-core:59457] * test/ruby/test_array.rb (class TestArray): regression test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-23* array.c: Have to_h raise on elements that are not key-value pairs [#9239]marcandre
* enum.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13test/ruby: better assertionsnobu
* test/ruby: use better assertions instead of mere assert. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-10array.c, hash.c: add saltnobu
* array.c (rb_ary_hash): add salt to differentiate false and empty array. [ruby-core:58993] [Bug #9231] * hash.c (rb_any_hash, rb_hash_hash): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-08* array.c (rb_ary_shuffle_bang, rb_ary_sample): checkktsj
unknown keywords. * test/ruby/test_array.rb (test_shuffle, test_sample): tests for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05array.c: prefer lhs elementsnobu
* array.c (rb_ary_or): lhs elements are prefered, so should not replace with rhs elements. * test/ruby/test_array.rb (test_OR_in_order): import the test failed by r43969 from rubyspec/core/array/union_spec.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05test_hash.rb: move testsnobu
* test/ruby/test_hash.rb: move hash value tests from test_array.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-04* test/ruby/test_array.rb (test_recursive_hash_value): rename.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-03hash.c: same hash value for similar constructsnobu
* hash.c (rb_hash_recursive): make similar (recursive) constructs return same hash value. execute recursively, and rewind to the topmost frame with an object which .eql? to the recursive object, if recursion is detected. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-03hash.c: detect recursion for allnobu
* hash.c (rb_hash): detect recursion for all `hash' methods. each `hash' methods no longer need to use rb_exec_recursive(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-03* array.c (ary_add_hash): set and return values because string keysglass
will be frozen. [ruby-core:58809] [Bug #9202] * array.c (rb_ary_uniq_bang): ditto. * array.c (rb_ary_or): ditto. * array.c (rb_ary_uniq): ditto. * test/ruby/test_array.rb: tests for above. The patch is from normalperson (Eric Wong). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-26should not ignore the rest of recursive constructsnobu
* array.c (rb_ary_hash): should not ignore the rest of recursive constructs. * hash.c (rb_hash_hash): ditto. * range.c (range_hash): ditto. * struct.c (rb_struct_hash): ditto. * test/-ext-/test_recursion.rb (TestRecursion): separate from test/ruby/test_thread.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-23* array.c: Add Array#to_h [Feature #7292]marcandre
* enum.c: Add Enumerable#to_h git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-15test_array.rb: add testnobu
* test/ruby/test_array.rb (test_last2): add test for Array#last with length argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-09test/ruby: assert_raise_with_messagenobu
* test/ruby: use assert_raise_with_message git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-13random.c: coerce before check negativenobu
* random.c (rb_random_ulong_limited): coerce before check negative. [Fixes GH-379] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-19Suppress warnings.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e