[Slim-Checkins] r8872 - in /trunk/tests: Slim/Test/Base.pm lib/ t/formats/mp3/bug2349.t t/utils/misc/win32-path-case.t t/utils/scan/01use.t

dsully at svn.slimdevices.com dsully at svn.slimdevices.com
Tue Aug 8 16:54:46 PDT 2006


Author: dsully
Date: Tue Aug  8 16:54:45 2006
New Revision: 8872

URL: http://svn.slimdevices.com?rev=8872&view=rev
Log:
Bug: N/A
Description: Some test updates

Added:
    trunk/tests/lib/
Modified:
    trunk/tests/Slim/Test/Base.pm
    trunk/tests/t/formats/mp3/bug2349.t
    trunk/tests/t/utils/misc/win32-path-case.t
    trunk/tests/t/utils/scan/01use.t

Modified: trunk/tests/Slim/Test/Base.pm
URL: http://svn.slimdevices.com/trunk/tests/Slim/Test/Base.pm?rev=8872&r1=8871&r2=8872&view=diff
==============================================================================
--- trunk/tests/Slim/Test/Base.pm (original)
+++ trunk/tests/Slim/Test/Base.pm Tue Aug  8 16:54:45 2006
@@ -3,88 +3,26 @@
 # $Id$
 
 use strict;
+use base qw(Test::Class);
 
 use Cwd;
 use Config;
 use Getopt::Long;
 use FindBin qw($Bin);
 use File::Spec::Functions qw(:ALL);
