[Libreoffice-commits] online.git: test/UnitHTTP.cpp

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Tue Nov 26 09:51:21 UTC 2019


 test/UnitHTTP.cpp |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 24c914dda1584a2d10c575f3c378d54efd98f4a8
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Nov 26 10:47:14 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Nov 26 10:51:01 2019 +0100

    test: fix unit-http
    
    There were two problems here:
    
    - there are much more headers than the one stated in "start", and as the
    name implies, that's only the start of the headers, so assert it's a
    matching prefix instead of full match
    
    - the second case got the condition wrong, assert states what is the
    assumption, does not check for an error state
    
    With these, this test passes again.
    
    Change-Id: I39f644849fc4808d73d1f95e2cda57d9465aacbf

diff --git a/test/UnitHTTP.cpp b/test/UnitHTTP.cpp
index b245b765a..465d8d04b 100644
--- a/test/UnitHTTP.cpp
+++ b/test/UnitHTTP.cpp
@@ -173,7 +173,7 @@ public:
         static const std::string start =
             "HTTP/1.0 200 OK\r\n"
             "Content-Disposition: attachment; filename=\"test.txt\"\r\n";
-        CPPUNIT_ASSERT_EQUAL(start, std::string(buffer));
+        CPPUNIT_ASSERT(Util::startsWith(std::string(buffer), start));
 
         if (strncmp(buffer, start.c_str(), start.size()))
         {
@@ -185,7 +185,7 @@ public:
         // TODO: check content-length etc.
 
         const char *ptr = strstr(buffer, "\r\n\r\n");
-        CPPUNIT_ASSERT_MESSAGE("Missing separator, got " + std::string(buffer), !ptr);
+        CPPUNIT_ASSERT_MESSAGE("Missing separator, got " + std::string(buffer), ptr);
         if (!ptr)
         {
             std::cerr << "missing separator " << got << " '" << buffer << "\n";


More information about the Libreoffice-commits mailing list