Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-Simple CPAN distribution.

Report information
The Basics
Id: 33642
Status: resolved
Priority: 0/
Queue: Test-Simple

People
Owner: Nobody in particular
Requestors: igobonk [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: confusing diagnostic output for isnt for expected = 0
Dist: Test-More-0.78 Perl: 5.8.8 OS: Win XP Pro I wanted to verify a non-zero exit code, so I used: isnt ($exit_code, 0, "description"); In the case that $exit_code = 0, the output was: not ok 3 - decoder exit code for invalid header # Failed test 'decoder exit code for invalid header' # at lossless_self_test.pl line 425. # '0' # ne # '0' As you can see, the diagnostics aren't very helpful. The actual exit code (1) is not even displayed. I reversed the logic and used 'is' instead, even though it doesn't capture the true test case (i.e. not 0): is ($exit_code, 1, "description"); However, at least I got some meaningful diagnostic output: not ok 3 - decoder exit code for invalid header # Failed test 'decoder exit code for invalid headerr' # at lossless_self_test.pl line 424. # got: '0' # expected: '1' It seems as though the diagnostic output for 'isn't', at least in the case of expected = 0, needs to be looked at.
Subject: Re: [rt.cpan.org #33642] confusing diagnostic output for isnt for expected = 0
Date: Wed, 27 Feb 2008 21:15:56 -0800
To: bug-Test-Simple [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
David McBride via RT wrote: Show quoted text
> Dist: Test-More-0.78 > Perl: 5.8.8 > OS: Win XP Pro > > I wanted to verify a non-zero exit code, so I used: > > isnt ($exit_code, 0, "description"); > > In the case that $exit_code = 0, the output was: > > not ok 3 - decoder exit code for invalid header > # Failed test 'decoder exit code for invalid header' > # at lossless_self_test.pl line 425. > # '0' > # ne > # '0' > > As you can see, the diagnostics aren't very helpful. The actual exit > code (1) is not even displayed.
But you just said $exit_code was 0. If $exit_code is 0 and you expected anything but 0... where would 1 come from? -- There will be snacks.
Subject: Re: [rt.cpan.org #33642] confusing diagnostic output for isnt for expected = 0
Date: Wed, 27 Feb 2008 21:42:44 -0800
To: bug-Test-Simple [...] rt.cpan.org
From: "David McBride" <igobonk [...] gmail.com>
Hello Michael, Thanks for getting back to me. I mis-typed in the text of the bug. I meant what is stated in the bug title/description: expected = 0 (i.e. NOT 0 for 'isnt'). Sorry for the confusion. Thanks for an excellent piece of code that I've relied on for many projects for many years. - David On Wed, Feb 27, 2008 at 9:17 PM, Michael G Schwern via RT < bug-Test-Simple@rt.cpan.org> wrote: Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=33642 > > > David McBride via RT wrote:
> > Dist: Test-More-0.78 > > Perl: 5.8.8 > > OS: Win XP Pro > > > > I wanted to verify a non-zero exit code, so I used: > > > > isnt ($exit_code, 0, "description"); > > > > In the case that $exit_code = 0, the output was: > > > > not ok 3 - decoder exit code for invalid header > > # Failed test 'decoder exit code for invalid header' > > # at lossless_self_test.pl line 425. > > # '0' > > # ne > > # '0' > > > > As you can see, the diagnostics aren't very helpful. The actual exit > > code (1) is not even displayed.
> > But you just said $exit_code was 0. If $exit_code is 0 and you expected > anything but 0... where would 1 come from? > > > -- > There will be snacks. > >
Subject: Re: [rt.cpan.org #33642] confusing diagnostic output for isnt for expected = 0
Date: Wed, 27 Feb 2008 22:02:06 -0800
To: bug-Test-Simple [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
David McBride via RT wrote: Show quoted text
> Thanks for getting back to me. > > I mis-typed in the text of the bug. I meant what is stated in the bug > title/description: expected = 0 (i.e. NOT 0 for 'isnt'). Sorry for the > confusion.
Sorry, I'm still not sure what you're reporting. Maybe you could paste what you're getting and then show me what you would like to see? -- 100. Claymore mines are not filled with yummy candy, and it is wrong to tell new soldiers that they are. -- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army http://skippyslist.com/list/
Subject: Re: [rt.cpan.org #33642] confusing diagnostic output for isnt for expected = 0
Date: Wed, 27 Feb 2008 22:22:54 -0800
To: bug-Test-Simple [...] rt.cpan.org
From: "David McBride" <igobonk [...] gmail.com>
Got this: not ok 3 - decoder exit code for invalid header # Failed test 'decoder exit code for invalid header' # at lossless_self_test.pl line 425. # '0' # ne # '0' (huh?) Would prefer something like this: not ok 3 - decoder exit code for invalid header # Failed test 'decoder exit code for invalid header' # at lossless_self_test.pl line 425. # got: '0' # expected: NOT '0' - David On Wed, Feb 27, 2008 at 10:03 PM, Michael G Schwern via RT < bug-Test-Simple@rt.cpan.org> wrote: Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=33642 > > > David McBride via RT wrote:
> > Thanks for getting back to me. > > > > I mis-typed in the text of the bug. I meant what is stated in the bug > > title/description: expected = 0 (i.e. NOT 0 for 'isnt'). Sorry for the > > confusion.
> > Sorry, I'm still not sure what you're reporting. Maybe you could paste > what > you're getting and then show me what you would like to see? > > > -- > 100. Claymore mines are not filled with yummy candy, and it is wrong > to tell new soldiers that they are. > -- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army > http://skippyslist.com/list/ > >
From: domo [...] computer.org
On Thu Feb 28 01:23:32 2008, davidmcb wrote: Show quoted text
> Got this: > > not ok 3 - decoder exit code for invalid header > # Failed test 'decoder exit code for invalid header' > # at lossless_self_test.pl line 425. > # '0' > # ne > # '0' > > (huh?) > > Would prefer something like this: > > not ok 3 - decoder exit code for invalid header > # Failed test 'decoder exit code for invalid header' > # at lossless_self_test.pl line 425. > # got: '0' > # expected: NOT '0' > > - David
Just to add an "AOL" and a quick test-case: $ perl -MTest::Builder -e 'my $t = Test::Builder->create; $t->plan(tests=>5); $t->is_eq(1, 1); $t->is_eq(1, 0); $t->isnt_eq(1, 0); $t->isnt_eq(0, 0); $t->isnt_eq(999, 999)' 1..5 ok 1 not ok 2 # Failed test at line . # got: '1' # expected: '0' ok 3 not ok 4 # Failed test at line . # '0' # ne # '0' not ok 5 # Failed test at line . # '999' # ne # '999' (warnings not enabled, as ok() gives rise to undefined variable bleats if the test cases are coming from a one-liner -- not a big deal). This has just bitten me in connection with smoke tests on ext/File/Glob/t/basic.t on bleadperl, where I intermittently see: not ok 6 # Failed test at ../ext/File/Glob/t/basic.t line 92. # '0' # ne # '0' for reasons unknown (and which are not your problem). I'd prefer to see a diagnostic in the format David suggests.
The next version will have this output: got: 'foo' expected: anything else