aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-12-29 17:30:24 +0100
committerMax Kellermann <max@duempel.org>2013-12-29 17:40:51 +0100
commitafc70c120e6b08ac550b107d3bc588262551dae5 (patch)
tree5763c46f48a848d20cf5f93710e323f25d83e54e /test
parentd7f80eab68b5cb0d2aa90e67fa2bb04b1bbef975 (diff)
downloadmpd-afc70c120e6b08ac550b107d3bc588262551dae5.tar.gz
mpd-afc70c120e6b08ac550b107d3bc588262551dae5.tar.xz
mpd-afc70c120e6b08ac550b107d3bc588262551dae5.zip
util/UriUtil: uri_get_suffix() fails if name begins with dot
A file called ".jpg" is not a JPEG file with an empty name; it is merely a hidden file.
Diffstat (limited to 'test')
-rw-r--r--test/test_util.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/test_util.cxx b/test/test_util.cxx
index 2ff303540..a472391a3 100644
--- a/test/test_util.cxx
+++ b/test/test_util.cxx
@@ -29,6 +29,10 @@ public:
"jpg"));
CPPUNIT_ASSERT_EQUAL(0, strcmp(uri_get_suffix("/foo.png/bar.jpg"),
"jpg"));
+ CPPUNIT_ASSERT_EQUAL((const char *)nullptr,
+ uri_get_suffix(".jpg"));
+ CPPUNIT_ASSERT_EQUAL((const char *)nullptr,
+ uri_get_suffix("/foo/.jpg"));
}
void TestRemoveAuth() {