File: new_instance.t

package info (click to toggle)
libapache-singleton-perl 0.17-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 236 kB
  • sloc: perl: 274; makefile: 13
file content (24 lines) | stat: -rw-r--r-- 408 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env perl
#

use strict;
use lib qw(t/mock lib);
use Test::More;
use Mock::Apache;

package Printer;
use base qw(Apache::Singleton);

package main;

my $printer_a = Printer->instance(foo => 'bar');
my $printer_b = Printer->instance;

isa_ok $printer_a, 'Printer';
isa_ok $printer_b, 'Printer';

# both should have foo => bar
is $printer_a->{foo}, 'bar';
is $printer_b->{foo}, 'bar';

done_testing;