File: 99config-extend.t

package info (click to toggle)
libnagios-object-perl 0.21.20-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,032 kB
  • sloc: perl: 3,198; makefile: 9
file content (34 lines) | stat: -r--r--r-- 727 bytes parent folder | download | duplicates (6)
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
#!/usr/local/bin/perl -w

use strict;
use Test::More qw(no_plan);
use Test::NoWarnings;
use lib qw( ../lib ./lib );
eval { chdir('t') };

use_ok('Nagios::Object');

package Nagios::Host;
sub foobar { shift->{foobar} || 'public' }

sub set_foobar {
    my $self = shift;
    if ( !exists( $self->{foobar} ) ) {
        $self->{foobar} = 'public';
    }
    $self->_set( 'foobar', @_ );
}

package main;

can_ok( 'Nagios::Host', 'foobar' );
can_ok( 'Nagios::Host', 'set_foobar' );

my $host = Nagios::Host->new();

can_ok( $host, 'foobar' );
can_ok( $host, 'set_foobar' );

ok( $host->set_foobar("guessme"), "newly created set_foobar method works" );
is( $host->foobar, 'guessme', "use getter method to verify previous test" );