Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test.pm - eval_lives_ok emits warning "Use of uninitialized value in numeric context" #2135

Closed
p6rt opened this issue Sep 2, 2010 · 8 comments

Comments

@p6rt
Copy link

p6rt commented Sep 2, 2010

Migrated from rt.perl.org#77650 (status was 'resolved')

Searchable as RT77650$

@p6rt
Copy link
Author

p6rt commented Sep 2, 2010

From @bbkr

[12​:21] <bbkr> rakudo​: use Test; eval_lives_ok '1<&1'
[12​:21] <p6eval> rakudo 27d54d​: OUTPUT«Use of uninitialized value in numeric
context�ok 1 - �»

The "Use of uninitialized value in numeric context" warning should not be
emited o STDERR, compare it to the case​:

$ perl6 -e 'use Test; eval_lives_ok "die 1"'
not ok 1 -

(no STDERR output is "leaking through" eval_lives_ok, not eval_lives_ok itself
emits one).

@p6rt
Copy link
Author

p6rt commented Jul 12, 2012

From @bbkr

Now it is​:

rakudo c2c02a​: OUTPUT«use of uninitialized variable $v of type Any in numeric context in block
<anon> at eval_0​:1â�¤â�¤ok 1 - â�¤Â»

@p6rt
Copy link
Author

p6rt commented Apr 22, 2013

From @coke

On Thu Sep 02 03​:36​:44 2010, pawel.pabian@​implix.com wrote​:

[12​:21] <bbkr> rakudo​: use Test; eval_lives_ok '1<&1'
[12​:21] <p6eval> rakudo 27d54d​: OUTPUT«Use of uninitialized value in
numeric
context�ok 1 - �»

The "Use of uninitialized value in numeric context" warning should not
be
emited o STDERR, compare it to the case​:

$ perl6 -e 'use Test; eval_lives_ok "die 1"'
not ok 1 -

(no STDERR output is "leaking through" eval_lives_ok, not
eval_lives_ok itself
emits one).

No longer leaking diagnostic fluid​:

01​:24 < [Coke]> rakudo​: use Test; eval_lives_ok '1<&1'
01​:24 <+camelia> rakudo 0d1d11​: OUTPUT«not ok 1 - â�¤# Error​: Whitespace required
  before < operatorâ�¤Â»

Closable with tests.
--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Apr 22, 2013

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 25, 2014

From @usev6

I'm afraid the original complaint ist still valid​:

$ perl6 -e 'use Test; eval_lives_ok "1 <&1"'
use of uninitialized value of type Nil in numeric context in block <unit> at EVAL_0​:1

ok 1 -

For some reason now a whitespace is needed before '<' (STD agrees here) and the parsing error prevents the leaking warning​:

$ perl6 -e 'use Test; eval_lives_ok "1<&1"'
not ok 1 -

# Failed test at -e line 1
# Error​: Whitespace required before < operator

@p6rt
Copy link
Author

p6rt commented Apr 25, 2015

From @labster

I'm not sure that this is a real bug. Compare​:

% perl -MTest​::Exception -w -e 'lives_ok sub {print undef}, "foo";'
Use of uninitialized value in print at -e line 1.
ok 1 - foo
...
% perl6 -MTest -e 'lives_ok sub { Str.Str }, "foo"'
use of uninitialized value of type Str in string context in sub at -e​:1

ok 1 - foo

Would these warnings interfere with TAP processing?

On Sat Oct 25 10​:04​:11 2014, bartolin@​gmx.de wrote​:

I'm afraid the original complaint ist still valid​:

$ perl6 -e 'use Test; eval_lives_ok "1 <&1"'
use of uninitialized value of type Nil in numeric context in block
<unit> at EVAL_0​:1

ok 1 -

For some reason now a whitespace is needed before '<' (STD agrees
here) and the parsing error prevents the leaking warning​:

$ perl6 -e 'use Test; eval_lives_ok "1<&1"'
not ok 1 -

# Failed test at -e line 1
# Error​: Whitespace required before < operator

@p6rt
Copy link
Author

p6rt commented May 11, 2015

From @jdv

Added tests to S24-testing/3-output.t.

@p6rt p6rt closed this as completed May 11, 2015
@p6rt
Copy link
Author

p6rt commented May 11, 2015

@jdv - Status changed from 'open' to 'resolved'

@p6rt p6rt added the testneeded label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant