From c470d92366d7c3c239a689f0a10d6d0d9daafbff Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 18 May 2020 11:55:54 +0200 Subject: Allow prefix to be a complete filename for GetTempFile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Our testcases had their own implementation of GetTempFile with the feature of a temporary file with a choosen suffix. Merging this into GetTempFile lets us drop this duplicate and hence test more our code rather than testing our helpers for test implementation. And then hashsums_test had another implementation… and extracttar wasn't even trying to use a real tempfile… one GetTempFile to rule them all! That also ensures that these tempfiles are created in a temporary directory rather than the current directory which is a nice touch and tries a little harder to clean up those tempfiles. --- test/libapt/strutil_test.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/libapt/strutil_test.cc') diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc index 5cb6cb9ff..b7132c35f 100644 --- a/test/libapt/strutil_test.cc +++ b/test/libapt/strutil_test.cc @@ -187,7 +187,7 @@ static void ReadMessagesTestWithNewLine(char const * const nl, char const * cons "Description:\n" " ccc"; - createTemporaryFile("readmessage", fd, NULL, (pkgA + nl + pkgB + nl + pkgC + nl).c_str()); + openTemporaryFile("readmessage", fd, (pkgA + nl + pkgB + nl + pkgC + nl).c_str()); std::vector list; EXPECT_TRUE(ReadMessages(fd.Fd(), list)); EXPECT_EQ(3u, list.size()); @@ -196,7 +196,7 @@ static void ReadMessagesTestWithNewLine(char const * const nl, char const * cons EXPECT_EQ(pkgC, list[2]); size_t const msgsize = 63990; - createTemporaryFile("readmessage", fd, NULL, NULL); + openTemporaryFile("readmessage", fd); for (size_t j = 0; j < msgsize; ++j) fd.Write(ab, strlen(ab)); for (size_t i = 0; i < 21; ++i) -- cgit v1.2.3-70-g09d2