File: refcount.t

package info (click to toggle)
cipux-storage 3.4.0.2-6
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 368 kB
  • ctags: 37
  • sloc: perl: 1,578; makefile: 41
file content (28 lines) | stat: -rw-r--r-- 733 bytes parent folder | download | duplicates (3)
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
use Test::More tests => 4;
use Test::Refcount;

use CipUX::Storage;

# 1
diag('new CipUX::Storage _build/cache');
my $object1 = CipUX::Storage->new( { cache_dir => '_build/cache' } );
is_oneref( $object1, '$object has a refcount of 1' );

# 2
diag('refcount CipUX::Storage');
my $otherref1 = $object1;
is_refcount( $object1, 2, '$object now has 2 references' );

use CipUX::Storage::Client;

# 3
diag('new CipUX::Storage::Client');
my $object2 = CipUX::Storage::Client->new(
    { name => 'cipux_storage_client', cache_dir => '_build/cache' } );
is_oneref( $object2, '$object has a refcount of 1' );

# 4
diag('refcount CipUX::Storage::Client');
my $otherref2 = $object2;
is_refcount( $object2, 2, '$object now has 2 references' );