Cleaner failure messages?

Hi all.
Sorry if this is an old request…

Currently when a failure is reported it looks like this:

C:\dev\ruby\faster_rubygems\spec>spec
spec.faster_rubygems_cacheing.rb
F

RuntimeError in ‘FasterRubyGems cacheing Gem.bin_path should cache and
reload Gem.bin_path where possible’
assertion failed
C:/dev/ruby/faster_rubygems/spec/spec.faster_rubygems_cacheing.rb:
14:in `block (3 levels) in <top (required)>’

This is good because it tells me what line failed, but that’s about
it.

The skinny of this request is that I’d find it more useful to actually
have the code displayed that failed on line 14, in this case, the word
“fail”

so like this:
C:/dev/ruby/faster_rubygems/spec/spec.faster_rubygems_cacheing.rb:14:
“fail”
Instead of the current
C:/dev/ruby/faster_rubygems/spec/spec.faster_rubygems_cacheing.rb:
14:in `block (3 levels) in <top (required)>’

So the failure report is good, but could be improved.
Another option would be to display the line below what is currently
output, like

C:/dev/ruby/faster_rubygems/spec/spec.faster_rubygems_cacheing.rb:
14:in `block (3 levels) in <top (required)>’
fail

Or something like that.
Any thoughts there?
Thanks.
-rp

On Jun 19, 2010, at 3:54 PM, rogerdpack wrote:

RuntimeError in 'FasterRubyGems cacheing Gem.bin_path should cache and
“fail”
output, like

C:/dev/ruby/faster_rubygems/spec/spec.faster_rubygems_cacheing.rb:
14:in `block (3 levels) in <top (required)>’
fail

Or something like that.
Any thoughts there?
Thanks.

Already done in rspec-2. Likely won’t backport it to rspec-1 for some
time (if ever).

Cheers,
David

The skinny of this request is that I’d find it more useful to actually
have the code displayed that failed on line 14, in this case, the word
“fail”

Already done in rspec-2. Likely won’t backport it to rspec-1 for some time (if ever).

Nice. Looks like rspec-2 will fit the bill for me for now, then.

  1. Gem speeding Gem.bin_path the fake sick way should fake guess the
    right path instead of loading full rubygems for now
    Failure/Error: Unable to find matching line from backtrace

    spec.faster_rubygems.rb:29

    spec.faster_rubygems.rb:13

Perhaps it isn’t quite windows friendly?
Thanks.
-rp

On Jun 22, 2010, at 2:09 AM, rogerdpack wrote:

Failure/Error: Unable to find matching line from backtrace

spec.faster_rubygems.rb:29

spec.faster_rubygems.rb:13

Perhaps it isn’t quite windows friendly?

That happens now and then when the error is in code generated with
eval(string) with no file and ref numbers. Has nothing to do with
Windows as far as I know, and is the same problem we have with
ruby-debug.

HTH,
David

Failure/Error: Unable to find matching line from backtrace

Perhaps it isn’t quite windows friendly?

That happens now and then when the error is in code generated with eval(string) with no file and ref numbers. Has nothing to do with Windows as far as I know, and is the same problem we have with ruby-debug.

Interesting.
I get the same thing with Linux.
If I add the word “fail” to an rspec, it says the same (not an eval
string…)…

Here’s the output if I run it -b

  1. Gem speeding Gem.bin_path the fake sick way should fake guess the
    right path instead of loading full rubygems for now
    Failure/Error: Unable to find matching line from backtrace

    spec.faster_rubygems.rb:29:in `block (3 levels) in ’

    /home/rdp/installs/ruby-1.9.1-p376_installed/lib/ruby/gems/1.9.1/

gems/rspec-core-2.0.0.beta.12/lib/rspec/core/example.rb:47:in
`instance_eval’

Hmm.
-r

On Jun 22, 2010, at 10:27 AM, rogerdpack wrote:

Here’s the output if I run it -b

  1. Gem speeding Gem.bin_path the fake sick way should fake guess the
    right path instead of loading full rubygems for now
    Failure/Error: Unable to find matching line from backtrace

    spec.faster_rubygems.rb:29:in `block (3 levels) in ’

    /home/rdp/installs/ruby-1.9.1-p376_installed/lib/ruby/gems/1.9.1/

gems/rspec-core-2.0.0.beta.12/lib/rspec/core/example.rb:47:in
`instance_eval’

Please file an issue at Issues · rspec/rspec-core · GitHub

Feel free to reference the method that handles this:

Thanks