develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35451 - in trunk: . ext/Parrot-Embed/t

From:
chromatic
Date:
January 12, 2009 11:39
Subject:
[svn:parrot] r35451 - in trunk: . ext/Parrot-Embed/t
Message ID:
20090112193859.67884CB9F9@x12.develooper.com
Author: chromatic
Date: Mon Jan 12 11:38:58 2009
New Revision: 35451

Added:
   trunk/ext/Parrot-Embed/t/languages.t   (contents, props changed)
Modified:
   trunk/MANIFEST
   trunk/ext/Parrot-Embed/t/pipp.t

Log:
[Parrot::Embed] Added a test file for using multiple languages from
Parrot::Embed (Gabor Szabo, TT #77).

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	(original)
+++ trunk/MANIFEST	Mon Jan 12 11:38:58 2009
@@ -879,6 +879,7 @@
 ext/Parrot-Embed/t/00-load.t                                []
 ext/Parrot-Embed/t/greet.pir                                []
 ext/Parrot-Embed/t/interp.t                                 []
+ext/Parrot-Embed/t/languages.t                              []
 ext/Parrot-Embed/t/pipp.t                                   []
 ext/Parrot-Embed/tools/check_embed_coverage.pl              []
 ext/Parrot-Embed/tools/write_typemap.pl                     []

Added: trunk/ext/Parrot-Embed/t/languages.t
==============================================================================
--- (empty file)
+++ trunk/ext/Parrot-Embed/t/languages.t	Mon Jan 12 11:38:58 2009
@@ -0,0 +1,45 @@
+#!perl
+
+# Copyright (C) 2009, The Perl Foundation.
+# $Id: $
+
+use strict;
+use warnings;
+
+use Test::More;
+use File::Spec;
+
+my $abc_pbc = File::Spec->catfile( '..', '..', 'languages', 'abc', 'abc.pbc' );
+plan skip_all => "Need to first run make in languages/abc" unless -e $abc_pbc;
+
+plan tests => 8;
+
+use_ok('Parrot::Embed') or exit;
+
+my $module = 'Parrot::Interpreter';
+my $interp = $module->new();
+ok( $interp, 'new() should return a valid interpreter' );
+isa_ok( $interp, $module );
+
+my $result = eval { $interp->load_file($abc_pbc) };
+my $except = $@;
+ok( $result, '... returning true if it could load the file' );
+is( $except, '', '... throwing no exeption if so' );
+
+my $abc = $interp->find_global( 'main', 'abc::Compiler' );
+isa_ok( $abc, 'Parrot::PMC' );
+
+SKIP: {
+    skip( 'Cannot find namespaced names yet', 2 );
+
+    my $pmc  = $abc->invoke('PS', '2+3');
+    ok( $pmc, 'invoke() should return a PMC, given that signature' );
+    is( $pmc->get_string(), 1, 'value returned in the PMC' );
+}
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Modified: trunk/ext/Parrot-Embed/t/pipp.t
==============================================================================
--- trunk/ext/Parrot-Embed/t/pipp.t	(original)
+++ trunk/ext/Parrot-Embed/t/pipp.t	Mon Jan 12 11:38:58 2009
@@ -1,5 +1,5 @@
 #!perl
-# Copyright (C) 2008, The Perl Foundation.
+# Copyright (C) 2008-2009, The Perl Foundation.
 # $Id$
 
 use strict;
@@ -28,7 +28,10 @@
 
 # What is 'Pipp' in hll namespace 'parrot' ?
 my $pipp_x = $interp->find_global( 'Pipp' );
-isa_ok( $pipp_x, 'Parrot::PMC' );
+{
+    local $TODO = 'Namespace and HLL not working yet';
+    isa_ok( $pipp_x, 'Parrot::PMC' );
+}
 
 # TODO: get hll id of Pipp
 # TODO: set hll namespace root to 'pipp'



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