[#2748] Proposal: New Bignum — "Evan Webb" <evan@...>
During some experiments with ruby cryptography, I found some problems with
11 messages
2004/04/06
[#2749] Re: Proposal: New Bignum
— matz@... (Yukihiro Matsumoto)
2004/04/06
Hi,
[#2764] RDoc :enddoc: — Tanaka Akira <akr@...17n.org>
I found that RDoc document some method after :enddoc:. Is it
7 messages
2004/04/10
[#2788] Problems building ext/io/wait.c in 1.8 branch — Gavin Sinclair <gsinclair@...>
I can't get io/wait installed. The main problem is that it doesn't
6 messages
2004/04/17
[#2799] Re: Problems building ext/io/wait.c in 1.8 branch
— Gavin Sinclair <gsinclair@...>
2004/04/21
On Saturday, April 17, 2004, 4:42:14 PM, Gavin wrote:
[#2800] Re: Problems building ext/io/wait.c in 1.8 branch
— ts <decoux@...>
2004/04/21
>>>>> "G" == Gavin Sinclair <gsinclair@soyabean.com.au> writes:
[#2801] Re: Problems building ext/io/wait.c in 1.8 branch
— Gavin Sinclair <gsinclair@...>
2004/04/21
On Thursday, April 22, 2004, 1:21:29 AM, ts wrote:
[#2805] Bug 1318 — Steven Jenkins <steven.jenkins@...>
Any comments on
9 messages
2004/04/23
[#2814] Tempfile strangeness in 1.9.0 — Steven Jenkins <steven.jenkins@...>
I didn't open a bug for this because it's from the CVS head, but it
5 messages
2004/04/24
[PATCH] lib/test/unit/testcase.rb
From:
Mauricio Fern疣dez <batsman.geo@...>
Date:
2004-04-29 09:40:57 UTC
List:
ruby-core #2829
Problem
=======
The following wouldn't work:
require 'test/unit'
class TC_foo < Test::Unit::TestCase
define_method(:test_foo){ assert(true) }
end
since the method would have arity -1 and Test::Unit only accepts methods of
arity 0.
Patch
=====
--- ruby-1.8.1/lib/test/unit/testcase.rb 2003-11-21 00:18:59.000000000 +0100
+++ ruby-1.8.1.inst/lib/test/unit/testcase.rb 2004-04-29 11:22:01.000000000 +0200
@@ -31,7 +31,9 @@
# Creates a new instance of the fixture for running the
# test represented by test_method_name.
def initialize(test_method_name)
- unless(respond_to?(test_method_name) && method(test_method_name).arity == 0)
+ unless(respond_to?(test_method_name) and
+ (method(test_method_name).arity == 0 ||
+ method(test_method_name).arity == -1))
throw :invalid_test
end
@method_name = test_method_name
Background
==========
http://rcrchive.net/rcr/RCR/RCR227 addresses this issue, and I believe
this RCR has been de-facto approved:
Thu Mar 18 16:22:38 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
[...]
* eval.c (proc_arity): arity is now defined as number of
parameters that would not be ignored. i.e. Proc.new{}.arity
returns zero. update test suites too.
It is also easy to work around the problem by doing { || assert(true) }.
Rationale
=========
However, I still believe the patch is meaningful since:
* I see no reason why Test::Unit shouldn't accept methods of arity -1
* it is not immediately obvious that Test::Unit is silently rejecting
methods of arity -1; in my case I was getting a 'no test methods defined'
error, but one wouldn't realize if most methods where defined normally
and only a few using define_method
* mandating the use of {|| } means "more work for the most common case"
--
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com
Just go ahead and write your own multitasking multiuser os!
Worked for me all the times.
-- Linus Torvalds