From 19737494b9f67f935acd5ec141c5137b8d20c3f3 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 5 Dec 2013 12:53:31 +0000 Subject: array.c: prefer lhs elements * 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 --- test/ruby/test_array.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/ruby/test_array.rb') diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index 85f1ec0058..1c2adf852b 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -1662,6 +1662,18 @@ class TestArray < Test::Unit::TestCase assert(c.none?(&:frozen?)) end + def test_OR_in_order + obj1, obj2 = Class.new do + attr_reader :name + def initialize(name) @name = name; end + def inspect; "test_OR_in_order(#{@name})"; end + def hash; 0; end + def eql?(a) true; end + break [new("1"), new("2")] + end + assert_equal([obj1], [obj1]|[obj2]) + end + def test_combination assert_equal(@cls[[]], @cls[1,2,3,4].combination(0).to_a) assert_equal(@cls[[1],[2],[3],[4]], @cls[1,2,3,4].combination(1).to_a) -- cgit v1.2.3