### ----------------------------------------------------
### -- App::RaCoCo
### -- Licenses: Artistic-2.0
### -- Authors: Mikhail Khorkov
### -- File: t/10-coverable-collector.rakutest
### ----------------------------------------------------
use Test;
use lib 'lib';
use lib 't/lib';
use App::Racoco::CoverableLinesCollector;
use App::Racoco::Paths;
use Fixture;
use TestResources;

plan 1;

my ($paths, $collector, $subtest);
sub setup($lib, @suplier-data, :$subtest, :$plan!) {
	plan $plan;
	TestResources::prepare($subtest);
	$paths = Paths.from(lib => TestResources::exam-directory.add($lib));
	my $supplier = Fixture::testLinesSupplier(|@suplier-data);
	$collector = CoverableLinesCollector.new(:$paths, :$supplier);
}

$subtest = '01-iter-and-collect-fake';
subtest $subtest, {
	setup('lib', :$subtest, :1plan, (
	  'Sub'.IO.add('Module.rakumod').Str, (1, 2, 3),
    'Sub'.IO.add('Submodule.rakumod').Str, (25, 28),
    'Module.rakumod', (14,)
  ));

  is-deeply $collector.collect(),
    %{
      'Sub'.IO.add('Module.rakumod').Str => (1, 2, 3).Set,
      'Sub'.IO.add('Submodule.rakumod').Str => (25, 28).Set,
      'Module.rakumod' => (14).Set,
    },
    'lines collector ok';
}


