diff options
author | Max Kellermann <max@musicpd.org> | 2019-07-29 09:52:18 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2019-07-29 09:58:53 +0200 |
commit | 90ea3bf985b94e1e2bc3dc77d79fc2f948c303b3 (patch) | |
tree | 0119032b17261ef7f317df5d832978ced9faaa95 /test/test_translate_song.cxx | |
parent | 83b08712481cd06c8a583a2f48b327fdd16d3442 (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.cxx | 20 |
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 +} |