source: mp3-find/trunk/t/02-filesystem.t @ 37

Last change on this file since 37 was 12, checked in by peter, 19 years ago
  • added "exclude_path" option to Filesystem backend
  • added an excluded directory to the test suite ("t/dont_look_here")
  • fixed dying DB test (still a workaround for a DBD::SQLite problem)
File size: 900 bytes
RevLine 
[8]1#!/usr/bin/perl -w
2use strict;
3
[12]4use Test::More tests => 6;
[8]5BEGIN { use_ok('MP3::Find::Filesystem') };
6
7my $SEARCH_DIR = 't/mp3s';
[12]8my $EXCLUDE_DIR = 't/mp3s/dont_look_here';
9my $MP3_COUNT = 1;
10my $EXCLUDED_MP3_COUNT = 1;
[8]11
12# exercise the object
13
14my $finder = MP3::Find::Filesystem->new;
15isa_ok($finder, 'MP3::Find::Filesystem');
16
17# a most basic search:
18my @res = $finder->find_mp3s(dir => $SEARCH_DIR);
19is(scalar(@res), $MP3_COUNT, 'dir as scalar');
20
21@res = $finder->find_mp3s(dir => [$SEARCH_DIR]);
22is(scalar(@res), $MP3_COUNT, 'dir as ARRAY ref');
23
[12]24# exclude
25@res = $finder->find_mp3s(dir => $SEARCH_DIR, exclude_path => $EXCLUDE_DIR);
26is(scalar(@res), $MP3_COUNT - $EXCLUDED_MP3_COUNT, 'excluded directory');
27
28@res = $finder->find_mp3s(dir => $SEARCH_DIR, exclude_path => [$EXCLUDE_DIR]);
29is(scalar(@res), $MP3_COUNT - $EXCLUDED_MP3_COUNT, 'excluded directory as array');
30
[8]31#TODO: get some test mp3s
Note: See TracBrowser for help on using the repository browser.