From 3b61e309828989a0a1560847ed798fba37d58c0e Mon Sep 17 00:00:00 2001 From: Yaroslav Khrylchenko Date: Thu, 12 Nov 2020 17:32:40 +0300 Subject: [PATCH] add test --- vips_test.go | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/vips_test.go b/vips_test.go index e3092bd..bf8d57d 100644 --- a/vips_test.go +++ b/vips_test.go @@ -89,8 +89,8 @@ func TestVipsAutoRotate(t *testing.T) { } files := []struct { - name string - orientation int + name string + orientation int }{ {"test.jpg", 0}, {"test_exif.jpg", 0}, @@ -203,6 +203,33 @@ func TestVipsMemory(t *testing.T) { } } +func TestVipsExifShort(t *testing.T) { + tt := []struct { + input string + expected string + }{ + { + input: `( ()`, + expected: `(`, + }, + { + input: ` ()`, + expected: ` ()`, + }, + { + input: `sRGB`, + expected: `sRGB`, + }, + } + + for _, tc := range tt { + got := vipsExifShort(tc.input) + if got != tc.expected { + t.Fatalf("expected: %s; got: %s", tc.expected, got) + } + } +} + func readImage(file string) []byte { img, _ := os.Open(path.Join("testdata", file)) buf, _ := ioutil.ReadAll(img)