3 # This file is part of POE::Component::Client::MPD.
4 # Copyright (c) 2007-2008 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.
18 # [ 'event', [ $arg1, $arg2, ... ], $sleep, \&check_results ]
21 [ 'coll.all_albums', [], 0, \&check_all_albums ],
24 [ 'coll.all_artists', [], 0, \&check_all_artists ],
27 [ 'coll.all_titles', [], 0, \&check_all_titles ],
30 [ 'coll.all_files', [], 0, \&check_all_files ],
35 # are we able to test module?
36 eval 'use POE::Component::Client::MPD::Test nbtests=>$nbtests, tests=>\@tests';
37 diag($@), plan skip_all => $@ if $@ =~ s/\n+BEGIN failed--compilation aborted.*//s;
44 is($msg->status, 1, "command '" . $msg->request . "' returned an ok status");
47 sub check_all_albums {
48 my ($msg, $items) = @_;
50 # mpd 0.14 returns empty strings too
51 is(scalar @$items, 2, 'all_albums() return the albums');
52 is($items->[1], 'our album', 'all_albums() return strings');
55 sub check_all_artists {
56 my ($msg, $items) = @_;
58 # mpd 0.14 returns empty strings too
59 is(scalar @$items, 2, 'all_artists() return the artists');
60 is($items->[0], 'dir1-artist', 'all_artists() return strings');
63 sub check_all_titles {
64 my ($msg, $items) = @_;
66 # mpd 0.14 returns empty strings too
67 is(scalar @$items, 4, 'all_titles() return the titles');
68 like( $items->[0], qr/-title$/, 'all_titles() return strings');
73 my ($msg, $items) = @_;
75 is(scalar @$items, 4, 'all_files() return the pathes');
76 like($items->[0], qr/\.ogg$/, 'all_files() return strings');