On Tue, 23 Apr 2002, Dan Sugalski wrote:

> At 12:25 PM +0200 4/19/02, Peter Gibbs wrote:
> >Mike Lambert wrote:
>
> >This effect is exacerbated by the fact that "set S1, S2" does a
> >string_copy - I am still not sure what is supposed to happen here; I believe
> >that the pure set opcode should just be doing a register copy?? There is a
> >clone opcode which also does a string_copy, which seems reasonable.
>
> set S0, S1 is broken. I'm fixing that now.

 And here's a test for that. (By the way, is there any way to test it more
 directly?)

 Simon

--- t/op/string.t.old   Tue Apr 23 15:42:36 2002
+++ t/op/string.t       Tue Apr 23 15:49:40 2002
@@ -1,6 +1,6 @@
 #! perl -w

-use Parrot::Test tests => 76;
+use Parrot::Test tests => 77;

 output_is( <<'CODE', <<OUTPUT, "set_s_s|sc" );
        set     S4, "JAPH\n"
@@ -30,7 +30,7 @@
        end
 CODE

-output_is( <<'CODE', <<OUTPUT, "chopn_s_i|ic" );
+output_is( <<'CODE', <<OUTPUT, "chopn with clone" );
        set     S4, "JAPHxyzw"
        set     S5, "japhXYZW"
         clone     S3, S4
@@ -52,6 +52,28 @@
 JAPHxyzw
 OUTPUT

+output_is( <<'CODE', <<OUTPUT, "chopn with set" );
+       set     S4, "JAPHxyzw"
+       set     S5, "japhXYZW"
+        set     S3, S4
+       set     S1, "\n"
+       set     I1, 4
+       chopn   S4, 3
+       chopn   S4, 1
+        chopn S5, I1
+       print   S4
+        print S1
+       print   S5
+        print S1
+       print   S3
+        print S1
+       end
+CODE
+JAPH
+japh
+JAPH
+OUTPUT
+
 output_is(<<'CODE', <<OUTPUT, "chopn, OOB values");
        set     S1, "A string of length 21"
        chopn   S1, 0


Reply via email to