| 1 | #!perl |
|---|
| 2 | |
|---|
| 3 | # Copyright (C) 2006-2008, The Perl Foundation. |
|---|
| 4 | # $Id: $ |
|---|
| 5 | |
|---|
| 6 | use strict; |
|---|
| 7 | use warnings; |
|---|
| 8 | |
|---|
| 9 | use Test::More; |
|---|
| 10 | use File::Spec; |
|---|
| 11 | |
|---|
| 12 | my $perl6_pbc = File::Spec->catfile( '..', '..', 'languages', 'perl6', 'perl6.pbc' ); |
|---|
| 13 | plan skip_all => "Need to first run make in languages/perl6" if not -e $perl6_pbc; |
|---|
| 14 | |
|---|
| 15 | plan tests => 6; |
|---|
| 16 | |
|---|
| 17 | use_ok('Parrot::Embed') or exit; |
|---|
| 18 | |
|---|
| 19 | my $module = 'Parrot::Interpreter'; |
|---|
| 20 | my $interp = $module->new(); |
|---|
| 21 | ok( $interp, 'new() should return a valid interpreter' ); |
|---|
| 22 | isa_ok( $interp, $module ); |
|---|
| 23 | |
|---|
| 24 | my $result = eval { $interp->load_file($perl6_pbc) }; |
|---|
| 25 | my $except = $@; |
|---|
| 26 | ok( $result, '... returning true if it could load the file' ); |
|---|
| 27 | is( $except, '', '... throwing no exeption if so' ); |
|---|
| 28 | |
|---|
| 29 | my $perl6 = $interp->find_global( 'main', 'Perl6', 'Compiler' ); |
|---|
| 30 | isa_ok( $perl6, 'Parrot::PMC' ); |
|---|
| 31 | |
|---|