[#4858] Build fails on OSX Tiger 10.4 — noreply@...

Bugs item #1883, was opened at 2005-05-06 14:55

21 messages 2005/05/06
[#4862] Re: [ ruby-Bugs-1883 ] Build fails on OSX Tiger 10.4 — Yukihiro Matsumoto <matz@...> 2005/05/07

Hi,

[#4865] Re: [ ruby-Bugs-1883 ] Build fails on OSX Tiger 10.4 — Ryan Davis <ryand-ruby@...> 2005/05/07

[#4868] Re: [ ruby-Bugs-1883 ] Build fails on OSX Tiger 10.4 — nobu.nokada@... 2005/05/07

Hi,

[#5053] Re: [ ruby-Bugs-1883 ] Build fails on OSX Tiger 10.4 — Shugo Maeda <shugo@...> 2005/05/19

Hi,

[#5056] Re: [ ruby-Bugs-1883 ] Build fails on OSX Tiger 10.4 — Mark Hubbart <discordantus@...> 2005/05/19

On 5/19/05, Shugo Maeda <shugo@ruby-lang.org> wrote:

[#4874] - Need to reduce Ruby Sources to the Minimal — Ilias Lazaridis <ilias@...>

Hello all,

31 messages 2005/05/10
[#4879] Re: [THIN] - Need to reduce Ruby Sources to the Minimal — Pit Capitain <pit@...> 2005/05/11

Ilias Lazaridis schrieb:

[#4883] Re: [THIN] - Need to reduce Ruby Sources to the Minimal — Ilias Lazaridis <ilias@...> 2005/05/12

Pit Capitain wrote:

[#4884] Re: [THIN] - Need to reduce Ruby Sources to the Minimal — Ryan Davis <ryand-ruby@...> 2005/05/12

[#4888] Re: [THIN] - Need to reduce Ruby Sources to the Minimal — Ilias Lazaridis <ilias@...> 2005/05/12

Ryan Davis wrote:

[#4889] Re: [THIN] - Need to reduce Ruby Sources to the Minimal — ES <ruby-ml@...> 2005/05/12

[#4890] Re: [THIN] - Need to reduce Ruby Sources to the Minimal — Ilias Lazaridis <ilias@...> 2005/05/12

ES wrote:

[#4891] Re: [THIN] - Need to reduce Ruby Sources to the Minimal — Alexander Kellett <ruby-lists@...> 2005/05/12

On May 12, 2005, at 3:13 PM, Ilias Lazaridis wrote:

[#4911] Pointless argc check in Array#select — noreply@...

Patches item #1900, was opened at 2005-05-12 09:33

11 messages 2005/05/12

[#4919] - Hierarchical/Modular Directory Structure — Ilias Lazaridis <ilias@...>

The source-code structure should be simplified, lowering barriers for

20 messages 2005/05/12

[ ruby-Patches-1900 ] Pointless argc check in Array#select

From: noreply@...
Date: 2005-05-12 16:39:59 UTC
List: ruby-core #4911
Patches item #1900, was opened at 2005-05-12 09:33
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1700&aid=1900&group_id=426

Category: Ruby1.8
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Daniel Berger (djberg96)
Assigned to: Nobody (None)
Summary: Pointless argc check in Array#select

Initial Comment:
Ruby 1.8.3 p1

Pointless argc check in Array#select:

--- array.orig  Thu May 12 08:27:15 2005
+++ array.c     Thu May 12 08:32:44 2005
@@ -1807,14 +1807,12 @@
     VALUE result;
     long i;
 
-    if (argc > 0) {
-       rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc);
-    }
     result = rb_ary_new2(RARRAY(ary)->len);
+
     for (i = 0; i < RARRAY(ary)->len; i++) {
-       if (RTEST(rb_yield(RARRAY(ary)->ptr[i]))) {
-           rb_ary_push(result, rb_ary_elt(ary, i));
-       }
+       if (RTEST(rb_yield(RARRAY(ary)->ptr[i]))) {
+               rb_ary_push(result, rb_ary_elt(ary, i));
+       }
     }
     return result;
 }
@@ -3017,7 +3015,7 @@
     rb_define_method(rb_cArray, "collect!", rb_ary_collect_bang, 0);
     rb_define_method(rb_cArray, "map", rb_ary_collect, 0);
     rb_define_method(rb_cArray, "map!", rb_ary_collect_bang, 0);
-    rb_define_method(rb_cArray, "select", rb_ary_select, -1);
+    rb_define_method(rb_cArray, "select", rb_ary_select, 0);
     rb_define_method(rb_cArray, "values_at", rb_ary_values_at, -1);
     rb_define_method(rb_cArray, "delete", rb_ary_delete, 1);
     rb_define_method(rb_cArray, "delete_at", rb_ary_delete_at_m, 1);


--- test_array.orig     Thu May 12 08:33:32 2005
+++ test_array.rb       Thu May 12 10:01:58 2005
@@ -1,6 +1,9 @@
 require 'test/unit'
 
 class TestArray < Test::Unit::TestCase
+   def setup
+      @a = []
+   end
   def test_array
     assert_equal([1, 2, 3, 4], [1, 2] + [3, 4])
     assert_equal([1, 2, 1, 2], [1, 2] * 2)
@@ -98,4 +101,24 @@
     x.concat(x)
     assert_equal([1,2,3,1,2,3], x)
   end
+
+   def test_find_all
+      assert_respond_to(@a, :find_all)
+      assert_respond_to(@a, :select)       # Alias
+      assert_equal([], @a.find_all{ |obj| obj == "foo"})
+
+      # Should this raise a warning or error?  Should a block be mandatory?
+      assert_nothing_raised{ @a.find_all }
+
+      # This one is specifically relevant to the diff
+      assert_raises(ArgumentError){ @a.find_all("foo") }
+
+      @a.push("foo", "bar", "baz", "baz", 1, 2, 3, 3, 4)
+      assert_equal(["baz","baz"], @a.find_all{ |obj| obj == "baz" })
+      assert_equal([3,3], @a.find_all{ |obj| obj == 3 })
+   end
+
+   def teardown
+      @a = nil
+   end
 end

>ruby test_array.rb
Loaded suite test_array
Started
........
Finished in 0.031893 seconds.

8 tests, 46 assertions, 0 failures, 0 errors

Regards,

Dan

PS - I think there's some extra info in the diff because I replaced tabs with spaces (a minor annoyance with the source code itself, btw).

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1700&aid=1900&group_id=426

In This Thread

Prev Next