From 25d0813f8f9210fcaf3a5797d72756a332ef2dbe Mon Sep 17 00:00:00 2001 From: Kurt Jung Date: Fri, 9 Oct 2015 15:52:07 -0400 Subject: Implement PDF comparison with rudimentary byte-difference display. If a reference file exists, it will be compared with its associated example file. If the reference file is missing, the associated example file is considered to be without differences. PDF files in any subdirectory named reference are not deleted when the test begins. This commit is broken -- it illustrates how the use of maps for fonts, images and other resources lead to different dictionary tables in the PDF document. --- fpdf_test.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'fpdf_test.go') diff --git a/fpdf_test.go b/fpdf_test.go index 966767f..e45f966 100644 --- a/fpdf_test.go +++ b/fpdf_test.go @@ -40,9 +40,14 @@ func init() { func cleanup() { filepath.Walk(example.PdfDir(), func(path string, info os.FileInfo, err error) (reterr error) { - if len(path) > 3 { - if path[len(path)-4:] == ".pdf" { - os.Remove(path) + if info.Mode().IsRegular() { + dir, _ := filepath.Split(path) + if "reference" != filepath.Base(dir) { + if len(path) > 3 { + if path[len(path)-4:] == ".pdf" { + os.Remove(path) + } + } } } return -- cgit v1.2.1-24-ge1ad