On Tue, 2001-10-16 at 13:04, Alex Gough wrote: > On Tue, 16 Oct 2001, Alex Gough wrote: > > On 16 Oct 2001, Brian Wheeler wrote: > > > > > I'm getting some weird results when using substr. Here's my test > > > program: > > > > It's probably something wrong with the constant table or the assembly > > phase, if the script is changed so that S1 is set to "-", say, it does > > more what I expect. > > Indeed it is. My CVS access isn't working (ask??) so here's a new test > to fail:
Actually its the set s,sc operation. I've modified it to use string_copy. I also added your test and committed them a few minutes ago. Thanks! This one had been really stumping me! Brian > > Alex Gough > > Index: parrot/t/op/string.t > =================================================================== > RCS file: /home/perlcvs/parrot/t/op/string.t,v > retrieving revision 1.11 > diff -u -r1.11 string.t > --- parrot/t/op/string.t 2001/10/14 00:43:50 1.11 > +++ parrot/t/op/string.t 2001/10/16 18:01:34 > @@ -1,6 +1,6 @@ > #! perl -w > > -use Parrot::Test tests => 23; > +use Parrot::Test tests => 24; > > output_is( <<'CODE', <<OUTPUT, "set_s_sc" ); > set S4, "JAPH\n" > @@ -296,6 +296,21 @@ > ok > OUTPUT > > +output_is(<<'CODE', <<OUTPUT, "same constant twice bug"); > + set S0, "" > + set S1, "" > + set S2, "foo" > + concat S1,S1,S2 > + print S1 > + print S0 > + print "\n" > +CODE > +foo > +OUTPUT > + > + > +# Helper subs > +################################################ > # Set all string registers to values given by &$_[0](reg num) > sub set_str_regs { > my $code = shift;