-#use Test::Base -Base;
+use Test::More;
+
+use lib qw(../server);
 
 BEGIN {
-	# See the comments in slimserver.pl
-	use Symbol;
+	use Slim::bootstrap;
+	use Slim::Utils::OSDetect;
 
-	sub tryModuleLoad {
-		my @modules = @_;
-
-		my @failed  = ();
-
-		for my $module (@modules) {
-
-			eval "use $module";
-
-			if ($@) {
-				Symbol::delete_package($module);
-
-				push @failed, $module;
-
-				$module =~ s|::|/|g;
-				$module .= '.pm';
-
-				delete $INC{$module};
-			}
-		}
-
-		return @failed;
-	}
-
-	# Here's what we want to try and load. This will need to be updated
-	# when a new XS based module is added to our CPAN tree.
-	my @modules = qw(Time::HiRes DBD::SQLite DBI XML::Parser HTML::Parser Compress::Zlib);
-
-	if ($] <= 5.007) {
-		push @modules, qw(Storable Digest::MD5);
-	}
-
-	$Bin = catdir(cwd(), '../server');
-
-	my @SlimINC = (
-		$Bin, 
-		catdir($Bin,'CPAN'), 
-		catdir($Bin,'lib'), 
-		catdir($Bin,'CPAN','arch',(join ".", map {ord} split //, $^V), $Config::Config{'archname'}), 
-		catdir($Bin,'CPAN','arch',(join ".", map {ord} split //, $^V), $Config::Config{'archname'}, 'auto'), 
-		catdir($Bin,'CPAN','arch',(join ".", map {ord} (split //, $^V)[0,1]), $Config::Config{'archname'}), 
-		catdir($Bin,'CPAN','arch',(join ".", map {ord} (split //, $^V)[0,1]), $Config::Config{'archname'}, 'auto'), 
-		catdir($Bin,'CPAN','arch',$Config::Config{archname})
+	Slim::bootstrap->loadModules(
+		[qw(Time::HiRes DBD::mysql DBI HTML::Parser XML::Parser::Expat YAML::Syck)],
+		[],
+		'../server',
 	);
-
-	# This works like 'use lib'
-	# prepend our directories to @INC so we look there first.
-	unshift @INC, @SlimINC;
-
-	# Try and load the modules - some will fail if we don't include the
-	# binaries for that version/architecture combo
-	my @failed = tryModuleLoad(@modules);
-
-	# Remove our CPAN path so we can try loading the failed modules from
-	# the default system @INC
-	splice(@INC, 0, scalar @SlimINC);
-
-	my @reallyFailed = tryModuleLoad(@failed);
-
-	if (scalar @reallyFailed) {
-
-		printf("The following modules failed to load: %s\n\n", join(' ', @reallyFailed));
-
-		#print "Compress::Zlib and XML::Parser are optional modules and are not required to run SlimServer.\n\n";
-
-		print "To download and compile them, please run: $Bin/Bin/build-perl-modules.pl\n\n";
-	}
-
-	# And we're done with the trying - put our CPAN path back on @INC.
-	unshift @INC, @SlimINC;
 };
 
 # Do some basics
@@ -92,11 +30,11 @@
 use Slim::Utils::Prefs;
 use Slim::Utils::Timers;
 
-my $dbName = 'slimserversql.db';
+my $dbName = 'slimserver';
 
 {
 	# Remove any existing prefs file.
-	unlink(Slim::Utils::Prefs::prefsFile());
+	# unlink(Slim::Utils::Prefs::prefsFile());
 
 	Slim::Utils::Prefs::init();
 
@@ -114,14 +52,9 @@
 	Slim::Utils::Prefs::set('musicmagic', 0);
 	Slim::Utils::Prefs::set('moodlogic', 0);
 
-	Slim::Utils::Prefs::set('dbsource', 'dbi:SQLite:dbname=%s');
-
-	#
-	Slim::Utils::Prefs::set('dbname', catdir(Slim::Utils::Prefs::get('cachedir'), $dbName));
+	Slim::Utils::Prefs::set('dbusername', $dbName);
+	Slim::Utils::Prefs::set('dbpassword', 'insecure');
+	Slim::Utils::Prefs::set('dbsource', sprintf('dbi:mysql:database=%s', $dbName));
 }
 
-sub dbName {
-	return $dbName;
-}
-   
 1;

Modified: trunk/tests/t/formats/mp3/bug2349.t
URL: http://svn.slimdevices.com/trunk/tests/t/formats/mp3/bug2349.t?rev=8872&r1=8871&r2=8872&view=diff
==============================================================================
--- trunk/tests/t/formats/mp3/bug2349.t (original)
+++ trunk/tests/t/formats/mp3/bug2349.t Tue Aug  8 16:54:45 2006
@@ -21,7 +21,7 @@
 
 	ok($tags, 'Slim::Formats::MP3->getTag bug2349.mp3');
 
-	is($tags->{'COMMENT'}, 'MP3 Help - www.ChrisMyden.com', "Couldn't find COMM tag!");
+	ok((grep { /^MP3 Help - www\.ChrisMyden\.com/ } @{$tags->{'COMMENT'}}), "Couldn't find COMM tag!");
 	is($tags->{'MEDIA JUKEBOX: TOOL NAME'}, 'Media Center', "Couldn't find COMM tag!");
 	is($tags->{'MEDIA JUKEBOX: KEYWORDS'}, 'Beatles', "Couldn't find COMM tag!");
 	ok($tags->{'MUSICMAGIC DATA'}, "Couldn't find TXXX tag!");

Modified: trunk/tests/t/utils/misc/win32-path-case.t
URL: http://svn.slimdevices.com/trunk/tests/t/utils/misc/win32-path-case.t?rev=8872&r1=8871&r2=8872&view=diff
==============================================================================
--- trunk/tests/t/utils/misc/win32-path-case.t (original)
+++ trunk/tests/t/utils/misc/win32-path-case.t Tue Aug  8 16:54:45 2006
@@ -15,7 +15,7 @@
 
 	if (Slim::Utils::OSDetect::OS() ne 'win') {
 
-		skip("This test requires Windows/ActiveState Perl", 4);
+		skip("This test requires Windows/ActiveState Perl", 5);
 	}
 
 	# This is a check for regression on bug 1896 - We need to make sure

Modified: trunk/tests/t/utils/scan/01use.t
URL: http://svn.slimdevices.com/trunk/tests/t/utils/scan/01use.t?rev=8872&r1=8871&r2=8872&view=diff
==============================================================================
--- trunk/tests/t/utils/scan/01use.t (original)
+++ trunk/tests/t/utils/scan/01use.t Tue Aug  8 16:54:45 2006
@@ -8,7 +8,7 @@
 use Test::More tests => 1;
 
 BEGIN {
-	Test::More::use_ok('Slim::Utils::Scan');
+	Test::More::use_ok('Slim::Utils::Scanner');
 }
 
 __END__



More information about the checkins mailing list