Skip to content

Commit

Permalink
A bunch of tests also relied on the ability to set attributes in a ty…
Browse files Browse the repository at this point in the history
…pe object. D'oh. Corrected.
  • Loading branch information
jnthn committed Jan 9, 2011
1 parent 4c967a1 commit 7e9d75b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
4 changes: 2 additions & 2 deletions t/hll/01-language.t
Expand Up @@ -2,7 +2,7 @@

plan(2);

ok( HLL::Compiler.language eq 'parrot', 'HLL::Compiler reports parrot');
ok( pir::compreg__Ps('parrot') ~~ HLL::Compiler, 'compreg for Parrot returns a HLL::Compiler' );

ok( pir::compreg__Ps('parrot') =:= HLL::Compiler, 'compreg "parrot"' );
ok( pir::compreg__Ps('parrot').language eq 'parrot', '.language gives "parrot"' );

10 changes: 6 additions & 4 deletions t/hll/02-modules.t
Expand Up @@ -2,14 +2,16 @@

plan(4);

my $comp := HLL::Compiler.get_module('HLL::Compiler');
ok($comp =:= HLL::Compiler.WHO, "correctly retrieved namespace");
my $parrot-comp := pir::compreg__Ps('parrot');

my $crow := HLL::Compiler.load_module('Crow');
my $comp := $parrot-comp.get_module('HLL::Compiler');
ok($comp =:= $parrot-comp.WHO, "correctly retrieved namespace");

my $crow := $parrot-comp.load_module('Crow');
ok( pir::isa(Crow::help, 'Sub'), "successfully loaded Crow::help");
ok( $crow =:= pir::get_hll_namespace__PP(['Crow']), "Crow ns correct");

my $getopt := HLL::Compiler.load_module('Getopt::Obj');
my $getopt := $parrot-comp.load_module('Getopt::Obj');
ok( $getopt =:= pir::get_hll_namespace__PP(['Getopt','Obj']), "Getopt::Obj ns");


10 changes: 6 additions & 4 deletions t/hll/03-exports.t
Expand Up @@ -11,20 +11,22 @@ module ABC {
&ABC::EXPORT::DEFAULT::alpha := &ABC::alpha;
$ABC::EXPORT::DEFAULT::gamma := $ABC::gamma;

my $module := HLL::Compiler.get_module('ABC');
my %exports := HLL::Compiler.get_exports($module);
my $parrot-comp := pir::compreg__Ps('parrot');

my $module := $parrot-comp.get_module('ABC');
my %exports := $parrot-comp.get_exports($module);

ok( %exports<sub><&alpha> =:= &ABC::alpha, 'DEFAULT sub alpha export' );
ok( !%exports<sub><&beta>, 'DEFAULT sub beta export');
ok( %exports<var><$gamma> eq 'gamma', 'DEFAULT var gamma export');

%exports := HLL::Compiler.get_exports($module, :tagset<ALL>);
%exports := $parrot-comp.get_exports($module, :tagset<ALL>);

ok( %exports<sub><&alpha> =:= &ABC::alpha, 'ALL sub alpha export' );
ok( %exports<sub><&beta> =:= &ABC::beta, 'ALL sub beta export');
ok( %exports<var><$gamma> eq 'gamma', 'ALL var gamma export');

%exports := HLL::Compiler.get_exports($module, '&beta', '$gamma');
%exports := $parrot-comp.get_exports($module, '&beta', '$gamma');

ok( %exports<sub><&beta> =:= &ABC::beta, 'named sub beta export');
ok( %exports<var><$gamma> eq 'gamma', 'named var gamma export');
Expand Down
6 changes: 4 additions & 2 deletions t/hll/04-import.t
Expand Up @@ -11,8 +11,10 @@ module ABC {
ABC::EXPORT::DEFAULT::alpha := ABC::alpha;
$ABC::EXPORT::DEFAULT::gamma := $ABC::gamma;

my $module := HLL::Compiler.get_module('ABC');
my %exports := HLL::Compiler.get_exports($module);
my $parrot-comp := pir::compreg__Ps('parrot');

my $module := $parrot-comp.get_module('ABC');
my %exports := $parrot-comp.get_exports($module);
HLL::Compiler.import(pir::get_namespace__P, %exports);

ok( alpha() eq 'alpha', "imported 'alpha' sub into current namespace" );
Expand Down

0 comments on commit 7e9d75b

Please sign in to comment.