Git-Libgit2
view release on metacpan or search on metacpan
t/torture-init.t view on Meta::CPAN
use Test2::V0;
use Git::Libgit2 qw( init_lib shutdown_lib version );
init_lib();
my ( $maj, $min, $rev ) = version();
ok( defined $maj && $maj >= 1, "libgit2 version $maj.$min.$rev (major >= 1)" );
# Hammer init/shutdown â should not leak or crash.
my $iterations = 5000;
for my $i ( 1 .. $iterations ) {
my $rc = init_lib();
# Refcount starts at 1 on first init and increments each subsequent pass.
ok( $rc >= 1, "init_lib pass $i returned refcount $rc (>= 1)" );
shutdown_lib();
}
# Final state should be back to zero (or as low as we can given other tests ran first).
my $final_rc = init_lib();
ok( $final_rc >= 1, "init after loop returned refcount $final_rc (>= 1)" );
shutdown_lib();
( run in 0.704 second using v1.01-cache-2.11-cpan-71847e10f99 )