← Back to index

lib/BDD/Behave/Files.rakumod

17 / 18 lines covered (94.4%)

12class Files is export {3  my Str $.specs-dir = 'specs';4  my Str $.current;5  my Mu $.test = /'spec.raku' [\: \d+]?$/;67  method list(@args) {8    if @args.elems {9      gather for @args -> $arg {10        if $arg ~~ $.test {11          take $arg;12        } elsif $arg.IO.d {13          .take for self.find($arg).sort;14        } else {15          note "Warning: `$arg` is not a spec file or directory; ignoring";16        }17      }18    } else {19      self.find(Files.specs-dir).sort;20    }21  }2223  method find($dir) {24    unless $dir.IO.d {25      say "`$dir` directory not found\n";26      exit 1;27    }2829    gather for dir $dir -> $path {30      if $path.basename ~~ $.test { take $path.Str }31      if $path.d                  { .take for self.find($path) };32    }33  }34}