skip overwriting pdfs during tests

This commit is contained in:
Stani 2015-07-01 14:44:01 +02:00
parent f6e57f4712
commit 19b20e1fba

View file

@ -4,6 +4,7 @@
package pdf2d_test package pdf2d_test
import ( import (
"os"
"testing" "testing"
"github.com/stanim/draw2d" "github.com/stanim/draw2d"
@ -20,7 +21,11 @@ func test(t *testing.T, sample draw2d.Sample) {
t.Errorf("Drawing %q failed: %v", fn, err) t.Errorf("Drawing %q failed: %v", fn, err)
return return
} }
// Save to png // Save to pdf only if it doesn't exist because of git
if _, err = os.Stat(fn); err == nil {
t.Skipf("Saving %q skipped, as it exists already. (Git would consider it modified.)", fn)
return
}
err = pdf2d.SaveToPdfFile(fn, dest) err = pdf2d.SaveToPdfFile(fn, dest)
if err != nil { if err != nil {
t.Errorf("Saving %q failed: %v", fn, err) t.Errorf("Saving %q failed: %v", fn, err)