App-ClusterSSH
view release on metacpan or search on metacpan
use strict;
use warnings;
# Force use of English in tests for the moment, for those users that
# have a different locale set, since errors are hardcoded below
use POSIX qw(setlocale locale_h);
setlocale( LC_ALL, "C" );
use FindBin qw($Bin);
use lib "$Bin/../lib";
use Test::More;
use Test::Trap;
BEGIN { use_ok("App::ClusterSSH::Host") }
my $host;
eval { $host = App::ClusterSSH::Host->new(); };
isa_ok( $@, 'App::ClusterSSH::Exception', 'Caught exception object OK' );
like(
$@,
qr/hostname is undefined/,
'eval error - hostname is undefined (method)'
);
#=============
# NOTE:
#=============
# 'Eevo5ang' is a randomly generated hostname used in these tests
# as one user actually had a host called 'hostname' on their network
# 'Ooquiida.com' is also a randomly generated domain name
diag('Checking IPv4 type addresses') if ( $ENV{TEST_VERBOSE} );
$host = App::ClusterSSH::Host->new( hostname => 'Eevo5ang' );
is( $host, 'Eevo5ang', 'stringify works' );
is( $host->get_hostname, 'Eevo5ang', 'hostname set' );
is( $host->get_port, q{}, 'checking set works' );
is( $host->get_username, q{}, 'username is unset' );
is( $host->get_realname, 'Eevo5ang', 'realname set' );
is( $host->get_geometry, q{}, 'geometry set' );
is( $host->get_master, q{}, 'master set' );
is( $host->get_type, q{}, 'type set' );
$host->set_port(2323);
is( $host, 'Eevo5ang', 'stringify works' );
is( $host->get_hostname, 'Eevo5ang', 'checking set works' );
is( $host->get_port, 2323, 'checking set works' );
is( $host->get_username, q{}, 'username is unset' );
is( $host->get_realname, 'Eevo5ang', 'realname set' );
is( $host->get_geometry, q{}, 'geometry set' );
is( $host->get_master, q{}, 'master set' );
is( $host->get_type, q{}, 'type set' );
$host->set_username('username');
is( $host->get_hostname, 'Eevo5ang', 'checking set works' );
is( $host->get_port, 2323, 'checking set works' );
is( $host->get_username, 'username', 'username is unset' );
is( $host->get_realname, 'Eevo5ang', 'realname set' );
is( $host->get_geometry, q{}, 'geometry set' );
is( $host->get_master, q{}, 'master set' );
is( $host->get_type, q{}, 'type set' );
$host->set_geometry('100x50+100+100');
( run in 1.226 second using v1.01-cache-2.11-cpan-ceb78f64989 )