From 340fc973758f1ad98a42769dfda9621f9b4971d5 Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Sat, 11 Feb 2023 10:45:32 -0500 Subject: [PATCH] rm tempfile --- test/strings/util.jl | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/test/strings/util.jl b/test/strings/util.jl index fd237594f4ad5..8b58c2f36d8c4 100644 --- a/test/strings/util.jl +++ b/test/strings/util.jl @@ -342,14 +342,18 @@ end @test String(take!(buf)) == "aaazaabbbzzz" end let tempfile = tempname() - open(tempfile, "w") do f - replace(f, "aaa", 'a' => 'z', count=0) - replace(f, "aaa", 'a' => 'z', count=1) - replace(f, "bbb", 'a' => 'z') - replace(f, "aaa", 'a' => 'z') - print(f, "\n") + try + open(tempfile, "w") do f + replace(f, "aaa", 'a' => 'z', count=0) + replace(f, "aaa", 'a' => 'z', count=1) + replace(f, "bbb", 'a' => 'z') + replace(f, "aaa", 'a' => 'z') + print(f, "\n") + end + @test read(tempfile, String) == "aaazaabbbzzz\n" + finally + rm(tempfile, force=true) end - @test read(tempfile, String) == "aaazaabbbzzz\n" end end