Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Autovivification for dummies (using Test::More)

by revdiablo (Prior)
on Jul 29, 2005 at 06:45 UTC ( [id://479249]=note: print w/replies, xml ) Need Help??


in reply to Autovivification for dummies (using Test::More)

I'm not quite sure why you arranged your last two tests to fail. It's my understanding that test suites are intended to test the promises made by a certain interface, usually described in documentation. In this case, autovivification is a documented and expected behavior. Why should that cause the tests to fail?

  • Comment on Re: Autovivification for dummies (using Test::More)

Replies are listed 'Best First'.
Re^2: Autovivification for dummies (using Test::More)
by tphyahoo (Vicar) on Jul 29, 2005 at 11:40 UTC
    Good question.

    Here, I was using Test::Morefor rhetorical and didactical purposes: in other words, I was trying to make a point. My point was, to illustrate how the "naive" expectation of dereferencing is contradicted by the reality of how autovivification works. I didn't mean that autovivification is a bug; I understand that this behavior is there for a purpose, controversial though it may be.

    Your question made me reflect a bit, and realize that I have lately been incorporating Test::More into my perlmonks posts, in two ways.

    1. In SOPW posts, I am showing the behavior I want, but am not getting, with test more failing.
    2. In Meditations, I am using test more rhetorical, as here, to make points.
    I guess I am also hoping to spread the testing gospel in this way, as well as my own test fu.
      My point was to illustrate how the "naive" expectation of dereferencing is contradicted by the reality of how autovivification works.

      Ok, that is a perfectly reasonable explanation. It might have been nice to say that in the original post, but I know how hard it can be to figure out the things people will have questions or confusion about.

      I have lately been incorporating Test::More into my perlmonks posts

      I like this idea. One of the reasons I like tests is they can convey a lot of information in a convenient, machine-usable little packet. They are just like the test snippets I usually end up writing, but in addition they show where my expectations are violated or upheld.

        I have started a perlmonks tutorial series called "How to ask Questions (with Test::More) at tutorials.

        So far there is:

        How To Ask a Question (With Test::More)
        How to Ask A Regex Question (With Test::More)

        and more coming soon. :)

      Understood, but I think people would find it clearer if you negated your test so that they all past, rather than posting tests which are meant to fail.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://479249]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-16 19:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found