[project @ 6332]
[audio-mpd-common.git] / t / 20-conn-failed.t
blob0b1b9c24245c9cc0c71c29eaaf7c555907bf9dac
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 same terms as Perl itself.
11 use strict;
12 use warnings;
14 use POE qw[ Component::Client::MPD::Connection ];
15 use Test::More;
16 plan tests => 1;
18 my $id = POE::Session->create(
19     inline_states => {
20         _start     => \&_onpriv_start,
21         _mpd_error => \&_onpriv_mpd_error,
22     }
24 POE::Component::Client::MPD::Connection->spawn( {
25     host => 'localhost',
26     port => 16600,
27     id   => $id,
28 } );
29 POE::Kernel->run;
30 exit;
33 sub _onpriv_start {
34     $_[KERNEL]->alias_set('tester'); # increment refcount
37 sub _onpriv_mpd_error  {
38     like( $_[ARG0]->error, qr/^connect: \(\d+\) /, 'connect error trapped' );