[svn:parrot] r36030 - in trunk/languages/pipp: src/common t/php
[email protected] Mon, 26 Jan 2009 06:12:02 -0800 (PST)
| Newsgroups | perl.cvs.parrot |
|---|---|
| Message-ID | <[email protected]> |
Author: bernhard
Date: Mon Jan 26 06:12:02 2009
New Revision: 36030
Modified:
trunk/languages/pipp/src/common/php_string.pir
trunk/languages/pipp/t/php/string.t
Log:
[Pipp] add 'chop' to strings extension
Modified: trunk/languages/pipp/src/common/php_string.pir
==============================================================================
--- trunk/languages/pipp/src/common/php_string.pir (original)
+++ trunk/languages/pipp/src/common/php_string.pir Mon Jan 26 06:12:02 2009
@@ -1,4 +1,4 @@
-# Copyright (C) 2008, The Perl Foundation.
+# Copyright (C) 2008-2009, The Perl Foundation.
# $Id$
=head1 NAME
@@ -7,6 +7,13 @@
=head1 DESCRIPTION
+See L<http://www.php.net/manual/en/book.strings.php>.
+
+=head1 TODO
+
+Implement functions.
+Rename file to extensions/strings.pir.
+
=head2 Functions
=over 4
@@ -134,6 +141,18 @@
.RETURN_STRING($S0)
.end
+=item C<string chop(string str [, string character_mask])>
+
+Alias of C<rtrim>.
+
+=cut
+
+.sub 'chop'
+ .param pmc args :slurpy
+
+ .tailcall rtrim(args :flat)
+.end
+
=item C<string chr(int ascii)>
Converts ASCII code to a character
@@ -234,6 +253,7 @@
.sub 'join'
.param pmc args :slurpy
+
.tailcall implode(args :flat)
.end
Modified: trunk/languages/pipp/t/php/string.t
==============================================================================
--- trunk/languages/pipp/t/php/string.t (original)
+++ trunk/languages/pipp/t/php/string.t Mon Jan 26 06:12:02 2009
@@ -23,7 +23,7 @@
use FindBin;
use lib "$FindBin::Bin/../../../../lib", "$FindBin::Bin/../../lib";
-use Parrot::Test tests => 36;
+use Parrot::Test tests => 37;
language_output_is( 'Pipp', <<'CODE', <<'OUT', 'bin2hex' );
@@ -68,6 +68,14 @@
abc
OUT
+language_output_is( 'Pipp', <<'CODE', <<'OUT', 'chop' );
+<?php
+ echo chop(' abcde ef '), "\n";
+?>
+CODE
+ abcde ef
+OUT
+
language_output_is( 'Pipp', <<'CODE', <<'OUT', 'str_repeat' );
<?php
echo str_repeat('Ab', 3), "\n";