[#15359] Timeout::Error — Jeremy Thurgood <jerith@...>

Good day,

41 messages 2008/02/05
[#15366] Re: Timeout::Error — Eric Hodel <drbrain@...7.net> 2008/02/06

On Feb 5, 2008, at 06:20 AM, Jeremy Thurgood wrote:

[#15370] Re: Timeout::Error — Jeremy Thurgood <jerith@...> 2008/02/06

Eric Hodel wrote:

[#15373] Re: Timeout::Error — Nobuyoshi Nakada <nobu@...> 2008/02/06

Hi,

[#15374] Re: Timeout::Error — Jeremy Thurgood <jerith@...> 2008/02/06

Nobuyoshi Nakada wrote:

[#15412] Re: Timeout::Error — Nobuyoshi Nakada <nobu@...> 2008/02/07

Hi,

[#15413] Re: Timeout::Error — Jeremy Thurgood <jerith@...> 2008/02/07

Nobuyoshi Nakada wrote:

[#15414] Re: Timeout::Error — Nobuyoshi Nakada <nobu@...> 2008/02/07

Hi,

[#15360] reopen: can't change access mode from "w+" to "w"? — Sam Ruby <rubys@...>

I ran 'rake test' on test/spec [1], using

16 messages 2008/02/05
[#15369] Re: reopen: can't change access mode from "w+" to "w"? — Nobuyoshi Nakada <nobu@...> 2008/02/06

Hi,

[#15389] STDIN encoding differs from default source file encoding — Dave Thomas <dave@...>

This seems strange:

21 messages 2008/02/06
[#15392] Re: STDIN encoding differs from default source file encoding — Yukihiro Matsumoto <matz@...> 2008/02/06

Hi,

[#15481] very bad character performance on ruby1.9 — "Eric Mahurin" <eric.mahurin@...>

I'd like to bring up the issue of how characters are represented in

16 messages 2008/02/10

[#15528] Test::Unit maintainer — Kouhei Sutou <kou@...>

Hi Nathaniel, Ryan,

22 messages 2008/02/13

[#15551] Proc#curry — ts <decoux@...>

21 messages 2008/02/14
[#15557] Re: [1.9] Proc#curry — David Flanagan <david@...> 2008/02/15

ts wrote:

[#15558] Re: [1.9] Proc#curry — Yukihiro Matsumoto <matz@...> 2008/02/15

Hi,

[#15560] Re: Proc#curry — Trans <transfire@...> 2008/02/15

[#15585] Ruby M17N meeting summary — Martin Duerst <duerst@...>

This is a rough translation of the Japanese meeting summary

19 messages 2008/02/18

[#15596] possible bug in regexp lexing — Ryan Davis <ryand-ruby@...>

current:

17 messages 2008/02/19

[#15678] Re: [ANN] MacRuby — "Rick DeNatale" <rick.denatale@...>

On 2/27/08, Laurent Sansonetti <laurent.sansonetti@gmail.com> wrote:

18 messages 2008/02/28
[#15679] Re: [ANN] MacRuby — "Laurent Sansonetti" <laurent.sansonetti@...> 2008/02/28

On Thu, Feb 28, 2008 at 6:33 AM, Rick DeNatale <rick.denatale@gmail.com> wrote:

[#15680] Re: [ANN] MacRuby — Yukihiro Matsumoto <matz@...> 2008/02/28

Hi,

[#15683] Re: [ANN] MacRuby — "Laurent Sansonetti" <laurent.sansonetti@...> 2008/02/28

On Thu, Feb 28, 2008 at 1:51 PM, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:

assert{ 2.0 } available with assert_xpath

From: Phlip <phlip2005@...>
Date: 2008-02-01 15:59:52 UTC
List: ruby-core #15335
Railsers:

My assert{ 2.0 } project will soon have its own package. It's available now as a 
"technology preview", bundled with assert_xpath.

It's better than the classic test assertions because when it fails it prints out 
its complete expression, and the intermediate value of each of its variables.

Install its dependency rubynode with it, like this:

   gem install rubynode
   piston import http://phlip.svnrepository.com/svn/yar_wiki/ vendor/plugins

The rest of assert_xpath (and its yar_wiki vehicle) are documented here:

   http://assertxpath.rubyforge.org/

(Non-Rails uses can toss these two files into their library paths...

   http://phlip.svnrepository.com/svn/yar_wiki/lib/assert_2_0.rb
   http://phlip.svnrepository.com/svn/yar_wiki/lib/ruby_reflector.rb

...then include Assert2_0 into their test suites to use the library.)

assert{ 2.0 } is for any Test::Unit::TestCase, not just Rails; that's why I will 
repackage it soon. Its source files are already portable; their only 
dependencies are Ruby and rubynode.

To use it, simply replace any of your calls to assert, assert_equal, 
assert_match, assert_kind_of, assert_operator, assert_not_nil, etc, in your 
developer tests. Replace them with assert{ raw ruby equivalent } (and replace 
assertions like assert_nil, assert_no_match, assert_not_equal with assert{}'s 
evil twin, deny{}).

You can write whatever you like inside - including sick complex expressions -
so long as their last statement return a positive (or negative) value.

The classic assertions only exist for one reason - to print out their values 
when they fail. And then they don't even reflect their variable names, either.

When assert{} fails, it prints its complete expression, with each
intermediate term and its value, like this:

assert{ "a topic" == ( topics["first"] ) }      --> false
     topics          --> {"first"=>"wrong topic"}
     topics["first"] --> "wrong topic"

The library is not published because I have not checked every single Ruby 
op_code off my list yet. (I had no idea there were so many!) If I'm missing
one, you get a clean error message that RubyReflector does not have a method 
"_foo", where "foo" is one of the opcode prefixes from Ruby's internal token 
table. If that happens to you (simplify your assertion!), and report "foo" to 
me, so I can move it to the top of my do-list.

Warning: When the assertion succeeds, it only evaluates its expression once. But 
when it fails, it evaluates the expression several more times, to extract the 
intermediate values. This will defeat boolean short-circuiting, and will hammer 
any side-effects in your methods. As usual, sloppy testing requires decoupled 
code, but I can't fix these without tweaking Ruby's evaluation kernel!

-- 
   Phlip

In This Thread

Prev Next