diff options
author | Max Kellermann <max@duempel.org> | 2014-11-02 14:06:05 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-11-02 14:06:05 +0100 |
commit | 303d67aed2da79d4ddaa3a52093ed42ae9da064d (patch) | |
tree | 060580f4c17b5d30d1e78e584df03c795ce4e1d7 /test | |
parent | 575fbad254a1ce67530bf2aedc9852c89c072c3f (diff) | |
parent | 6a7f6cdacd81877276563c42fdeacad3a8deface (diff) | |
download | mpd-303d67aed2da79d4ddaa3a52093ed42ae9da064d.tar.gz mpd-303d67aed2da79d4ddaa3a52093ed42ae9da064d.tar.xz mpd-303d67aed2da79d4ddaa3a52093ed42ae9da064d.zip |
Merge tag 'v0.19.2'
Diffstat (limited to '')
-rw-r--r-- | test/test_util.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test_util.cxx b/test/test_util.cxx index aaadec68f..3e79aeca0 100644 --- a/test/test_util.cxx +++ b/test/test_util.cxx @@ -34,6 +34,25 @@ public: uri_get_suffix(".jpg")); CPPUNIT_ASSERT_EQUAL((const char *)nullptr, uri_get_suffix("/foo/.jpg")); + + /* the first overload does not eliminate the query + string */ + CPPUNIT_ASSERT_EQUAL(0, strcmp(uri_get_suffix("/foo/bar.jpg?query_string"), + "jpg?query_string")); + + /* ... but the second one does */ + UriSuffixBuffer buffer; + CPPUNIT_ASSERT_EQUAL(0, strcmp(uri_get_suffix("/foo/bar.jpg?query_string", + buffer), + "jpg")); + + /* repeat some of the above tests with the second overload */ + CPPUNIT_ASSERT_EQUAL((const char *)nullptr, + uri_get_suffix("/foo/bar", buffer)); + CPPUNIT_ASSERT_EQUAL((const char *)nullptr, + uri_get_suffix("/foo.jpg/bar", buffer)); + CPPUNIT_ASSERT_EQUAL(0, strcmp(uri_get_suffix("/foo/bar.jpg", buffer), + "jpg")); } void TestRemoveAuth() { |