Skip to content

t/op/lexsub.t: A harness curiosum #23648

@jkeenan

Description

@jkeenan

Observed today on blead at f69a90f. Begin by configuring and running make minitest_prep.

$  ./miniperl -Ilib t/op/lexsub.t 2>&1 | head -n 22
1..158
ok 1 - calling our sub from same package
...
ok 16 - our subs from other packages override all keywords
ok 17 - our sub pointing to "use constant" constant
ok 18 - our sub symbol translation does not affect meth names
#4242
ok 19 - our sub symbol translation & meth names after print
ok 20 - name_of_our_sub <newline> =>  is parsed properly

Now, complete the build (make test_prep) and run with ./perl:

$  ./perl -Ilib t/op/lexsub.t 2>&1 | head -n 22
1..158
ok 1 - calling our sub from same package
...
ok 16 - our subs from other packages override all keywords
ok 17 - our sub pointing to "use constant" constant
ok 18 - our sub symbol translation does not affect meth names
#4242
ok 19 - our sub symbol translation & meth names after print
ok 20 - name_of_our_sub <newline> =>  is parsed properly

But now, run with the harness (output trimmed):

$ cd t;./perl harness -v op/lexsub.t 2>&1 ; cd -

ok 1 - calling our sub from same package
ok 2 - calling our sub from same package (amper)
ok 3 - calling our sub from another package
ok 4 - calling our sub from another package (amper)
ok 5 - our sub falling out of scope
ok 6 - our sub falling out of scope (called via amper)
ok 7 - our sub invisible inside itself
ok 8 - our sub invisible inside itself (called via amper)
ok 9 - our sub visible inside itself after decl
ok 10 - our sub visible inside itself after decl (amper)
ok 11 - our sub foo; makes lex alias for existing sub
ok 12 - our sub foo; makes lex alias for existing sub (amper)
ok 13 - our sub foo; applies to subsequent sub foo {}
ok 14 - our sub with proto
ok 15 - lexical subs (even our) override all keywords
ok 16 - our subs from other packages override all keywords
ok 17 - our sub pointing to "use constant" constant
ok 18 - our sub symbol translation does not affect meth names
ok 19 - our sub symbol translation & meth names after print
ok 20 - name_of_our_sub <newline> =>  is parsed properly
ok 21 - sort our_sub
ok 22 - pad cleanup for a closure referring to an our sub
...

Where did the line with #4242 go?

But yet again, when run through the harness, then piped to head:

$ cd t;./perl harness -v op/lexsub.t 2>&1 | head -n 22; cd -
op/lexsub.t .. 
1..158
ok 1 - calling our sub from same package
ok 2 - calling our sub from same package (amper)
ok 3 - calling our sub from another package
ok 4 - calling our sub from another package (amper)
ok 5 - our sub falling out of scope
ok 6 - our sub falling out of scope (called via amper)
ok 7 - our sub invisible inside itself
ok 8 - our sub invisible inside itself (called via amper)
ok 9 - our sub visible inside itself after decl
ok 10 - our sub visible inside itself after decl (amper)
ok 11 - our sub foo; makes lex alias for existing sub
ok 12 - our sub foo; makes lex alias for existing sub (amper)
ok 13 - our sub foo; applies to subsequent sub foo {}
ok 14 - our sub with proto
ok 15 - lexical subs (even our) override all keywords
ok 16 - our subs from other packages override all keywords
ok 17 - our sub pointing to "use constant" constant
ok 18 - our sub symbol translation does not affect meth names
#4242
ok 19 - our sub symbol translation & meth names after print

Now #4242 is back. Why?

Relevant part of `t/op/lexsub.t:

  86 # our sub and method confusion
  87 sub F::h { 4242 }
  88 {
  89   my $called;
  90   our sub h { ++$called; 4343 };
  91   is((h F),4242, 'our sub symbol translation does not affect meth names');
  92   undef $called;
  93   print "#";
  94   print h F; # follows a different path through yylex to intuit_method
  95   print "\n";
  96   is $called, undef, 'our sub symbol translation & meth names after print'
  97 }

What am I not grokking?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions