# New Ticket Created by  Simon Glover 
# Please include the string:  [perl #17803]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=17803 >



 The patches below add tests for:

  print_i_i
  print_i_n
  print_i_s
  print_i_p
  ne_n

 and improve the tests for the lexical ops.

 Simon

--- t/op/hacks.t.old    Tue Oct  8 13:46:31 2002
+++ t/op/hacks.t        Tue Oct  8 13:52:44 2002
@@ -1,6 +1,6 @@
 #! perl -w

-use Parrot::Test tests => 1;
+use Parrot::Test tests => 2;

 # It would be very embarrassing if these didn't work...
 open FOO, ">temp.file";
@@ -19,5 +19,32 @@
 1
 2
 OUTPUT
+
+open FOO, ">temp.file";  # Clobber previous contents
+close FOO;
+
+output_is(<<'CODE', <<'OUTPUT', "open & print");
+       set I0, -12
+       set N0, 2.2
+       set S0, "Foo"
+       new P0, .PerlString
+       set P0, "Bar\n"
+
+       open I1, "temp.file"
+       print I1, I0
+       print I1, N0
+       print I1, S0
+       print I1, P0
+       close I1
+
+       open I2, "temp.file"
+       readline S1, I2
+       close I2
+
+       print S1
+       end
+CODE
+-122.200000FooBar
+OUTPUT
 unlink("temp.file");
-1; # HONK
\ No newline at end of file
+1; # HONK

--- t/op/number.t.old   Tue Oct  8 13:59:03 2002
+++ t/op/number.t       Tue Oct  8 14:02:34 2002
@@ -1,6 +1,6 @@
 #! perl -w

-use Parrot::Test tests => 33;
+use Parrot::Test tests => 34;
 use Test::More;

 output_is(<<CODE, <<OUTPUT, "set_n_nc");
@@ -491,6 +491,50 @@ ok 1
 ok 2
 OUTPUT

+output_is(<<'CODE', <<OUTPUT, "ne_n");
+        set     N0, 1.234567
+        set     N1, -1.234567
+
+        bsr     BR1
+        print   "ok 1\n"
+        bsr     BR2
+        print   "ok 2\n"
+        bsr     BR3
+        print   "ok 3\n"
+        bsr     BR4
+        print   "ok 4\n"
+        bsr     BR5
+        print   "Shouldn't get here\n"
+        end
+
+BR1:    ne N0, N1
+        print "not ok 1\n"
+        ret
+
+BR2:    ne 2.54, N0
+        print "not ok 2\n"
+        ret
+
+BR3:    ne N0, 0.00
+        print "not ok 3\n"
+        ret
+
+BR4:    ne 1.0, 2.0
+        print "not ok 4\n"
+        ret
+
+BR5:    ne N0, N0
+        print "ok 5\n"
+        end
+
+CODE
+ok 1
+ok 2
+ok 3
+ok 4
+ok 5
+OUTPUT
+
 output_is(<<CODE, <<OUTPUT, "lt_n_ic");
        set     N0, 1000.0
        set     N1, 500.0

--- t/op/lexicals.t.old Tue Oct  8 14:16:20 2002
+++ t/op/lexicals.t     Tue Oct  8 14:21:25 2002
@@ -1,6 +1,6 @@
 #! perl -w

-use Parrot::Test tests => 2;
+use Parrot::Test tests => 3;

 output_is(<<CODE, <<OUTPUT, "simple store and fetch");
        new_pad
@@ -17,6 +17,33 @@ CODE
 12
 OUTPUT

+output_is(<<CODE, <<OUTPUT, "Repeated stores with the same key");
+       new_pad
+       new P0, .PerlInt
+       new P1, .PerlInt
+        set I0, 0
+LOOP:
+       set P0, I0
+       store_lex "a", P0
+       find_lex P1, "a"
+       print P1
+        print "\\n"
+        inc I0
+        lt I0, 10, LOOP
+       end
+CODE
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+OUTPUT
+
 output_is(<<CODE, <<OUTPUT, "nested scopes");
   new P0, .PerlInt
   new P1, .PerlInt
@@ -43,6 +70,10 @@ output_is(<<CODE, <<OUTPUT, "nested scop
       print "\\n"
       pop_pad

+    find_lex P3, "a"
+    print P3
+    print "\\n"
+
     pop_pad

   find_lex P3, "a"
@@ -52,6 +83,7 @@ output_is(<<CODE, <<OUTPUT, "nested scop
 CODE
 0
 2
+1
 0
 OUTPUT





Reply via email to