summaryrefslogtreecommitdiff
path: root/ext/GDBM_File/t/count.t
blob: 110624724629f088eb6ec83bfb217a26332a159b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!./perl -w
use strict;

use Test::More;
use Config;
use File::Temp 'tempdir';
use File::Spec;

BEGIN {
    plan(skip_all => "GDBM_File was not built")
	unless $Config{extensions} =~ /\bGDBM_File\b/;

    # https://rt.perl.org/Public/Bug/Display.html?id=117967
    plan(skip_all => "GDBM_File is flaky in $^O")
        if $^O =~ /darwin/;

    plan(tests => 3);
    use_ok('GDBM_File');
 }

my $wd = tempdir(CLEANUP => 1);

my %h;
my $db = tie(%h, 'GDBM_File', File::Spec->catfile($wd, 'Op_dbmx'),
             GDBM_WRCREAT, 0640);

isa_ok($db, 'GDBM_File');
SKIP: {
     skip 'GDBM_File::count not available', 1
        unless $db->can('count'); 

     $h{one} = '1';
     $h{two} = '2';
     $h{three} = '3';
     is($db->count, 3, 'count');
}