[#10157] Re: Including classes — Pit Capitain <pit@...>
Ola Bini schrieb:
[#10167] SVN revision corresponding to 1.8.5_p12? — Charles Oliver Nutter <charles.nutter@...>
Simple question: what SVN revision corresponds to the 1.8.5_p12 release?
[#10185] Ruby 1.9: Why the change to the return values of #instance_variables? — "Austin Ziegler" <halostatue@...>
I have been preparing a release of Transaction::Simple 1.4 and want to
[#10193] String.ord — David Flanagan <david@...>
Hi,
Hi,
Yukihiro Matsumoto wrote:
David Flanagan wrote:
Daniel Berger wrote:
On 2/6/07, David Flanagan <david@davidflanagan.com> wrote:
Nikolai Weibull wrote:
On 2/6/07, David Flanagan <david@davidflanagan.com> wrote:
Nikolai Weibull wrote:
Quoting david@davidflanagan.com, on Wed, Feb 07, 2007 at 09:10:52AM +0900:
On 2/7/07, Sam Roberts <sroberts@uniserve.com> wrote:
Nikolai Weibull wrote:
Hi,
On 2/6/07, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
Hi --
On 2/6/07, dblack@wobblini.net <dblack@wobblini.net> wrote:
[#10230] Test::Unit::AutoRunner#parse_args bug, attributable to optparse documentation. — Mauricio Fernandez <mfp@...>
[#10254] uninitialized variable in function rb_syswait() — <noreply@...>
Bugs item #8538, was opened at 2007-02-09 17:25
On Sat, Feb 10, 2007 at 02:25:43AM +0900, noreply@rubyforge.org wrote:
[#10255] String:upto loops forever if argument is modified inside block — <noreply@...>
Bugs item #8539, was opened at 2007-02-09 17:27
[#10257] coredump when invoking Kernel:syscall — <noreply@...>
Bugs item #8541, was opened at 2007-02-09 17:31
On Sat, Feb 10, 2007 at 02:31:48AM +0900, noreply@rubyforge.org wrote:
[#10259] Segmentation fault: Ruby 1.8.5 Under VC++ express 2005 — "z wen" <zhimin.wen@...>
Hi
Hell,
Hello,
On 2/10/07, Masaki Suketa <masaki.suketa@nifty.ne.jp> wrote:
[#10276] fastthread now default in ruby_1_8 — "Akinori MUSHA" <knu@...>
Hi,
[#10284] Can't seem to run tests? — "Farrel Lifson" <farrel.lifson@...>
Hi there,
[#10288] Socket library should support abstract unix sockets — <noreply@...>
Bugs item #8597, was opened at 2007-02-13 16:10
On Wed, Feb 14, 2007 at 12:10:37AM +0900, noreply@rubyforge.org wrote:
Hi,
On Wed, Feb 14, 2007 at 08:38:50AM +0900, Yukihiro Matsumoto wrote:
On Wed, Feb 14, 2007 at 12:10:37AM +0900, noreply@rubyforge.org wrote:
[#10290] URI::Generic#userinfo — "Jonas Pfenniger" <zimbatm@...>
Hello,
Those are not errors. Username and password are not allowed in HTTP
[#10321] File.basename fails on Windows root paths — <noreply@...>
Bugs item #8676, was opened at 2007-02-15 10:09
Hi,
On 5/12/07, Nobuyoshi Nakada <nobu@ruby-lang.org> wrote:
On 5/12/07, Austin Ziegler <halostatue@gmail.com> wrote:
Nikolai Weibull wrote:
[#10323] Trouble with xmlrpc — James Edward Gray II <james@...>
Some of the Ruby code used by TextMate makes use of xmlrpc/
> -----Original Message-----
On Feb 15, 2007, at 1:29 PM, Berger, Daniel wrote:
On Feb 15, 2007, at 1:33 PM, James Edward Gray II wrote:
On Feb 16, 2007, at 7:49 AM, James Edward Gray II wrote:
At Tue, 20 Feb 2007 22:33:08 +0900,
On Feb 20, 2007, at 7:50 AM, Akinori MUSHA wrote:
While I am complaining about xmlrpc, we have another issue. It's
James Edward Gray II wrote:
On Feb 16, 2007, at 12:08 PM, Alex Young wrote:
James Edward Gray II wrote:
On Feb 16, 2007, at 4:27 PM, Alex Young wrote:
On Feb 16, 2007, at 5:08 PM, James Edward Gray II wrote:
James Edward Gray II wrote:
[#10334] make Test::Unit output more Emacs friendly format — Kouhei Sutou <kou@...>
Hi,
[#10341] matz/knu: Requesting committer privileges to add Win32 NTLM authentication to net/http — "Justin Bailey" <jgbailey@...>
Matz, Mr. Musha, and All,
[#10357] Ruby 1.8.6 preview1 has been released — "Akinori MUSHA" <knu@...>
Hi,
[#10372] Stateful I/O interface — "Tony Arcieri" <tony@...>
Has anyone ever suggested adding a stateful I/O multiplexing interface which
[#10387] vendor_ruby support — Marcus Rueckert <mrueckert@...>
Hi,
[#10397] Ruby 1.8.5 not installing a working digest.rb on MacOSX — "Ryan Waldron" <ryan.waldron@...>
While trying to install a Rails app on my Mac (10.4 Tiger), I ran into
[#10413] Support for multiple-files breakpoint-management with Emacs — Martin Nordholts <enselic@...>
Hello!
Sorry for misformatting. This time it should be OK (enclosed in
It appears as if the debugger doesn't support 'b file.rb:25', but it
[#10414] Ruby 1.8.6 preview2 has been released — "Akinori MUSHA" <knu@...>
Hi,
On 2/24/07, Akinori MUSHA <knu@idaemons.org> wrote:
[#10420] Test::Unit shows result even if interrupted — Kouhei Sutou <kou@...>
Hi,
Kouhei Sutou <kou@cozmixng.org> writes:
[#10437] MIME decoding confused by non-MIME characters — Brian Candler <B.Candler@...>
Could someone who has bleeding-edge Ruby installed please test the
[#10442] Latest Update to RHG — Charles Thornton <ceo@...>
I am releasing the lastest version of the Ruby Hacker's Guide.
Hi,
[#10445] PATCH: Emacs support for 'ruby-debug' (rdebug) : rdebug.el — Martin Nordholts <enselic@...>
Hello,
This is a patch against trunk that also changes ./misc/README. The patch
[#10446] Potential RCR?: Array#join with block — "Farrel Lifson" <farrel.lifson@...>
Does anyone think Array#join with a block is a potential RCR?
[ ruby-Patches-8716 ] Add option to Test::Unit::Assertions#assert_raise to allow subclasses
Patches item #8716, was opened at 2007-02-16 19:24
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=1700&aid=8716&group_id=426
Category: Ruby1.8
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Edwin Fine (efine)
Assigned to: Nobody (None)
Summary: Add option to Test::Unit::Assertions#assert_raise to allow subclasses
Initial Comment:
The current assert_raise method tests that a specific list of exceptions is raised. This is often overly restrictive, because sometimes one has to allow for the raising of a base exception OR any exception derived from that
base exception. This patch adds that functionality by providing an optional last parameter to assert_raise. I did this to preserve DRY and to try to stay backward-compatible. Older test suites should run unchanged. However, newer test suites that include the optional parameter will not run correctly with older test-unit code. This would be a problem even if I added a new method.
The last (optional) parameter must be a hash of hashes. The primary hash key must be the symbol :opts. The hash corresponding to that key must contain the entry :allow_subclasses => true. Any other case will revert to the current, more restrictive behavior. If the last parameter is the correct type (hash of hashes) and contains the correct key (:opts), it will be removed from the argument list during assert_raise processing. This will somewhat future-proof the code so that additional parameters could be added if necessary.
I patched the trunk version of assertions.rb, but could not get the trunk to compile, so I copied assertions.rb to my 1.85 installation and tested it there with existing unit tests. It seems to work fine.
Example:
def test_for_nil_ruleset
opts = {:opts => { :allow_subclasses => true }}
assert_raise Validators::RuleException, opts do
validator = Validators::ParamValidation.new(nil)
end
end
Here's the CHANGELOG entry, if you need one:
Here's the patch to the trunk version (revision 11764) of assertions.rb:
@@ -98,17 +98,39 @@
modules.any? {|mod| actual_exception.is_a?(mod)}
end
+ def _expected_exception_or_subclass?(actual_exception, exceptions, modules) # :nodoc:
+ exceptions.any? {|cls| actual_exception.class <= cls} or
+ modules.any? {|mod| actual_exception.is_a?(mod)}
+ end
+
##
# Passes if the block raises one of the given exceptions.
+ # If last argument is a hash with key of :opts, and value
+ # another hash {<some_sym> => true}, options will be
+ # processed. Currently there's only one option
+ # :allow_subclasses, which will make this assertion pass if
+ # the block raises one of the given exceptions <b>or
+ # any of their subclasses</b>.
#
- # Example:
+ # Examples:
# assert_raise RuntimeError, LoadError do
# raise 'Boom!!!'
# end
+ #
+ # opts = {:opts => {:allow_subclasses => true}}
+ # assert_raise RuntimeError, LoadError, opts do
+ # raise 'Boom!!!'
+ # end
public
def assert_raise(*args)
_wrap_assertion do
+ allow_subclasses = false
+ if Hash === (opts = args.last) and opts.has_key?(:opts)
+ args.pop
+ allow_subclasses = (Hash === opts[:opts] and opts[:opts][:allow_subclasses])
+ end
+
if Module === args.last
message = ""
else
@@ -127,7 +149,13 @@
false
end
full_message = build_message(message, "<?> exception expected but was\n?", expected, actual_exception)
- assert_block(full_message) {_expected_exception?(actual_exception, exceptions, modules)}
+ assert_block(full_message) do
+ if allow_subclasses
+ _expected_exception_or_subclass?(actual_exception, exceptions, modules)
+ else
+ _expected_exception?(actual_exception, exceptions, modules)
+ end
+ end
actual_exception
end
end
Regards,
Edwin Fine
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=1700&aid=8716&group_id=426