diff options
author | Jelmer Snoeck <jelmer.snoeck@gmail.com> | 2015-08-26 20:41:30 +0100 |
---|---|---|
committer | Jelmer Snoeck <jelmer.snoeck@gmail.com> | 2015-08-26 20:41:30 +0100 |
commit | 38c257b759987e1d7660b8fa3d62103bd99a76ff (patch) | |
tree | 36220bf9d8e7cd7e3104c9f440eb4cc5512b0f6a /contrib | |
parent | 211fa5aeadb5acf6975059d76d9a05be9335e7a6 (diff) |
Httpimg: cleanup pdf path on with tests.
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/httpimg/httpimg_test.go | 15 |
1 files changed, 15 insertions, 0 deletions
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") } |