summaryrefslogtreecommitdiff
path: root/test/test_translate_song.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2019-07-29 09:52:18 +0200
committerMax Kellermann <max@musicpd.org>2019-07-29 09:58:53 +0200
commit90ea3bf985b94e1e2bc3dc77d79fc2f948c303b3 (patch)
tree0119032b17261ef7f317df5d832978ced9faaa95 /test/test_translate_song.cxx
parent83b08712481cd06c8a583a2f48b327fdd16d3442 (diff)
playlist/Song: support backslash in relative URIs
Closes https://github.com/MusicPlayerDaemon/MPD/issues/607
Diffstat (limited to 'test/test_translate_song.cxx')
-rw-r--r--test/test_translate_song.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/test_translate_song.cxx b/test/test_translate_song.cxx
index 604e0c59b..cac712785 100644
--- a/test/test_translate_song.cxx
+++ b/test/test_translate_song.cxx
@@ -270,3 +270,23 @@ TEST_F(TranslateSongTest, Relative)
insecure_loader));
EXPECT_EQ(se, ToString(song4));
}
+
+TEST_F(TranslateSongTest, Backslash)
+{
+ const SongLoader loader(reinterpret_cast<const Database *>(1),
+ storage);
+
+ DetachedSong song1("foo\\bar.ogg", MakeTag2b());
+#ifdef _WIN32
+ /* on Windows, all backslashes are converted to slashes in
+ relative paths from playlists */
+ auto se = ToString(DetachedSong(uri2, MakeTag2c()));
+ EXPECT_TRUE(playlist_check_translate_song(song1, nullptr,
+ loader));
+ EXPECT_EQ(se, ToString(song1));
+#else
+ /* backslash only supported on Windows */
+ EXPECT_FALSE(playlist_check_translate_song(song1, nullptr,
+ loader));
+#endif
+}