Changeset 18104 for ext

Show
Ignore:
Timestamp:
09/23/07 09:01:31 (16 months ago)
Author:
Darren_Duncan
Message:

ext/Muldis-DB/ : added does_ok() to Validator.pm ; fixed an Example.pm bug and temp commented-out any .WHERE

Location:
ext/Muldis-DB
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • ext/Muldis-DB/Changes

    r18100 r18104  
    106106    The SYNOPSIS, plus the MDB_50_Validate_Example.t, were minor updated. 
    107107 
     108    * (Validator.pm)  Added a &does_ok to Validator.pm, which in the Perl 6 
     109    Validator.pm is a modified copy of the &isa_ok of Test.pm but it tests 
     110    with .does rather than .isa; in the Perl 5 Validator.pm, the new 
     111    &does_ok is just a symbolic alias for the Test::More &isa_ok; in any 
     112    event, the rest of both versions of Validator.pm now invokes &does_ok 
     113    rather than &isa_ok, to keep their code bases more similar. 
     114 
    108115    * (SeeAlso.pod)  Updated the PROSPECTIVE MULDIS DB EXTENSIONS section 
    109116    mainly to bring various names, terminology, and references up to date 
  • ext/Muldis-DB/lib/Muldis/DB/Engine/Example.pm

    r18100 r18104  
    111111 
    112112    my $result = ::Muldis::DB::Engine::Example::Public::Var.new( 
    113         :dbms(self), 'sys.Core.Universal.Universal' ); 
     113        :dbms(self), :decl_type('sys.Core.Universal.Universal') ); 
    114114 
    115115#    $f.bind_func( :func_name($func_name) ); 
     
    191191 
    192192    $!dbms = $dbms; 
    193     $dbms!assoc_vars.{self.WHERE} = self; 
     193#    $dbms!assoc_vars.{self.WHERE} = self; 
     194#    weaken $dbms!assoc_vars.{self.WHERE}; 
    194195 
    195196#    $!var = ::Muldis::DB::Engine::Example::VM::Var.new( 
     
    200201 
    201202submethod DESTROY () { 
    202     $!dbms!assoc_vars.delete( self.WHERE ); 
     203#    $!dbms!assoc_vars.delete( self.WHERE ); 
    203204    return; 
    204205} 
  • ext/Muldis-DB/lib/Muldis/DB/Validator.pm

    r18100 r18104  
    2121    my Muldis::DB::Interface::DBMS $dbms = Muldis::DB::Interface::new_dbms( 
    2222        :engine_name($engine_name), :dbms_config($dbms_config) ); 
    23     isa_ok( $dbms, 'Muldis::DB::Interface::DBMS' ); 
     23    does_ok( $dbms, 'Muldis::DB::Interface::DBMS' ); 
    2424 
    2525    _scenario_foods_suppliers_shipments_v1( $dbms ); 
     
    3939    my $src_suppliers 
    4040        = $dbms.new_var( :decl_type('sys.Core.Relation.Relation') ); 
    41     isa_ok( $src_suppliers, 'Muldis::DB::Interface::Var' ); 
     41    does_ok( $src_suppliers, 'Muldis::DB::Interface::Var' ); 
    4242    my $src_foods 
    4343        = $dbms.new_var( :decl_type('sys.Core.Relation.Relation') ); 
    44     isa_ok( $src_foods, 'Muldis::DB::Interface::Var' ); 
     44    does_ok( $src_foods, 'Muldis::DB::Interface::Var' ); 
    4545    my $src_shipments 
    4646        = $dbms.new_var( :decl_type('sys.Core.Relation.Relation') ); 
    47     isa_ok( $src_shipments, 'Muldis::DB::Interface::Var' ); 
     47    does_ok( $src_shipments, 'Muldis::DB::Interface::Var' ); 
    4848 
    4949    # Load our example literal source data sets into said Perl-lexicals. 
     
    138138 
    139139    my $desi_colour = $dbms.new_var( :decl_type('sys.Core.Text.Text') ); 
    140     isa_ok( $desi_colour, 'Muldis::DB::Interface::Var' ); 
     140    does_ok( $desi_colour, 'Muldis::DB::Interface::Var' ); 
    141141    $desi_colour.store_ast( :ast([ 'NEText', 'orange' ]) ); 
    142142    pass( 'no death from loading desired colour into VM' ); 
     
    164164    ); 
    165165    pass( 'no death from executing search query' ); 
    166     isa_ok( $matched_suppl, 'Muldis::DB::Interface::Var' ); 
     166    does_ok( $matched_suppl, 'Muldis::DB::Interface::Var' ); 
    167167 
    168168    my $matched_suppl_ast = $matched_suppl.fetch_ast(); 
     
    183183 
    184184    say "# debug: orange food suppliers found:"; 
    185     say "# " ~ $matched_suppl_ast.as_perl(); 
     185    say "# " ~ $matched_suppl_ast.perl(); 
    186186 
    187187    return; 
     188} 
     189 
     190########################################################################### 
     191 
     192# Modified clone of isa_ok from ext/Test/lib/Test.pm, 
     193# since we actually want to test with does() rather than isa(). 
     194 
     195sub does_ok (Any|Junction|Pair $ref is rw, Str $expected_type, Str $desc?, 
     196        :$todo, :$depends) returns Bool is export { 
     197    my $out 
     198        := defined($desc) ?? $desc !! "The object does '$expected_type'"; 
     199    my $test := $ref.does($expected_type); 
     200    Test::proclaim( 
     201        $test, $out, $todo, ~($ref.WHAT), $expected_type, $depends ); 
    188202} 
    189203