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.
14 use POE qw[ Component::Client::MPD::Message ];
20 # [ 'event', [ $arg1, $arg2, ... ], $answer_back, \&check_results ]
23 [ 'updatedb', [], $SLEEP1, undef ],
24 [ 'stats', [], $SEND, \&check_update ],
25 [ 'updatedb', ['dir1'], $DISCARD, undef ],
26 [ 'stats', [], $SEND, \&check_update ],
29 # needs to be *after* updatedb, so version messages can be treated.
30 [ 'version', [], $SEND, \&check_version ],
33 [ 'urlhandlers', [], $SEND, \&check_urlhandlers ],
37 # are we able to test module?
38 eval 'use POE::Component::Client::MPD::Test';
39 plan skip_all => $@ if $@ =~ s/\n+BEGIN failed--compilation aborted.*//s;
44 my $output = qx[mpd --version 2>/dev/null];
45 skip 'need mpd installed', 1 unless $output =~ /^mpd .* ([\d.]+)\n/;
46 is( $_[0]->data, $1, 'mpd version grabbed during connection' );
50 my $stats = $_[0]->data;
51 isnt( $stats->db_update, 0, 'database has been updated' );
54 sub check_urlhandlers {
55 my @handlers = @{ $_[0]->data };
56 is( scalar @handlers, 1, 'only one url handler supported' );
57 is( $handlers[0], 'http://', 'only http is supported by now' );