[project @ 6098]
[poe-component-client-mpd.git] / t / 20-conn-failed.t
blobe9ec9d7f413d057fe4cd2397113274e6243885fc
1 #!perl
3 # This file is part of POE::Component::Client::MPD.
4 # Copyright (c) 2007 Jerome Quelin, all rights reserved.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or (at
9 # your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 use strict;
23 use warnings;
25 use POE qw[ Component::Client::MPD::Connection ];
26 use Test::More;
27 plan tests => 1;
29 my $id = POE::Session->create(
30     inline_states => {
31         _start     => \&_onpriv_start,
32         _mpd_error => \&_onpriv_mpd_error,
33     }
35 POE::Component::Client::MPD::Connection->spawn( {
36     host => 'localhost',
37     port => 16600,
38     id   => $id,
39 } );
40 POE::Kernel->run;
41 exit;
44 sub _onpriv_start {
45     $_[KERNEL]->alias_set('tester'); # increment refcount
48 sub _onpriv_mpd_error  {
49     like( $_[ARG0]->error, qr/^connect: \(\d+\) /, 'connect error trapped' );