in reply to Checking two scalars in Test::More $expected. It works, but is it proper?

The question is whether or not using the (3 and 4) in the $expected position is the proper way to do this?

It's not, but what do you expect Perl to do with the expression (3 and 4)? What part of what Perl did do with it surprised you?

Replies are listed 'Best First'.
Re^2: Checking two scalars in Test::More $expected. It works, but is it proper?
by gctaylor1 (Hermit) on Mar 29, 2009 at 23:26 UTC
    The docs for Test::Simple explain that all tests run in scalar context. My subroutine returns two scalars so I was trying to compare the results to (3 and 4) in scalar context as well.

      Yes, I know that. What do you think (3 and 4) means to Perl? Is it an array? A list? A subroutine call? What did you intend for that code to produce?

      I know what it does. I have no idea why you used it. (Part of the problem is that I know what it does, and I have no idea why what it does would be useful to you in this context.)

        Before one of the answers above I would not have known that (3 and 4) were in list context. I didn't really think about scalar or list context as I was trying to understand how the test was working.

        I don't think I had enough understanding to intend much. Since it was my first test and all previous were failing I was trying to get anything to work and then try to understand after that why it worked. What I thought was happening was that Test::Simple was looking at each value and comparing it to the return values but I couldn't really see how it was doing that.

        I'm not sure I've answered your questions yet. I wonder if you're trying to teach me something and I haven't gotten it yet or my use was so out of whack your incredulous?