Distribution-Guess-BuildSystem

 view release on metacpan or  search on metacpan

t/file_has_string.t  view on Meta::CPAN

# These tests pass
{
my $pass_tests = {
	't/test-distros/makemaker-true/Makefile.PL'             => 'MakeMaker',
	't/test-distros/module-build-compat/Build.PL'           => 'create_makefile_pl',
	't/test-distros/module-install-autoinstall/Makefile.PL' => 'auto_install'
	};

foreach my $file ( sort keys %$pass_tests )
	{
	my $name = File::Spec->catfile( split m|/|, $file );
	ok( -e $name, "Passing file [$name] exists" );

	ok( $class->_file_has_string( $name, $pass_tests->{$file} ) );
	}
}

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# These tests fail because the right string is not in the file
{
my $fail_tests = {
	't/test-distros/makemaker-true/Makefile.PL'             => 'Build.PL',
	't/test-distros/module-build-compat/Build.PL'           => 'Buster',
	't/test-distros/module-install/Makefile.PL'             => 'auto_install'
	};

foreach my $file ( sort keys %$fail_tests )
	{
	my $name = File::Spec->catfile( split m|/|, $file );
	ok( -e $name, "Passing file [$name] exists" );

	ok( ! $class->_file_has_string( $name, $fail_tests->{$file} ) );
	}
}

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# These tests fail because the file is missing
{
stderr_like

t/just_give_me_a_hash.t  view on Meta::CPAN

	't/test-distros/module-install-autoinstall'
	);

my $guesser = $class->new;
isa_ok( $guesser, $class );

foreach my $dir ( @dirs )
	{
	$^W = 0;

	my $name = catfile( split m|/|, $dir );
	#diag( "directory is $name\n" );
	ok( -d $name, "directory [$name] exists" );

	ok( chdir $name, "changed into test directory" );


	my $hash = $guesser->just_give_me_a_hash;
	isa_ok( $hash, ref {} );

	ok( chdir $start_dir, "back into original directory" );



( run in 0.953 second using v1.01-cache-2.11-cpan-71847e10f99 )