#!/usr/bin/pugs
use v6;
use Test;
plan 4;
my $a := $_; $_ = 30;
for 1 .. 3 { $a++ };
is $a, 33, 'global $_ increments' ;
# work around missing capabilities
# to get the output of 'say' into a test;
my $out = open("tmpfile", :w);
$out.say(3);
close $out;
my$in = open "tmpfile";
my $s = =$in; close $in;
unlink "tmpfile";
is $s,"3\n", 'and is the default argument for "say"';
#pugs> for .. { say };
my $out = open("tmpfile", :w);
for 1 { say $out, };
close $out;
my$in = open "tmpfile";
my $s = =$in; close $in;
unlink "tmpfile";
isnt $s,"3\n", 'and global $_ should not be the default topic of "for"';
eval_ok 'for 1 .. 3 { $_++ } ', 'default topic is rw by default',:todo<bug>;
# #*** Error: cannot modify constant item at 1