From fab0e1163965dd36efdd002aea12abc594fa629f Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 30 Nov 2018 15:08:30 +0100 Subject: Test: Move the test for Utility::normalizeEtag to testutility.cpp I just moved the text and did the minimum to port it to QtTest Did not change hte layout of it. Relates #6358 --- test/testutility.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test/testutility.cpp') diff --git a/test/testutility.cpp b/test/testutility.cpp index 20fb0a458..2e6c07dbe 100644 --- a/test/testutility.cpp +++ b/test/testutility.cpp @@ -212,6 +212,26 @@ private slots: QFETCH(QString, output); QCOMPARE(sanitizeForFileName(input), output); } + + void testNormalizeEtag() + { + QByteArray str; + +#define CHECK_NORMALIZE_ETAG(TEST, EXPECT) \ + str = OCC::Utility::normalizeEtag(TEST); \ + QCOMPARE(str.constData(), EXPECT); \ + + CHECK_NORMALIZE_ETAG("foo", "foo"); + CHECK_NORMALIZE_ETAG("\"foo\"", "foo"); + CHECK_NORMALIZE_ETAG("\"nar123\"", "nar123"); + CHECK_NORMALIZE_ETAG("", ""); + CHECK_NORMALIZE_ETAG("\"\"", ""); + + /* Test with -gzip (all combinaison) */ + CHECK_NORMALIZE_ETAG("foo-gzip", "foo"); + CHECK_NORMALIZE_ETAG("\"foo\"-gzip", "foo"); + CHECK_NORMALIZE_ETAG("\"foo-gzip\"", "foo"); + } }; QTEST_GUILESS_MAIN(TestUtility) -- cgit v1.2.3