← Back to index

lib/BDD/Behave/Parallel/Manifest.rakumod

20 / 21 lines covered (95.2%)

1unit module BDD::Behave::Parallel::Manifest;23sub write-manifest(IO::Path $path, @locations --> Nil) is export {4  my $fh = $path.open(:w);5  for @locations -> $loc {6    $fh.say($loc);7  }8  $fh.close;9}1011sub read-manifest(IO::Path $path --> List) is export {12  return ().List unless $path.e;13  my @lines;14  for $path.lines -> $line {15    my $trimmed = $line.trim;16    next unless $trimmed.chars;17    @lines.push: $trimmed;18  }19  @lines.List;20}2122sub files-from-manifest(@locations --> List) is export {23  my %seen;24  my @files;25  for @locations -> $loc {26    my $idx = $loc.rindex(':');27    next unless $idx.defined;28    my $file = $loc.substr(0, $idx);29    unless %seen{$file}:exists {30      %seen{$file} = True;31      @files.push: $file;32    }33  }34  @files.List;35}