From 38c257b759987e1d7660b8fa3d62103bd99a76ff Mon Sep 17 00:00:00 2001 From: Jelmer Snoeck Date: Wed, 26 Aug 2015 20:41:30 +0100 Subject: Httpimg: cleanup pdf path on with tests. --- contrib/httpimg/httpimg_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'contrib') diff --git a/contrib/httpimg/httpimg_test.go b/contrib/httpimg/httpimg_test.go index 3cd4218..8639bda 100644 --- a/contrib/httpimg/httpimg_test.go +++ b/contrib/httpimg/httpimg_test.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/jung-kurt/gofpdf" "github.com/jung-kurt/gofpdf/contrib/httpimg" + "os" "path/filepath" ) @@ -12,6 +13,20 @@ const ( cnExampleDir = cnGofpdfDir + "/pdf" ) +func init() { + cleanup() +} + +func cleanup() { + filepath.Walk(cnExampleDir, + func(path string, info os.FileInfo, err error) (reterr error) { + if path[len(path)-4:] == ".pdf" { + os.Remove(path) + } + return + }) +} + func exampleFilename(baseStr string) string { return filepath.Join(cnExampleDir, baseStr+".pdf") } -- cgit v1.2.1-24-ge1ad