[svn:parrot] r35618 - trunk/languages/pipp/t/php

[email protected]
Newsgroups perl.cvs.parrot
Message-ID <[email protected]>
Author: bernhard
Date: Fri Jan 16 03:15:19 2009
New Revision: 35618

Modified:
   trunk/languages/pipp/t/php/namespace.t

Log:
[Pipp] Add simple namespace tests.

Modified: trunk/languages/pipp/t/php/namespace.t
==============================================================================
--- trunk/languages/pipp/t/php/namespace.t	(original)
+++ trunk/languages/pipp/t/php/namespace.t	Fri Jan 16 03:15:19 2009
@@ -24,7 +24,7 @@
 use FindBin;
 use lib "$FindBin::Bin/../../../../lib", "$FindBin::Bin/../../lib";
 
-use Parrot::Test tests => 3;
+use Parrot::Test tests => 6;
 
 language_output_is( 'Pipp', <<'CODE', <<'OUT', 'parsing of namespace directive' );
 <?php
@@ -37,6 +37,96 @@
 CODE
 OUT
 
+language_output_is( 'Pipp', <<'CODE', <<'OUT', 'namespace A', todo => 'not implemented yet' );
+<?php
+
+namespace A {
+    const FOO = "FOO in A\n";
+    echo FOO;
+}
+
+?>
+CODE
+FOO in A
+OUT
+
+language_output_is( 'Pipp', <<'CODE', <<'OUT', 'namespace A\B', todo => 'not implemented yet' );
+<?php
+
+namespace A\B {
+    const FOO = "FOO in A\\B\n";
+    echo FOO;
+}
+
+?>
+CODE
+FOO in A\B
+OUT
+
+=for perl6
+
+package A {
+    our $FOO = "FOO in A\n";
+}
+
+package A::B {
+    our $FOO  = "FOO in A::B\n";
+}
+
+package A {
+    our $FOO;
+    print $FOO;
+    print $A::FOO;
+    print $A::B::FOO;
+    say('');
+}
+
+package A::B {
+    our $FOO;
+    print $FOO;
+    print $A::FOO;
+    print $A::B::FOO;
+    say('');
+}
+
+=cut
+
+language_output_is( 'Pipp', <<'CODE', <<'OUT', 'namespace with constant', todo => 'not implemented yet' );
+<?php
+
+namespace A {
+    const FOO = "FOO in A\n";
+}
+
+namespace A\B {
+    const FOO  = "FOO in A:B\n";
+}
+
+namespace A {
+    echo FOO;
+    echo \A\B\FOO;
+    echo \A\FOO;
+    echo "\n";
+}
+
+namespace A\B {
+    echo FOO;
+    echo \A\B\FOO;
+    echo \A\FOO;
+    echo "\n";
+}
+
+?>
+CODE
+FOO in A
+FOO in A::B
+FOO in A
+
+FOO in A::B
+FOO in A::B
+FOO in A
+OUT
+
 language_output_is( 'Pipp', <<'CODE', <<'OUT', 'namespace with constant', todo => 'not implemented yet' );
 <?php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.