Raku / roast

🦋 Raku test suite
https://raku.org/
Artistic License 2.0
177 stars 135 forks source link

Assignment test in S02-magicals/progname.t tests nothing #339

Open ghost opened 6 years ago

ghost commented 6 years ago

$*PROGRAM-NAME is supposed to be a replacement for Perl 5's $0, but it doesn't work that way.

Current test does this, which is just creating a non-magical scoped dynvar:

use v6;
my $*PROGRAM-NAME = 'foo';
say qqx`ps $*PID`;
=output
  PID TTY      STAT   TIME COMMAND
 6032 pts/1    Sl+    0:00 /home/ant/perl6/install/bin/moar --execname=/home/ant/perl6/install/bin/perl6 --libpath=/home/ant/perl6/install/share/nqp/lib --libpath=/home/ant/perl6/install/share/nqp/lib --libpath=/home/ant/perl6/install/share/perl6/lib --libpath=/home/ant/perl6/install/share/perl6/runtime /home/ant/perl6/install/share/perl6/runtime/perl6.moarvm test.pl

What I'd expect to work:

use v6;
$*PROGRAM-NAME = 'foo';
say `ps $$`;
=output
Cannot modify an immutable Str (test.pl)
  in block <unit> at test.pl line 2

What should happen:

use v5.26;
$0 = "foo";
say `ps $$`;
__DATA__
#  PID TTY      STAT   TIME COMMAND
# 5875 pts/1    S+     0:00 foo
zoffixznet commented 6 years ago

$*PROGRAM-NAME is supposed to be a replacement for Perl 5's $0, but it doesn't work that way.

Opened a ticket for that problem: https://rt.perl.org/Ticket/Display.html?id=132194