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/authconf_test.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test/libapt/authconf_test.cc') diff --git a/test/libapt/authconf_test.cc b/test/libapt/authconf_test.cc index 04d54e9be..f703351cc 100644 --- a/test/libapt/authconf_test.cc +++ b/test/libapt/authconf_test.cc @@ -20,7 +20,7 @@ TEST(NetRCTest, Parsing) EXPECT_EQ("file.not", U.Host); EXPECT_EQ("/open", U.Path); - createTemporaryFile("doublesignedfile", fd, nullptr, R"apt( + openTemporaryFile("doublesignedfile", fd, R"apt( machine example.netter login bar password foo machine example.net login foo password bar @@ -138,7 +138,7 @@ machine socks5h://example.last/debian login debian password rules)apt"); TEST(NetRCTest, BadFileNoMachine) { FileFd fd; - createTemporaryFile("doublesignedfile", fd, nullptr, R"apt( + openTemporaryFile("doublesignedfile", fd, R"apt( foo example.org login foo1 password bar machin example.org login foo2 password bar machine2 example.org login foo3 password bar @@ -152,7 +152,7 @@ machine2 example.org login foo3 password bar TEST(NetRCTest, BadFileEndsMachine) { FileFd fd; - createTemporaryFile("doublesignedfile", fd, nullptr, R"apt( + openTemporaryFile("doublesignedfile", fd, R"apt( machine example.org login foo1 password bar machine)apt"); @@ -176,7 +176,7 @@ machine)apt"); TEST(NetRCTest, BadFileEndsLogin) { FileFd fd; - createTemporaryFile("doublesignedfile", fd, nullptr, R"apt( + openTemporaryFile("doublesignedfile", fd, R"apt( machine example.org login foo1 password bar machine example.net login)apt"); @@ -200,7 +200,7 @@ machine example.net login)apt"); TEST(NetRCTest, BadFileEndsPassword) { FileFd fd; - createTemporaryFile("doublesignedfile", fd, nullptr, R"apt( + openTemporaryFile("doublesignedfile", fd, R"apt( machine example.org login foo1 password bar machine example.net password)apt"); @@ -225,7 +225,7 @@ machine example.net password)apt"); TEST(NetRCTest, MatchesOnlyHTTPS) { FileFd fd; - createTemporaryFile("doublesignedfile", fd, nullptr, R"apt( + openTemporaryFile("doublesignedfile", fd, R"apt( machine https.example login foo1 password bar machine http://http.example login foo1 password bar )apt"); -- cgit v1.2.3-70-g09d2