ANN: ZenTest 3.4.0 Released

Discussion in 'Ruby' started by Ryan Davis, Oct 16, 2005.

  1. Ryan Davis

    Ryan Davis Guest

    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/



    --
    - Seattle.rb - http://www.zenspider.com/
    seattle.rb
    http://blog.zenspider.com/ - http://rubyforge.org/projects/ruby2c
     
    Ryan Davis, Oct 16, 2005
    #1
    1. Advertising

  2. Selon Ryan Davis <>:

    > 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.
     
    Christophe Grandsire, Oct 18, 2005
    #2
    1. Advertising

  3. Ryan Davis

    Ryan Davis Guest

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

    > Selon Ryan Davis <>:
    >
    >
    >> 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.
     
    Ryan Davis, Oct 18, 2005
    #3
  4. :whatever => thing QUESTION

    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
     
    Warren Seltzer, Oct 18, 2005
    #4
  5. Re: :whatever => thing QUESTION

    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.
     
    Christophe Grandsire, Oct 18, 2005
    #5
  6. Ryan Davis

    Jamis Buck Guest

    Re: :whatever => thing QUESTION

    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
    >
    >
    >
    >
     
    Jamis Buck, Oct 18, 2005
    #6
  7. Re: :whatever => thing QUESTION

    On 18/10/05, Christophe Grandsire <> 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/
     
    Brian Schröder, Oct 18, 2005
    #7
  8. Re: :whatever => thing QUESTION

    Brian Schröder <> 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
     
    Martin DeMello, Oct 18, 2005
    #8
  9. Re: :whatever => thing QUESTION

    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.
     
    Christophe Grandsire, Oct 18, 2005
    #9
  10. Re: :whatever => thing QUESTION

    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
     
    James Edward Gray II, Oct 18, 2005
    #10
  11. Re: :whatever => thing QUESTION

    Christophe Grandsire wrote:
    > 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.


    It was present in 1.6, too, and the online Pickaxe documents it. See the
    section entitled "Collecting Hash Arguments" at
    http://www.rubycentral.com/book/tut_methods.html.
     
    Timothy Hunter, Oct 18, 2005
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ryan Davis

    [ANN] ZenTest 3.0.0 Released

    Ryan Davis, Mar 7, 2006, in forum: Ruby
    Replies:
    3
    Views:
    125
    Eric Hodel
    Mar 7, 2006
  2. Ryan Davis

    [ANN] ZenTest 3.1.0 Released

    Ryan Davis, Mar 29, 2006, in forum: Ruby
    Replies:
    1
    Views:
    92
  3. Ryan Davis

    [ANN] ZenTest 3.4.0 Released

    Ryan Davis, Sep 13, 2006, in forum: Ruby
    Replies:
    2
    Views:
    98
    Ryan Davis
    Sep 13, 2006
  4. Ryan Davis

    [ANN] ZenTest 3.4.1 Released

    Ryan Davis, Oct 14, 2006, in forum: Ruby
    Replies:
    0
    Views:
    88
    Ryan Davis
    Oct 14, 2006
  5. Ryan Davis

    [ANN] ZenTest 3.4.2 Released

    Ryan Davis, Nov 9, 2006, in forum: Ruby
    Replies:
    0
    Views:
    88
    Ryan Davis
    Nov 9, 2006
Loading...

Share This Page