develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34599 - branches/pdd22io_part3/t/pmc

From:
allison
Date:
December 29, 2008 19:06
Subject:
[svn:parrot] r34599 - branches/pdd22io_part3/t/pmc
Message ID:
20081230030621.27587CB9FA@x12.develooper.com
Author: allison
Date: Mon Dec 29 19:06:20 2008
New Revision: 34599

Modified:
   branches/pdd22io_part3/t/pmc/stringhandle.t

Log:
[pdd22io] Start to remove real temp file creations, since StringHandle doesn't
interact with real files. Add code to write dummy text to the StringHandle
objects, since it won't be reading from real files.


Modified: branches/pdd22io_part3/t/pmc/stringhandle.t
==============================================================================
--- branches/pdd22io_part3/t/pmc/stringhandle.t	(original)
+++ branches/pdd22io_part3/t/pmc/stringhandle.t	Mon Dec 29 19:06:20 2008
@@ -35,8 +35,6 @@
 ok 1 - $P0 = new 'StringHandle'
 OUT
 
-my (undef, $temp_file) = create_tempfile( UNLINK => 1 );
-
 # L<PDD22/I\/O PMC API/=item open.*=item close>
 pir_output_is( <<"CODE", <<'OUT', 'open and close - synchronous' );
 .sub 'test' :main
@@ -48,7 +46,7 @@
     say 'ok 2 - \$P1.close()'
 
     \$P3 = new 'StringHandle'
-    \$P3.'open'('$temp_file', 'rw')
+    \$P3.'open'('temp_file', 'rw')
     say 'ok 3 - \$P3.open(\$S1, \$S2) # rw mode'
     \$P3.'close'()
 
@@ -58,7 +56,7 @@
 
   test_7:
     \$P7 = new 'StringHandle'
-    \$P7.'open'('$temp_file', 'w')
+    \$P7.'open'('temp_file', 'w')
     say 'ok 7 - \$P7.open(\$S1, \$S2) # new file, write mode succeeds'
 
     goto end
@@ -112,6 +110,12 @@
     <<'CODE', <<'OUT', 'read - synchronous' );
 .sub 'test' :main
     $P0 = new 'StringHandle'
+    $P0.'open'('README', 'w')
+
+    $P0.'print'("This is Parrot, version")
+
+    $P0.'close'()
+
     $P0.'open'('README')
 
     $S0 = $P0.'read'(14) # bytes
@@ -136,7 +140,7 @@
 .sub 'test' :main
 
     \$P0 = new 'StringHandle'
-    \$P0.'open'('$temp_file', 'w')
+    \$P0.'open'('temp_file', 'w')
 
     \$P0.'print'(123)
     say 'ok 1 - \$P0.print(\$I1)'
@@ -152,7 +156,7 @@
     \$P0.'close'()
 
     \$P1 = new 'StringHandle'
-    \$P1.'open'('$temp_file', 'r')
+    \$P1.'open'('temp_file', 'r')
 
     \$S0 = \$P1.'read'(3) # bytes
     if \$S0 == "123" goto ok_5
@@ -179,8 +183,6 @@
 ok 6 - read string back from file
 OUT
 
-(undef, $temp_file) = create_tempfile( UNLINK => 1 );
-
 # L<PDD22/I\/O PMC API/=item print.*=item readline>
 pir_output_is( <<"CODE", <<'OUT', 'readline - synchronous' );
 .sub 'test' :main
@@ -189,12 +191,12 @@
                chomp = get_global ['String';'Utils'], 'chomp'
 
     \$P0 = new 'StringHandle'
-    \$P0.'open'('$temp_file', 'w')
+    \$P0.'open'('temp_file', 'w')
     \$P0.'print'("foobarbaz\\n42")
     \$P0.'close'()
 
     \$P1 = new 'StringHandle'
-    \$P1.'open'('$temp_file')
+    \$P1.'open'('temp_file')
 
     \$S0 = \$P1.'readline'()
     \$S0 = chomp( \$S0 )
@@ -218,6 +220,7 @@
 OUT
 
 my $LINES;
+my $temp_file;
 ($LINES, $temp_file) = create_tempfile( UNLINK => 1 );
 
 for my $counter (1 .. 10000) {
@@ -234,7 +237,7 @@
     .local pmc stringhandle
     .local int counter
     stringhandle = new 'StringHandle'
-    stringhandle.'open'('$temp_file')
+    stringhandle.'open'('temp_file')
 
     counter = 0
   read_loop:



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About