diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2018-11-30 17:08:30 +0300 |
---|---|---|
committer | Olivier Goffart <olivier@woboq.com> | 2018-12-19 12:53:34 +0300 |
commit | fab0e1163965dd36efdd002aea12abc594fa629f (patch) | |
tree | 3f15da4dd67d25bc91267be891dabdf5c7e11221 /test/testutility.cpp | |
parent | e0061df3fcf90f10e85c8647cb75fd5732a989df (diff) |
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
Diffstat (limited to 'test/testutility.cpp')
-rw-r--r-- | test/testutility.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
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) |