App-GHGen

 view release on metacpan or  search on metacpan

t/integration.t  view on Meta::CPAN

# ---------------------------------------------------------------------------
# Subtest 15: get_cache_suggestion per ecosystem (Analyzer cross-module check)
# For each ecosystem the Analyzer understands, build a minimal workflow that
# triggers that detection and verify the cache path in the suggestion.
subtest 'Analyzer::get_cache_suggestion: correct cache path per ecosystem' => sub {
	# These constants come directly from the FORMAL SPECIFICATION in the POD.
	my @cases = (
		{
			ecosystem => 'npm',
			steps     => [{ run => 'npm install' }],
			path_frag => '~/.npm',
		},
		{
			ecosystem => 'pip',
			steps     => [{ run => 'pip install -r requirements.txt' }],
			path_frag => '~/.cache/pip',
		},
		{
			ecosystem => 'cargo',
			steps     => [{ run => 'cargo build' }],
			path_frag => '~/.cargo',
		},
		{
			ecosystem => 'bundler',
			steps     => [{ run => 'bundle install' }],
			path_frag => 'vendor/bundle',
		},
	);

	for my $case (@cases) {
		my $wf         = { jobs => { build => { steps => $case->{steps} } } };
		my $suggestion = get_cache_suggestion($wf);
		like($suggestion, qr/\Q$case->{path_frag}\E/,
			"$case->{ecosystem}: suggestion contains path '$case->{path_frag}'");
		diag("$case->{ecosystem}: $suggestion") if $ENV{TEST_VERBOSE};
	}

	# Unknown ecosystem (make install) must return the generic guidance message.
	my $unk_wf   = { jobs => { build => { steps => [{ run => 'make install' }] } } };
	my $unk_hint = get_cache_suggestion($unk_wf);
	like($unk_hint, qr/dependency manager/i,
		'Unknown ecosystem returns generic guidance per POD');
};



( run in 1.663 second using v1.01-cache-2.11-cpan-364913b4093 )