Author: particle
Date: Wed Sep 28 16:19:47 2005
New Revision: 9267

Modified:
   trunk/runtime/parrot/library/Data/Escape.imc
   trunk/t/library/data_escape.t
Log:
modify Data::Escape to deal with escaped characters followed by numbers. test 
added.

Modified: trunk/runtime/parrot/library/Data/Escape.imc
==============================================================================
--- trunk/runtime/parrot/library/Data/Escape.imc        (original)
+++ trunk/runtime/parrot/library/Data/Escape.imc        Wed Sep 28 16:19:47 2005
@@ -121,7 +121,7 @@ default:
        .local pmc char
     $P0 = new .ResizableIntegerArray
     push $P0, test_char_ord
-    tmp = sprintf "\\%o", $P0
+    tmp = sprintf "\\%03o", $P0
     branch DONE
 
 DONE:

Modified: trunk/t/library/data_escape.t
==============================================================================
--- trunk/t/library/data_escape.t       (original)
+++ trunk/t/library/data_escape.t       Wed Sep 28 16:19:47 2005
@@ -181,7 +181,7 @@ pir_output_is($PRE . <<'CODE' . $POST, <
        .local string str

 

        str = '\ abc \t'

-       str = escape_string( str )

+       str = escape_string( str, '"' )

 

        print str

        goto END

@@ -190,6 +190,20 @@ CODE

 OUT

 

 

+pir_output_is($PRE . <<'CODE' . $POST, <<'OUT', "escape_string: unprintable 
followed by numbers" );

+       .local string str

+

+       str = chr 2

+       concat str, '123'

+       str = escape_string( str, '"' )

+

+       print str

+       goto END

+CODE

+\002123

+OUT

+

+

 SKIP: {

        skip 'test not written' => 1;

 pir_output_is($PRE . <<'CODE' . $POST, <<'OUT', "escape_string: non-ascii", 
todo => 'test not written' );

@@ -234,6 +248,6 @@ OUT

 }

 

 ## don't forget to change the number of tests!

-BEGIN { plan tests => 13; }

+BEGIN { plan tests => 14; }

 

 # vim: ft=imc :

Reply via email to