1*256a93a4Safresh1#!./perl -w 2*256a93a4Safresh1use strict; 3*256a93a4Safresh1 4*256a93a4Safresh1use Test::More; 5*256a93a4Safresh1use Config; 6*256a93a4Safresh1use File::Temp 'tempdir'; 7*256a93a4Safresh1use File::Spec; 8*256a93a4Safresh1 9*256a93a4Safresh1BEGIN { 10*256a93a4Safresh1 plan(skip_all => "GDBM_File was not built") 11*256a93a4Safresh1 unless $Config{extensions} =~ /\bGDBM_File\b/; 12*256a93a4Safresh1 13*256a93a4Safresh1 # https://rt.perl.org/Public/Bug/Display.html?id=117967 14*256a93a4Safresh1 plan(skip_all => "GDBM_File is flaky in $^O") 15*256a93a4Safresh1 if $^O =~ /darwin/; 16*256a93a4Safresh1 17*256a93a4Safresh1 plan(tests => 3); 18*256a93a4Safresh1 use_ok('GDBM_File'); 19*256a93a4Safresh1 } 20*256a93a4Safresh1 21*256a93a4Safresh1my $wd = tempdir(CLEANUP => 1); 22*256a93a4Safresh1 23*256a93a4Safresh1my %h; 24*256a93a4Safresh1my $db = tie(%h, 'GDBM_File', File::Spec->catfile($wd, 'Op_dbmx'), 25*256a93a4Safresh1 GDBM_WRCREAT, 0640); 26*256a93a4Safresh1 27*256a93a4Safresh1isa_ok($db, 'GDBM_File'); 28*256a93a4Safresh1SKIP: { 29*256a93a4Safresh1 skip 'GDBM_File::count not available', 1 30*256a93a4Safresh1 unless $db->can('count'); 31*256a93a4Safresh1 32*256a93a4Safresh1 $h{one} = '1'; 33*256a93a4Safresh1 $h{two} = '2'; 34*256a93a4Safresh1 $h{three} = '3'; 35*256a93a4Safresh1 is($db->count, 3, 'count'); 36*256a93a4Safresh1} 37*256a93a4Safresh1 38