Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > ANN: ZenTest 3.4.0 Released

Reply
Thread Tools

ANN: ZenTest 3.4.0 Released

 
 
Ryan Davis
Guest
Posts: n/a
 
      10-16-2005
ZenTest version 2.4.0 has been released!

http://www.zenspider.com/ZSS/Products/ZenTest/

** DESCRIPTION:

ZenTest scans your target and unit-test code and writes your missing
code based on simple naming rules, enabling XP at a much quicker
pace. ZenTest only works with Ruby and Test::Unit.

There are two strategies intended for ZenTest: test conformance
auditing and rapid XP.

For auditing, ZenTest provides an excellent means of finding methods
that have slipped through the testing process. I've run it against my
own software and found I missed a lot in a well tested
package. Writing those tests found 4 bugs I had no idea existed.

ZenTest can also be used to evaluate generated code and execute your
tests, allowing for very rapid development of both tests and
implementation.

** FEATURES/PROBLEMS:

+ Scans your ruby code and tests and generates missing methods for you.
+ Includes a very helpful filter for Test::Unit output called
unit_diff.rb
+ Includes a LinuxJournal article on testing with ZenTest written by
Pat Eyler.

http://www.zenspider.com/ZSS/Products/ZenTest/

Changes:

+ 3 minor enhancements
+ Able to audit standard class library (so now we can audit
rubicon!).
+ Able to map against class methods (self.blah <=>
test_class_blah).
+ Added -I=rubypath support
+ 4 bug fixes
+ bug:1151 Fixed stupid problem w/ unit_diff.
+ bug:1454 code generation correctly matches class/module for
nested classes.
+ bug:1455 Updated method mapping to work on all operators
listed in my quickref.
+ Realized I'm a moron and did NOT release in March like I
thought...

http://www.zenspider.com/ZSS/Products/ZenTest/



--
http://www.velocityreviews.com/forums/(E-Mail Removed) - Seattle.rb - http://www.zenspider.com/
seattle.rb
http://blog.zenspider.com/ - http://rubyforge.org/projects/ruby2c




 
Reply With Quote
 
 
 
 
Christophe Grandsire
Guest
Posts: n/a
 
      10-18-2005
Selon Ryan Davis <(E-Mail Removed)>:

> ZenTest version 2.4.0 has been released!
>


Thank you very much for it! I've always wanted to learn about unit testin=
g, but
never got around to do it because no tutorial I could find was really
practical. Now I can easily begin learning through use by letting ZenTest
generate tests around some of my old untested code! Thanks a lot for this=
great
tool!
--
Christophe Grandsire.

http://rainbow.conlang.free.fr

It takes a straight mind to create a twisted conlang.


 
Reply With Quote
 
 
 
 
Ryan Davis
Guest
Posts: n/a
 
      10-18-2005

On Oct 18, 2005, at 5:44 AM, Christophe Grandsire wrote:

> Selon Ryan Davis <(E-Mail Removed)>:
>
>
>> ZenTest version 2.4.0 has been released!

>
> Thank you very much for it! I've always wanted to learn about unit
> testing, but
> never got around to do it because no tutorial I could find was really
> practical. Now I can easily begin learning through use by letting
> ZenTest
> generate tests around some of my old untested code! Thanks a lot
> for this great
> tool!


You are very welcome. I look forward to your feedback.



 
Reply With Quote
 
Warren Seltzer
Guest
Posts: n/a
 
      10-18-2005
I see this notation, which appears to be undefined outside of hash literals, all over the
place. What does it do? The online version of the pickaxe book doesn't have it.

Here's a rails example:

def do_something
redirect_to :action => "elsewhere"
render :action => "overthere" # raises DoubleRenderError
end

Warren Seltzer




 
Reply With Quote
 
Christophe Grandsire
Guest
Posts: n/a
 
      10-18-2005
En r=E9ponse =E0 Warren Seltzer :
> I see this notation, which appears to be undefined outside of hash lite=

rals, all over the
> place. What does it do? The online version of the pickaxe book doesn=

't have it.
>=20
> Here's a rails example:
>=20
> def do_something
> redirect_to :action =3D> "elsewhere"
> render :action =3D> "overthere" # raises DoubleRenderError
> end
>=20


Basically, those are hash literals too. They look a bit like keyword=20
arguments because of the syntactic sugar that Ruby allows:
- If the only argument of a method is a hash, you can lose the {}:=20
"mymethod({:foo =3D> "bar"})" can be written "mymethod(:foo =3D> "bar")"
- Parentheses around the parameter list of a method are optional:
"mymethod(foo)" can be written "mymethod foo"
Add both rules, and you get exactly the syntax of your example.=20
"redirect_to" and "render" are actually just methods that take hash=20
arguments ('redirect_to :action =3D> "elsewhere"' is just another way to=20
write 'redirect_to({:action =3D> "elsewhere"})' in a clearer and key-hit=20
saving way ), and the two syntactic sugar rules allows one to use=20
them in a keyword+keyword argument fashion. Neat isn't it?

As for why the online Pickaxe doesn't have it, it may be because the=20
hash syntactic sugar is only present since Ruby 1.8, while the online=20
Pickaxe covers Ruby 1.6. But I could be wrong.
--=20
Christophe Grandsire.

http://rainbow.conlang.free.fr

You need a straight mind to invent a twisted conlang.


 
Reply With Quote
 
Jamis Buck
Guest
Posts: n/a
 
      10-18-2005
As you know, you can create a hash like so:

hash = { :action => "overthere" }

You could, if you so desired, then pass this hash to a method:

