aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-01 01:11:50 +0100
committerMax Kellermann <max@duempel.org>2014-02-04 00:57:43 +0100
commit29072797ca5a397b2878e458db22cb5dcc7dfe4d (patch)
tree442384db532c0d5d5affa5efa2c415efffe76c0e /test
parentdb69ceade64c1e1a9c3d7a7c634f8b8b05ce73b9 (diff)
downloadmpd-29072797ca5a397b2878e458db22cb5dcc7dfe4d.tar.gz
mpd-29072797ca5a397b2878e458db22cb5dcc7dfe4d.tar.xz
mpd-29072797ca5a397b2878e458db22cb5dcc7dfe4d.zip
db/DatabasePlaylist: pass Database reference around
Reduce global variable usage, move to frontend code.
Diffstat (limited to 'test')
-rw-r--r--test/test_translate_song.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/test_translate_song.cxx b/test/test_translate_song.cxx
index c264c0d1a..3c94ed4bc 100644
--- a/test/test_translate_song.cxx
+++ b/test/test_translate_song.cxx
@@ -117,7 +117,8 @@ static const char *uri1 = "/foo/bar.ogg";
static const char *uri2 = "foo/bar.ogg";
DetachedSong *
-DatabaseDetachSong(const char *uri, gcc_unused Error &error)
+DatabaseDetachSong(gcc_unused const Database &db, const char *uri,
+ gcc_unused Error &error)
{
if (strcmp(uri, uri2) == 0)
return new DetachedSong(uri, MakeTag2a());
@@ -236,7 +237,7 @@ class TranslateSongTest : public CppUnit::TestFixture {
}
void TestInDatabase() {
- const SongLoader loader(nullptr);
+ const SongLoader loader(reinterpret_cast<const Database *>(1));
DetachedSong song1("doesntexist");
CPPUNIT_ASSERT(!playlist_check_translate_song(song1, nullptr,
@@ -258,8 +259,9 @@ class TranslateSongTest : public CppUnit::TestFixture {
}
void TestRelative() {
- const SongLoader secure_loader(nullptr);
- const SongLoader insecure_loader(reinterpret_cast<const Client *>(1));
+ const Database &db = *reinterpret_cast<const Database *>(1);
+ const SongLoader secure_loader(&db);
+ const SongLoader insecure_loader(reinterpret_cast<const Client *>(1), &db);
/* map to music_directory */
DetachedSong song1("bar.ogg", MakeTag2b());