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

Last change on this file since 40 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
Line 
1#!/usr/bin/perl -w
2use strict;
3
4use Test::More tests => 6;
5BEGIN { use_ok('MP3::Find::Filesystem') };
6
7my $SEARCH_DIR = 't/mp3s';
8my $EXCLUDE_DIR = 't/mp3s/dont_look_here';
9my $MP3_COUNT = 1;
10my $EXCLUDED_MP3_COUNT = 1;
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
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
31#TODO: get some test mp3s
Note: See TracBrowser for help on using the repository browser.