render(hash)

You could combine the two to get:

render({ :action => "overthere" })

Ruby actually lets you omit the curly braces when the hash is the
last parameter of a method:

render :action => "overthere"

The above just calls render with a single hash as the parameter,
containing :action. You can specify as many arguments as you want,
and as long as the hash parameters are the last ones, it all Just
Works, with the last parameter of the method receiving the hash.

- Jamis

On Oct 18, 2005, at 3:26 PM, Warren Seltzer wrote:

> I see this notation, which appears to be undefined outside of hash
> literals, all over the
> place. What does it do? The online version of the pickaxe book
> doesn't have it.
>
> Here's a rails example:
>
> def do_something
> redirect_to :action => "elsewhere"
> render :action => "overthere" # raises DoubleRenderError
> end
>
> Warren Seltzer
>
>
>
>




 
Reply With Quote
 
Brian Schröder
Guest
Posts: n/a
 
      10-18-2005
On 18/10/05, Christophe Grandsire <(E-Mail Removed)> wrote:
> En r=E9ponse =E0 Warren Seltzer :
> > I see this notation, which appears to be undefined outside of hash lite=

rals, all over the
> > place. What does it do? The online version of the pickaxe book doesn=

't have it.
> >
> > Here's a rails example:
> >
> > def do_something
> > redirect_to :action =3D> "elsewhere"
> > render :action =3D> "overthere" # raises DoubleRenderError
> > end
> >

>
> Basically, those are hash literals too. They look a bit like keyword
> arguments because of the syntactic sugar that Ruby allows:
> - If the only argument of a method is a hash, you can lose the {}:
> "mymethod({:foo =3D> "bar"})" can be written "mymethod(:foo =3D> "bar")"
> - Parentheses around the parameter list of a method are optional:
> "mymethod(foo)" can be written "mymethod foo"
> Add both rules, and you get exactly the syntax of your example.
> "redirect_to" and "render" are actually just methods that take hash
> arguments ('redirect_to :action =3D> "elsewhere"' is just another way to
> write 'redirect_to({:action =3D> "elsewhere"})' in a clearer and key-hit
> saving way ), and the two syntactic sugar rules allows one to use
> them in a keyword+keyword argument fashion. Neat isn't it?
>
> As for why the online Pickaxe doesn't have it, it may be because the
> hash syntactic sugar is only present since Ruby 1.8, while the online
> Pickaxe covers Ruby 1.6. But I could be wrong.
> --
> Christophe Grandsire.
>
> http://rainbow.conlang.free.fr
>
> You need a straight mind to invent a twisted conlang.
>
>


It works not only when the method has only one argument, but always
with the last argument.

$ irb
irb(main):001:0> def show(*args) p args end
=3D> nil
irb(main):002:0> show 1, 2, 3, 5 =3D> 6
[1, 2, 3, {5=3D>6}]
=3D> nil

regards,
brian

--
http://ruby.brian-schroeder.de/

Stringed instrument chords: http://chordlist.brian-schroeder.de/


 
Reply With Quote
 
Martin DeMello
Guest
Posts: n/a
 
      10-18-2005
Brian Schröder <(E-Mail Removed)> wrote:
>
> It works not only when the method has only one argument, but always
> with the last argument.
>
> $ irb
> irb(main):001:0> def show(*args) p args end
> => nil
> irb(main):002:0> show 1, 2, 3, 5 => 6
> [1, 2, 3, {5=>6}]
> => nil


And (since none of the examples have made that explicit), the hash can
have more than one element in it.

irb(main):002:0> show 1, 2, 3, 4 => 5, 6 => 7
[1, 2, 3, {6=>7, 4=>5}]
=> nil

martin
 
Reply With Quote
 
Christophe Grandsire
Guest
Posts: n/a
 
      10-18-2005
En r=E9ponse =E0 Brian Schr=F6der :
>=20
> It works not only when the method has only one argument, but always
> with the last argument.
>=20
> $ irb
> irb(main):001:0> def show(*args) p args end
> =3D> nil
> irb(main):002:0> show 1, 2, 3, 5 =3D> 6
> [1, 2, 3, {5=3D>6}]
> =3D> nil
>=20


Thanks for pointing that out. I've only ever seen this with methods that=20
have only the hash as argument (mainly rails examples), so I didn't know=20
normal parameters are allowed as long as they preceed the hash.
--=20
Christophe Grandsire.

http://rainbow.conlang.free.fr

You need a straight mind to invent a twisted conlang.


 
Reply With Quote
 
James Edward Gray II
Guest
Posts: n/a
 
      10-18-2005
On Oct 18, 2005, at 5:03 PM, Christophe Grandsire wrote:

> Thanks for pointing that out. I've only ever seen this with methods
> that have only the hash as argument (mainly rails examples), so I
> didn't know normal parameters are allowed as long as they preceed
> the hash.


Rails has lots of the latter too. For example:

find(:all, :conditions => "whatever...") # first arg not part of hash

James Edward Gray II



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANN] ZenTest 3.4.1 Released Ryan Davis Ruby 0 10-14-2006 02:01 AM
[ANN] ZenTest 3.4.0 Released Ryan Davis Ruby 2 09-13-2006 07:57 PM
[ANN] ZenTest 3.1.0 Released Ryan Davis Ruby 1 03-30-2006 05:18 AM
[ANN] ZenTest 3.0.0 Released Ryan Davis Ruby 3 03-07-2006 11:01 PM
ZenTest 2.3.0 Released Ryan Davis Ruby 1 12-16-2004 05:52 AM



Advertisments