Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^5: iterator w/ wantarray()

by stevieb (Canon)
on Apr 26, 2020 at 17:58 UTC ( [id://11116089]=note: print w/replies, xml ) Need Help??


in reply to Re^4: iterator w/ wantarray()
in thread iterator w/ wantarray()

OP didn't post a question related to a Test::More script.

Unit testing questions are different, and the way I approach them is determined by whether the poster is the author of the test and the software behind it, or is simply having an issue during an install of software they want to use, but likely doesn't have any idea how the internals or its tests work.

I have gone on to supply patches to a good number of Open Source projects over the years because someone was having problems with unit tests of software they were simply trying to install and use, and I found bugs which I corrected.

Replies are listed 'Best First'.
Re^6: iterator w/ wantarray()
by jo37 (Deacon) on Apr 26, 2020 at 20:09 UTC

    Probably my question was too vague.

    I believe that one of the most precise ways to describe a specific problem is by a Test::More script or something alike. The expected outcome will be at the bottom of the script in that case. The OP's example was not far away from such. Complaining about it appears to be more expensive than looking at this SSCCE.

    And this thread definitely is :-)

    Greetings,
    -jo

    $gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$

      Throwing some code up and saying "help me fix it" without any indication what the code is supposed to do or isn't doing isn't efficient, even if it is a test file.

      I see my time as valuable. I'm not about to go digging through code no matter what if there is no proper description of the actual problem. Informing those one is asking help of of what the actual situation is allows people to delve deeper, or decide whether the problem would be better solved by someone else.

        I normally stay out of directed comments, but there have been a couple back and forths where it looks (to me) like neither of you is seeing the meaning that I am seeing in both your posts; hopefully, my perspective will help bring understanding to one or both sides. If not, sorry for butting in or getting things completely wrong.

        stevieb, my interpretation of what jo37 is trying to say is that putting the expected results in comments isn't that far removed from following the advice given in How to ask better questions using Test::More and sample data, where it is recommended that Seekers add Test::More tests to their SSCCE in order to make their expected results obvious. I believe, then, that jo37 was asking you whether you thought providing the expected data in the form of Test::More tests added just for the SSCCE was sufficient, or whether that would fall into your "I don't normally look for expected results ... at the bottom of the code" statement (with "in a comment" stripped out), especially since you "don't even look at code if the OP doesn't provide a problem statement, expected, and actual results up front"

        I cannot answer for stevieb, but for my personal answer to jo37's query, I would say that any program that prints the expected vs actual results -- especially using a recommended framework like Test::More -- would be enough to convince me that the OP had put in enough effort to be worth my time to help with (assuming I thought I had any insight into the problem... which I usually don't). On the other hand, just putting the expected results in comments is different, IMO, because it puts the onus on me and fellow monks, as the potential helpers, to figure out what results the OP wanted, rather than making it obvious to the monks that expected results are really included.

        My advice to the OP would be: Please make the expected results obvious to us: put it in a separate <code> block, or in the main <code> block after __END__, or using the advice in How to ask better questions using Test::More and sample data; or, at the very least, in your problem statement indicate "I have put the expected results in a comment just before the print statement of the actual results", because when it's just buried in the comments, how are we to know that it's in the comments without reading all the code first (when reading all the code and running it would be a waste of our time if we don't know what you expect the output to be).

        edit: rereading the thread, I was reminded the original problem statement was somewhat lacking in details -- a description of what "perl hacks - hack-27" was would have been helpful (though I eventually found it through google: it's the Perl Hacks book by chromatic, ovid and TheDamian), along with more description, like "that book's hack-27 proported to get multiple outputs from an iterator in one call, but I don't seem to be getting the outputs that I would expect (see my comments near the print statement)". And yes, given the original problem statement, I probably wouldn't have tried to answer (even if I had a clue as to what was going wrong, which I didn't at the time).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-04-26 07:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found