mercredi 1 mai 2019

Perl6 generic code to test if modules load

This is a generic code code in /t to test if .pm6 modules in /lib load.

use lib $*PROGRAM.sibling('../lib');
use Test;

my @dir = dir($*PROGRAM.sibling('../lib'), test => { $_ ~~ /.*pm6/  } );
plan @dir.elems;

sub module( IO $dir ) {
  $dir.basename.Str ~~ /(\w+)\.pm6/;
  return $0.Str;
}

for  @dir.map(&module) -> $module {
  use-ok $module, "This module loads: $module";
}

Before going any further (recursively looking at lib sub-folders ), I wonder in this is the right approach.

Thanks!

Aucun commentaire:

Enregistrer un commentaire