From 127eb5cfbc6c52770107af25c57a7b74b25086f7 Mon Sep 17 00:00:00 2001 From: Tomas Aparicio Date: Mon, 30 Oct 2017 09:41:13 +0100 Subject: [PATCH] feat: add Gopkg manifests, move fixtures to testdata, add vendor dependencies --- .gitignore | 4 +- Gopkg.lock | 15 ++ Gopkg.toml | 26 +++ file_test.go | 6 +- image_test.go | 52 +++--- metadata_test.go | 2 +- resizer_test.go | 66 ++++---- {fixtures => testdata}/corrupt.jpg | Bin {fixtures => testdata}/exif/Landscape_1.jpg | Bin .../exif/Landscape_1_out.jpg | Bin {fixtures => testdata}/exif/Landscape_2.jpg | Bin .../exif/Landscape_2_out.jpg | Bin {fixtures => testdata}/exif/Landscape_3.jpg | Bin .../exif/Landscape_3_out.jpg | Bin {fixtures => testdata}/exif/Landscape_4.jpg | Bin .../exif/Landscape_4_out.jpg | Bin {fixtures => testdata}/exif/Landscape_5.jpg | Bin .../exif/Landscape_5_out.jpg | Bin {fixtures => testdata}/exif/Landscape_6.jpg | Bin .../exif/Landscape_6_out.jpg | Bin {fixtures => testdata}/exif/Landscape_7.jpg | Bin .../exif/Landscape_7_out.jpg | Bin {fixtures => testdata}/exif/Landscape_8.jpg | Bin .../exif/Landscape_8_out.jpg | Bin {fixtures => testdata}/exif/Portrait_1.jpg | Bin .../exif/Portrait_1_out.jpg | Bin {fixtures => testdata}/exif/Portrait_2.jpg | Bin .../exif/Portrait_2_out.jpg | Bin {fixtures => testdata}/exif/Portrait_3.jpg | Bin .../exif/Portrait_3_out.jpg | Bin {fixtures => testdata}/exif/Portrait_4.jpg | Bin .../exif/Portrait_4_out.jpg | Bin {fixtures => testdata}/exif/Portrait_5.jpg | Bin .../exif/Portrait_5_out.jpg | Bin {fixtures => testdata}/exif/Portrait_6.jpg | Bin .../exif/Portrait_6_out.jpg | Bin {fixtures => testdata}/exif/Portrait_7.jpg | Bin .../exif/Portrait_7_out.jpg | Bin {fixtures => testdata}/exif/Portrait_8.jpg | Bin .../exif/Portrait_8_out.jpg | Bin .../northern_cardinal_bird.jpg | Bin {fixtures => testdata}/test.gif | Bin {fixtures => testdata}/test.jp2 | Bin {fixtures => testdata}/test.jpg | Bin {fixtures => testdata}/test.pdf | Bin {fixtures => testdata}/test.png | Bin {fixtures => testdata}/test.svg | 0 {fixtures => testdata}/test.webp | Bin {fixtures => testdata}/test_gif.jpg | Bin {fixtures => testdata}/test_icc_prophoto.jpg | Bin {fixtures => testdata}/test_issue.jpg | Bin {fixtures => testdata}/test_pdf.jpg | Bin testdata/test_smart_crop.jpg | Bin 0 -> 17088 bytes {fixtures => testdata}/test_square.jpg | Bin {fixtures => testdata}/test_svg.jpg | Bin {fixtures => testdata}/transparent.png | Bin {fixtures => testdata}/transparent_trim.png | Bin {fixtures => testdata}/vertical.jpg | Bin {fixtures => testdata}/vertical.webp | Bin type_test.go | 4 +- vendor/github.com/tj/go-debug/History.md | 21 +++ vendor/github.com/tj/go-debug/Makefile | 8 + vendor/github.com/tj/go-debug/Readme.md | 75 +++++++++ vendor/github.com/tj/go-debug/debug.go | 128 +++++++++++++++ vendor/github.com/tj/go-debug/debug_test.go | 152 ++++++++++++++++++ .../tj/go-debug/example/multiple.go | 25 +++ .../github.com/tj/go-debug/example/single.go | 16 ++ vips_test.go | 2 +- 68 files changed, 534 insertions(+), 68 deletions(-) create mode 100644 Gopkg.lock create mode 100644 Gopkg.toml rename {fixtures => testdata}/corrupt.jpg (100%) rename {fixtures => testdata}/exif/Landscape_1.jpg (100%) rename {fixtures => testdata}/exif/Landscape_1_out.jpg (100%) rename {fixtures => testdata}/exif/Landscape_2.jpg (100%) rename {fixtures => testdata}/exif/Landscape_2_out.jpg (100%) rename {fixtures => testdata}/exif/Landscape_3.jpg (100%) rename {fixtures => testdata}/exif/Landscape_3_out.jpg (100%) rename {fixtures => testdata}/exif/Landscape_4.jpg (100%) rename {fixtures => testdata}/exif/Landscape_4_out.jpg (100%) rename {fixtures => testdata}/exif/Landscape_5.jpg (100%) rename {fixtures => testdata}/exif/Landscape_5_out.jpg (100%) rename {fixtures => testdata}/exif/Landscape_6.jpg (100%) rename {fixtures => testdata}/exif/Landscape_6_out.jpg (100%) rename {fixtures => testdata}/exif/Landscape_7.jpg (100%) rename {fixtures => testdata}/exif/Landscape_7_out.jpg (100%) rename {fixtures => testdata}/exif/Landscape_8.jpg (100%) rename {fixtures => testdata}/exif/Landscape_8_out.jpg (100%) rename {fixtures => testdata}/exif/Portrait_1.jpg (100%) rename {fixtures => testdata}/exif/Portrait_1_out.jpg (100%) rename {fixtures => testdata}/exif/Portrait_2.jpg (100%) rename {fixtures => testdata}/exif/Portrait_2_out.jpg (100%) rename {fixtures => testdata}/exif/Portrait_3.jpg (100%) rename {fixtures => testdata}/exif/Portrait_3_out.jpg (100%) rename {fixtures => testdata}/exif/Portrait_4.jpg (100%) rename {fixtures => testdata}/exif/Portrait_4_out.jpg (100%) rename {fixtures => testdata}/exif/Portrait_5.jpg (100%) rename {fixtures => testdata}/exif/Portrait_5_out.jpg (100%) rename {fixtures => testdata}/exif/Portrait_6.jpg (100%) rename {fixtures => testdata}/exif/Portrait_6_out.jpg (100%) rename {fixtures => testdata}/exif/Portrait_7.jpg (100%) rename {fixtures => testdata}/exif/Portrait_7_out.jpg (100%) rename {fixtures => testdata}/exif/Portrait_8.jpg (100%) rename {fixtures => testdata}/exif/Portrait_8_out.jpg (100%) rename {fixtures => testdata}/northern_cardinal_bird.jpg (100%) rename {fixtures => testdata}/test.gif (100%) rename {fixtures => testdata}/test.jp2 (100%) rename {fixtures => testdata}/test.jpg (100%) rename {fixtures => testdata}/test.pdf (100%) rename {fixtures => testdata}/test.png (100%) rename {fixtures => testdata}/test.svg (100%) rename {fixtures => testdata}/test.webp (100%) rename {fixtures => testdata}/test_gif.jpg (100%) rename {fixtures => testdata}/test_icc_prophoto.jpg (100%) rename {fixtures => testdata}/test_issue.jpg (100%) rename {fixtures => testdata}/test_pdf.jpg (100%) create mode 100644 testdata/test_smart_crop.jpg rename {fixtures => testdata}/test_square.jpg (100%) rename {fixtures => testdata}/test_svg.jpg (100%) rename {fixtures => testdata}/transparent.png (100%) rename {fixtures => testdata}/transparent_trim.png (100%) rename {fixtures => testdata}/vertical.jpg (100%) rename {fixtures => testdata}/vertical.webp (100%) create mode 100644 vendor/github.com/tj/go-debug/History.md create mode 100644 vendor/github.com/tj/go-debug/Makefile create mode 100644 vendor/github.com/tj/go-debug/Readme.md create mode 100644 vendor/github.com/tj/go-debug/debug.go create mode 100644 vendor/github.com/tj/go-debug/debug_test.go create mode 100644 vendor/github.com/tj/go-debug/example/multiple.go create mode 100644 vendor/github.com/tj/go-debug/example/single.go diff --git a/.gitignore b/.gitignore index 93b3def..141a50b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,6 @@ bin /*.jpg /*.png /*.webp -/fixtures/*_out.* +/testdata/*_out.* /.idea/ -fixtures/test_vertical_*.jpg +testdata/test_vertical_*.jpg diff --git a/Gopkg.lock b/Gopkg.lock new file mode 100644 index 0000000..1c64c9b --- /dev/null +++ b/Gopkg.lock @@ -0,0 +1,15 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + name = "github.com/tj/go-debug" + packages = ["."] + revision = "ff4a55a20a86994118644bbddc6a216da193cc13" + version = "v2.0.0" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-digest = "6a05cef6e16f81ece71d6125d24af0bceb1d65db5c902c7b46eeb6d2a46826d3" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml new file mode 100644 index 0000000..4791377 --- /dev/null +++ b/Gopkg.toml @@ -0,0 +1,26 @@ + +# Gopkg.toml example +# +# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md +# for detailed Gopkg.toml documentation. +# +# required = ["github.com/user/thing/cmd/thing"] +# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] +# +# [[constraint]] +# name = "github.com/user/project" +# version = "1.0.0" +# +# [[constraint]] +# name = "github.com/user/project2" +# branch = "dev" +# source = "github.com/myfork/project2" +# +# [[override]] +# name = "github.com/x/y" +# version = "2.4.0" + + +[[constraint]] + name = "github.com/tj/go-debug" + version = "2.0.0" diff --git a/file_test.go b/file_test.go index 2144669..620b4ac 100644 --- a/file_test.go +++ b/file_test.go @@ -5,7 +5,7 @@ import ( ) func TestRead(t *testing.T) { - buf, err := Read("fixtures/test.jpg") + buf, err := Read("testdata/test.jpg") if err != nil { t.Errorf("Cannot read the image: %#v", err) @@ -21,7 +21,7 @@ func TestRead(t *testing.T) { } func TestWrite(t *testing.T) { - buf, err := Read("fixtures/test.jpg") + buf, err := Read("testdata/test.jpg") if err != nil { t.Errorf("Cannot read the image: %#v", err) @@ -31,7 +31,7 @@ func TestWrite(t *testing.T) { t.Fatal("Empty buffer") } - err = Write("fixtures/test_write_out.jpg", buf) + err = Write("testdata/test_write_out.jpg", buf) if err != nil { t.Fatalf("Cannot write the file: %#v", err) } diff --git a/image_test.go b/image_test.go index e7c431b..37bb4bd 100644 --- a/image_test.go +++ b/image_test.go @@ -17,7 +17,7 @@ func TestImageResize(t *testing.T) { t.Error(err) } - Write("fixtures/test_resize_out.jpg", buf) + Write("testdata/test_resize_out.jpg", buf) } func TestImageGifResize(t *testing.T) { @@ -52,7 +52,7 @@ func TestImageGifToJpeg(t *testing.T) { t.Errorf("Cannot process the image: %#v", err) } - Write("fixtures/test_gif.jpg", buf) + Write("testdata/test_gif.jpg", buf) } } @@ -67,7 +67,7 @@ func TestImagePdfToJpeg(t *testing.T) { t.Errorf("Cannot process the image: %#v", err) } - Write("fixtures/test_pdf.jpg", buf) + Write("testdata/test_pdf.jpg", buf) } } @@ -82,7 +82,7 @@ func TestImageSvgToJpeg(t *testing.T) { t.Errorf("Cannot process the image: %#v", err) } - Write("fixtures/test_svg.jpg", buf) + Write("testdata/test_svg.jpg", buf) } } @@ -97,7 +97,7 @@ func TestImageResizeAndCrop(t *testing.T) { t.Error(err) } - Write("fixtures/test_resize_crop_out.jpg", buf) + Write("testdata/test_resize_crop_out.jpg", buf) } func TestImageExtract(t *testing.T) { @@ -111,7 +111,7 @@ func TestImageExtract(t *testing.T) { t.Error(err) } - Write("fixtures/test_extract_out.jpg", buf) + Write("testdata/test_extract_out.jpg", buf) } func TestImageExtractZero(t *testing.T) { @@ -125,7 +125,7 @@ func TestImageExtractZero(t *testing.T) { t.Error(err) } - Write("fixtures/test_extract_zero_out.jpg", buf) + Write("testdata/test_extract_zero_out.jpg", buf) } func TestImageEnlarge(t *testing.T) { @@ -139,7 +139,7 @@ func TestImageEnlarge(t *testing.T) { t.Error(err) } - Write("fixtures/test_enlarge_out.jpg", buf) + Write("testdata/test_enlarge_out.jpg", buf) } func TestImageEnlargeAndCrop(t *testing.T) { @@ -153,7 +153,7 @@ func TestImageEnlargeAndCrop(t *testing.T) { t.Error(err) } - Write("fixtures/test_enlarge_crop_out.jpg", buf) + Write("testdata/test_enlarge_crop_out.jpg", buf) } func TestImageCrop(t *testing.T) { @@ -167,7 +167,7 @@ func TestImageCrop(t *testing.T) { t.Error(err) } - Write("fixtures/test_crop_out.jpg", buf) + Write("testdata/test_crop_out.jpg", buf) } func TestImageCropByWidth(t *testing.T) { @@ -181,7 +181,7 @@ func TestImageCropByWidth(t *testing.T) { t.Error(err) } - Write("fixtures/test_crop_width_out.jpg", buf) + Write("testdata/test_crop_width_out.jpg", buf) } func TestImageCropByHeight(t *testing.T) { @@ -195,7 +195,7 @@ func TestImageCropByHeight(t *testing.T) { t.Error(err) } - Write("fixtures/test_crop_height_out.jpg", buf) + Write("testdata/test_crop_height_out.jpg", buf) } func TestImageThumbnail(t *testing.T) { @@ -209,7 +209,7 @@ func TestImageThumbnail(t *testing.T) { t.Error(err) } - Write("fixtures/test_thumbnail_out.jpg", buf) + Write("testdata/test_thumbnail_out.jpg", buf) } func TestImageWatermark(t *testing.T) { @@ -239,7 +239,7 @@ func TestImageWatermark(t *testing.T) { t.Fatal("Image is not jpeg") } - Write("fixtures/test_watermark_text_out.jpg", buf) + Write("testdata/test_watermark_text_out.jpg", buf) } func TestImageWatermarkWithImage(t *testing.T) { @@ -266,7 +266,7 @@ func TestImageWatermarkWithImage(t *testing.T) { t.Fatal("Image is not jpeg") } - Write("fixtures/test_watermark_image_out.jpg", buf) + Write("testdata/test_watermark_image_out.jpg", buf) } func TestImageWatermarkNoReplicate(t *testing.T) { @@ -297,7 +297,7 @@ func TestImageWatermarkNoReplicate(t *testing.T) { t.Fatal("Image is not jpeg") } - Write("fixtures/test_watermark_replicate_out.jpg", buf) + Write("testdata/test_watermark_replicate_out.jpg", buf) } func TestImageZoom(t *testing.T) { @@ -318,7 +318,7 @@ func TestImageZoom(t *testing.T) { t.Error(err) } - Write("fixtures/test_zoom_out.jpg", buf) + Write("testdata/test_zoom_out.jpg", buf) } func TestImageFlip(t *testing.T) { @@ -326,7 +326,7 @@ func TestImageFlip(t *testing.T) { if err != nil { t.Errorf("Cannot process the image: %#v", err) } - Write("fixtures/test_flip_out.jpg", buf) + Write("testdata/test_flip_out.jpg", buf) } func TestImageFlop(t *testing.T) { @@ -334,7 +334,7 @@ func TestImageFlop(t *testing.T) { if err != nil { t.Errorf("Cannot process the image: %#v", err) } - Write("fixtures/test_flop_out.jpg", buf) + Write("testdata/test_flop_out.jpg", buf) } func TestImageRotate(t *testing.T) { @@ -342,7 +342,7 @@ func TestImageRotate(t *testing.T) { if err != nil { t.Errorf("Cannot process the image: %#v", err) } - Write("fixtures/test_image_rotate_out.jpg", buf) + Write("testdata/test_image_rotate_out.jpg", buf) } func TestImageConvert(t *testing.T) { @@ -350,7 +350,7 @@ func TestImageConvert(t *testing.T) { if err != nil { t.Errorf("Cannot process the image: %#v", err) } - Write("fixtures/test_image_convert_out.png", buf) + Write("testdata/test_image_convert_out.png", buf) } func TestTransparentImageConvert(t *testing.T) { @@ -363,7 +363,7 @@ func TestTransparentImageConvert(t *testing.T) { if err != nil { t.Errorf("Cannot process the image: %#v", err) } - Write("fixtures/test_transparent_image_convert_out.jpg", buf) + Write("testdata/test_transparent_image_convert_out.jpg", buf) } func TestImageMetadata(t *testing.T) { @@ -452,7 +452,7 @@ func TestFluentInterface(t *testing.T) { t.Fatal("Invalid image type") } - Write("fixtures/test_image_fluent_out.png", image.Image()) + Write("testdata/test_image_fluent_out.png", image.Image()) } func TestImageSmartCrop(t *testing.T) { @@ -472,7 +472,7 @@ func TestImageSmartCrop(t *testing.T) { t.Error(err) } - Write("fixtures/test_smart_crop.jpg", buf) + Write("testdata/test_smart_crop.jpg", buf) } func TestImageTrim(t *testing.T) { @@ -492,7 +492,7 @@ func TestImageTrim(t *testing.T) { t.Errorf("The image wasn't trimmed.") } - Write("fixtures/transparent_trim.png", buf) + Write("testdata/transparent_trim.png", buf) } func TestImageLength(t *testing.T) { @@ -512,7 +512,7 @@ func initImage(file string) *Image { } func imageBuf(file string) ([]byte, error) { - return Read(path.Join("fixtures", file)) + return Read(path.Join("testdata", file)) } func assertSize(buf []byte, width, height int) error { diff --git a/metadata_test.go b/metadata_test.go index 663ec56..83be45f 100644 --- a/metadata_test.go +++ b/metadata_test.go @@ -118,7 +118,7 @@ func TestColourspaceIsSupported(t *testing.T) { } func readFile(file string) []byte { - data, _ := os.Open(path.Join("fixtures", file)) + data, _ := os.Open(path.Join("testdata", file)) buf, _ := ioutil.ReadAll(data) return buf } diff --git a/resizer_test.go b/resizer_test.go index fd1f2d7..a4b54b0 100644 --- a/resizer_test.go +++ b/resizer_test.go @@ -14,7 +14,7 @@ import ( func TestResize(t *testing.T) { options := Options{Width: 800, Height: 600} - buf, _ := Read("fixtures/test.jpg") + buf, _ := Read("testdata/test.jpg") newImg, err := Resize(buf, options) if err != nil { @@ -30,7 +30,7 @@ func TestResize(t *testing.T) { t.Fatalf("Invalid image size: %dx%d", size.Width, size.Height) } - Write("fixtures/test_out.jpg", newImg) + Write("testdata/test_out.jpg", newImg) } func TestResizeVerticalImage(t *testing.T) { @@ -51,11 +51,11 @@ func TestResizeVerticalImage(t *testing.T) { {Force: true, Width: 2000, Height: 2000}, } - bufJpeg, err := Read("fixtures/vertical.jpg") + bufJpeg, err := Read("testdata/vertical.jpg") if err != nil { t.Fatal(err) } - bufWebp, err := Read("fixtures/vertical.webp") + bufWebp, err := Read("testdata/vertical.webp") if err != nil { t.Fatal(err) } @@ -90,7 +90,7 @@ func TestResizeVerticalImage(t *testing.T) { Write( fmt.Sprintf( - "fixtures/test_vertical_%dx%d_out.%s", + "testdata/test_vertical_%dx%d_out.%s", options.Width, options.Height, ImageTypeName(source.format)), @@ -114,11 +114,11 @@ func TestResizeCustomSizes(t *testing.T) { {Force: true, Width: 2000, Height: 2000}, } - bufJpeg, err := Read("fixtures/test.jpg") + bufJpeg, err := Read("testdata/test.jpg") if err != nil { t.Fatal(err) } - bufWebp, err := Read("fixtures/test.webp") + bufWebp, err := Read("testdata/test.webp") if err != nil { t.Fatal(err) } @@ -181,7 +181,7 @@ func TestResizePrecision(t *testing.T) { func TestRotate(t *testing.T) { options := Options{Width: 800, Height: 600, Rotate: 270, Crop: true} - buf, _ := Read("fixtures/test.jpg") + buf, _ := Read("testdata/test.jpg") newImg, err := Resize(buf, options) if err != nil { @@ -197,12 +197,12 @@ func TestRotate(t *testing.T) { t.Errorf("Invalid image size: %dx%d", size.Width, size.Height) } - Write("fixtures/test_rotate_out.jpg", newImg) + Write("testdata/test_rotate_out.jpg", newImg) } func TestInvalidRotateDegrees(t *testing.T) { options := Options{Width: 800, Height: 600, Rotate: 111, Crop: true} - buf, _ := Read("fixtures/test.jpg") + buf, _ := Read("testdata/test.jpg") newImg, err := Resize(buf, options) if err != nil { @@ -218,12 +218,12 @@ func TestInvalidRotateDegrees(t *testing.T) { t.Errorf("Invalid image size: %dx%d", size.Width, size.Height) } - Write("fixtures/test_rotate_invalid_out.jpg", newImg) + Write("testdata/test_rotate_invalid_out.jpg", newImg) } func TestCorruptedImage(t *testing.T) { options := Options{Width: 800, Height: 600} - buf, _ := Read("fixtures/corrupt.jpg") + buf, _ := Read("testdata/corrupt.jpg") newImg, err := Resize(buf, options) if err != nil { @@ -239,12 +239,12 @@ func TestCorruptedImage(t *testing.T) { t.Fatalf("Invalid image size: %dx%d", size.Width, size.Height) } - Write("fixtures/test_corrupt_out.jpg", newImg) + Write("testdata/test_corrupt_out.jpg", newImg) } func TestNoColorProfile(t *testing.T) { options := Options{Width: 800, Height: 600, NoProfile: true} - buf, _ := Read("fixtures/test.jpg") + buf, _ := Read("testdata/test.jpg") newImg, err := Resize(buf, options) if err != nil { @@ -264,7 +264,7 @@ func TestNoColorProfile(t *testing.T) { func TestEmbedExtendColor(t *testing.T) { options := Options{Width: 400, Height: 600, Crop: false, Embed: true, Extend: ExtendWhite, Background: Color{255, 20, 10}} - buf, _ := Read("fixtures/test_issue.jpg") + buf, _ := Read("testdata/test_issue.jpg") newImg, err := Resize(buf, options) if err != nil { @@ -276,12 +276,12 @@ func TestEmbedExtendColor(t *testing.T) { t.Fatalf("Invalid image size: %dx%d", size.Width, size.Height) } - Write("fixtures/test_extend_white_out.jpg", newImg) + Write("testdata/test_extend_white_out.jpg", newImg) } func TestEmbedExtendWithCustomColor(t *testing.T) { options := Options{Width: 400, Height: 600, Crop: false, Embed: true, Extend: 5, Background: Color{255, 20, 10}} - buf, _ := Read("fixtures/test_issue.jpg") + buf, _ := Read("testdata/test_issue.jpg") newImg, err := Resize(buf, options) if err != nil { @@ -293,12 +293,12 @@ func TestEmbedExtendWithCustomColor(t *testing.T) { t.Fatalf("Invalid image size: %dx%d", size.Width, size.Height) } - Write("fixtures/test_extend_background_out.jpg", newImg) + Write("testdata/test_extend_background_out.jpg", newImg) } func TestGaussianBlur(t *testing.T) { options := Options{Width: 800, Height: 600, GaussianBlur: GaussianBlur{Sigma: 5}} - buf, _ := Read("fixtures/test.jpg") + buf, _ := Read("testdata/test.jpg") newImg, err := Resize(buf, options) if err != nil { @@ -310,12 +310,12 @@ func TestGaussianBlur(t *testing.T) { t.Fatalf("Invalid image size: %dx%d", size.Width, size.Height) } - Write("fixtures/test_gaussian_out.jpg", newImg) + Write("testdata/test_gaussian_out.jpg", newImg) } func TestSharpen(t *testing.T) { options := Options{Width: 800, Height: 600, Sharpen: Sharpen{Radius: 1, X1: 1.5, Y2: 20, Y3: 50, M1: 1, M2: 2}} - buf, _ := Read("fixtures/test.jpg") + buf, _ := Read("testdata/test.jpg") newImg, err := Resize(buf, options) if err != nil { @@ -327,12 +327,12 @@ func TestSharpen(t *testing.T) { t.Fatalf("Invalid image size: %dx%d", size.Width, size.Height) } - Write("fixtures/test_sharpen_out.jpg", newImg) + Write("testdata/test_sharpen_out.jpg", newImg) } func TestExtractWithDefaultAxis(t *testing.T) { options := Options{AreaWidth: 200, AreaHeight: 200} - buf, _ := Read("fixtures/test.jpg") + buf, _ := Read("testdata/test.jpg") newImg, err := Resize(buf, options) if err != nil { @@ -344,12 +344,12 @@ func TestExtractWithDefaultAxis(t *testing.T) { t.Fatalf("Invalid image size: %dx%d", size.Width, size.Height) } - Write("fixtures/test_extract_defaults_out.jpg", newImg) + Write("testdata/test_extract_defaults_out.jpg", newImg) } func TestExtractCustomAxis(t *testing.T) { options := Options{Top: 100, Left: 100, AreaWidth: 200, AreaHeight: 200} - buf, _ := Read("fixtures/test.jpg") + buf, _ := Read("testdata/test.jpg") newImg, err := Resize(buf, options) if err != nil { @@ -361,7 +361,7 @@ func TestExtractCustomAxis(t *testing.T) { t.Fatalf("Invalid image size: %dx%d", size.Width, size.Height) } - Write("fixtures/test_extract_custom_axis_out.jpg", newImg) + Write("testdata/test_extract_custom_axis_out.jpg", newImg) } func TestConvert(t *testing.T) { @@ -375,7 +375,7 @@ func TestConvert(t *testing.T) { } for _, file := range files { - img, err := os.Open("fixtures/" + file) + img, err := os.Open("testdata/" + file) if err != nil { t.Fatal(err) } @@ -410,7 +410,7 @@ func TestResizePngWithTransparency(t *testing.T) { width, height := 300, 240 options := Options{Width: width, Height: height, Crop: true} - img, err := os.Open("fixtures/transparent.png") + img, err := os.Open("testdata/transparent.png") if err != nil { t.Fatal(err) } @@ -435,7 +435,7 @@ func TestResizePngWithTransparency(t *testing.T) { t.Fatal("Invalid image size") } - Write("fixtures/transparent_out.png", newImg) + Write("testdata/transparent_out.png", newImg) } func TestRotationAndFlip(t *testing.T) { @@ -463,7 +463,7 @@ func TestRotationAndFlip(t *testing.T) { } for _, file := range files { - img, err := os.Open(fmt.Sprintf("fixtures/exif/%s.jpg", file.Name)) + img, err := os.Open(fmt.Sprintf("testdata/exif/%s.jpg", file.Name)) if err != nil { t.Fatal(err) } @@ -493,7 +493,7 @@ func TestRotationAndFlip(t *testing.T) { t.Fatal(err) } - Write(fmt.Sprintf("fixtures/exif/%s_out.jpg", file.Name), newImg) + Write(fmt.Sprintf("testdata/exif/%s_out.jpg", file.Name), newImg) } } @@ -506,7 +506,7 @@ func TestIfBothSmartCropOptionsAreIdentical(t *testing.T) { smartCropOptions := Options{Width: 100, Height: 100, Crop: true, SmartCrop: true} gravityOptions := Options{Width: 100, Height: 100, Crop: true, Gravity: GravitySmart} - testImg, err := os.Open("fixtures/northern_cardinal_bird.jpg") + testImg, err := os.Open("testdata/northern_cardinal_bird.jpg") if err != nil { t.Fatal(err) } @@ -543,7 +543,7 @@ func TestIfBothSmartCropOptionsAreIdentical(t *testing.T) { } func runBenchmarkResize(file string, o Options, b *testing.B) { - buf, _ := Read(path.Join("fixtures", file)) + buf, _ := Read(path.Join("testdata", file)) for n := 0; n < b.N; n++ { Resize(buf, o) diff --git a/fixtures/corrupt.jpg b/testdata/corrupt.jpg similarity index 100% rename from fixtures/corrupt.jpg rename to testdata/corrupt.jpg diff --git a/fixtures/exif/Landscape_1.jpg b/testdata/exif/Landscape_1.jpg similarity index 100% rename from fixtures/exif/Landscape_1.jpg rename to testdata/exif/Landscape_1.jpg diff --git a/fixtures/exif/Landscape_1_out.jpg b/testdata/exif/Landscape_1_out.jpg similarity index 100% rename from fixtures/exif/Landscape_1_out.jpg rename to testdata/exif/Landscape_1_out.jpg diff --git a/fixtures/exif/Landscape_2.jpg b/testdata/exif/Landscape_2.jpg similarity index 100% rename from fixtures/exif/Landscape_2.jpg rename to testdata/exif/Landscape_2.jpg diff --git a/fixtures/exif/Landscape_2_out.jpg b/testdata/exif/Landscape_2_out.jpg similarity index 100% rename from fixtures/exif/Landscape_2_out.jpg rename to testdata/exif/Landscape_2_out.jpg diff --git a/fixtures/exif/Landscape_3.jpg b/testdata/exif/Landscape_3.jpg similarity index 100% rename from fixtures/exif/Landscape_3.jpg rename to testdata/exif/Landscape_3.jpg diff --git a/fixtures/exif/Landscape_3_out.jpg b/testdata/exif/Landscape_3_out.jpg similarity index 100% rename from fixtures/exif/Landscape_3_out.jpg rename to testdata/exif/Landscape_3_out.jpg diff --git a/fixtures/exif/Landscape_4.jpg b/testdata/exif/Landscape_4.jpg similarity index 100% rename from fixtures/exif/Landscape_4.jpg rename to testdata/exif/Landscape_4.jpg diff --git a/fixtures/exif/Landscape_4_out.jpg b/testdata/exif/Landscape_4_out.jpg similarity index 100% rename from fixtures/exif/Landscape_4_out.jpg rename to testdata/exif/Landscape_4_out.jpg diff --git a/fixtures/exif/Landscape_5.jpg b/testdata/exif/Landscape_5.jpg similarity index 100% rename from fixtures/exif/Landscape_5.jpg rename to testdata/exif/Landscape_5.jpg diff --git a/fixtures/exif/Landscape_5_out.jpg b/testdata/exif/Landscape_5_out.jpg similarity index 100% rename from fixtures/exif/Landscape_5_out.jpg rename to testdata/exif/Landscape_5_out.jpg diff --git a/fixtures/exif/Landscape_6.jpg b/testdata/exif/Landscape_6.jpg similarity index 100% rename from fixtures/exif/Landscape_6.jpg rename to testdata/exif/Landscape_6.jpg diff --git a/fixtures/exif/Landscape_6_out.jpg b/testdata/exif/Landscape_6_out.jpg similarity index 100% rename from fixtures/exif/Landscape_6_out.jpg rename to testdata/exif/Landscape_6_out.jpg diff --git a/fixtures/exif/Landscape_7.jpg b/testdata/exif/Landscape_7.jpg similarity index 100% rename from fixtures/exif/Landscape_7.jpg rename to testdata/exif/Landscape_7.jpg diff --git a/fixtures/exif/Landscape_7_out.jpg b/testdata/exif/Landscape_7_out.jpg similarity index 100% rename from fixtures/exif/Landscape_7_out.jpg rename to testdata/exif/Landscape_7_out.jpg diff --git a/fixtures/exif/Landscape_8.jpg b/testdata/exif/Landscape_8.jpg similarity index 100% rename from fixtures/exif/Landscape_8.jpg rename to testdata/exif/Landscape_8.jpg diff --git a/fixtures/exif/Landscape_8_out.jpg b/testdata/exif/Landscape_8_out.jpg similarity index 100% rename from fixtures/exif/Landscape_8_out.jpg rename to testdata/exif/Landscape_8_out.jpg diff --git a/fixtures/exif/Portrait_1.jpg b/testdata/exif/Portrait_1.jpg similarity index 100% rename from fixtures/exif/Portrait_1.jpg rename to testdata/exif/Portrait_1.jpg diff --git a/fixtures/exif/Portrait_1_out.jpg b/testdata/exif/Portrait_1_out.jpg similarity index 100% rename from fixtures/exif/Portrait_1_out.jpg rename to testdata/exif/Portrait_1_out.jpg diff --git a/fixtures/exif/Portrait_2.jpg b/testdata/exif/Portrait_2.jpg similarity index 100% rename from fixtures/exif/Portrait_2.jpg rename to testdata/exif/Portrait_2.jpg diff --git a/fixtures/exif/Portrait_2_out.jpg b/testdata/exif/Portrait_2_out.jpg similarity index 100% rename from fixtures/exif/Portrait_2_out.jpg rename to testdata/exif/Portrait_2_out.jpg diff --git a/fixtures/exif/Portrait_3.jpg b/testdata/exif/Portrait_3.jpg similarity index 100% rename from fixtures/exif/Portrait_3.jpg rename to testdata/exif/Portrait_3.jpg diff --git a/fixtures/exif/Portrait_3_out.jpg b/testdata/exif/Portrait_3_out.jpg similarity index 100% rename from fixtures/exif/Portrait_3_out.jpg rename to testdata/exif/Portrait_3_out.jpg diff --git a/fixtures/exif/Portrait_4.jpg b/testdata/exif/Portrait_4.jpg similarity index 100% rename from fixtures/exif/Portrait_4.jpg rename to testdata/exif/Portrait_4.jpg diff --git a/fixtures/exif/Portrait_4_out.jpg b/testdata/exif/Portrait_4_out.jpg similarity index 100% rename from fixtures/exif/Portrait_4_out.jpg rename to testdata/exif/Portrait_4_out.jpg diff --git a/fixtures/exif/Portrait_5.jpg b/testdata/exif/Portrait_5.jpg similarity index 100% rename from fixtures/exif/Portrait_5.jpg rename to testdata/exif/Portrait_5.jpg diff --git a/fixtures/exif/Portrait_5_out.jpg b/testdata/exif/Portrait_5_out.jpg similarity index 100% rename from fixtures/exif/Portrait_5_out.jpg rename to testdata/exif/Portrait_5_out.jpg diff --git a/fixtures/exif/Portrait_6.jpg b/testdata/exif/Portrait_6.jpg similarity index 100% rename from fixtures/exif/Portrait_6.jpg rename to testdata/exif/Portrait_6.jpg diff --git a/fixtures/exif/Portrait_6_out.jpg b/testdata/exif/Portrait_6_out.jpg similarity index 100% rename from fixtures/exif/Portrait_6_out.jpg rename to testdata/exif/Portrait_6_out.jpg diff --git a/fixtures/exif/Portrait_7.jpg b/testdata/exif/Portrait_7.jpg similarity index 100% rename from fixtures/exif/Portrait_7.jpg rename to testdata/exif/Portrait_7.jpg diff --git a/fixtures/exif/Portrait_7_out.jpg b/testdata/exif/Portrait_7_out.jpg similarity index 100% rename from fixtures/exif/Portrait_7_out.jpg rename to testdata/exif/Portrait_7_out.jpg diff --git a/fixtures/exif/Portrait_8.jpg b/testdata/exif/Portrait_8.jpg similarity index 100% rename from fixtures/exif/Portrait_8.jpg rename to testdata/exif/Portrait_8.jpg diff --git a/fixtures/exif/Portrait_8_out.jpg b/testdata/exif/Portrait_8_out.jpg similarity index 100% rename from fixtures/exif/Portrait_8_out.jpg rename to testdata/exif/Portrait_8_out.jpg diff --git a/fixtures/northern_cardinal_bird.jpg b/testdata/northern_cardinal_bird.jpg similarity index 100% rename from fixtures/northern_cardinal_bird.jpg rename to testdata/northern_cardinal_bird.jpg diff --git a/fixtures/test.gif b/testdata/test.gif similarity index 100% rename from fixtures/test.gif rename to testdata/test.gif diff --git a/fixtures/test.jp2 b/testdata/test.jp2 similarity index 100% rename from fixtures/test.jp2 rename to testdata/test.jp2 diff --git a/fixtures/test.jpg b/testdata/test.jpg similarity index 100% rename from fixtures/test.jpg rename to testdata/test.jpg diff --git a/fixtures/test.pdf b/testdata/test.pdf similarity index 100% rename from fixtures/test.pdf rename to testdata/test.pdf diff --git a/fixtures/test.png b/testdata/test.png similarity index 100% rename from fixtures/test.png rename to testdata/test.png diff --git a/fixtures/test.svg b/testdata/test.svg similarity index 100% rename from fixtures/test.svg rename to testdata/test.svg diff --git a/fixtures/test.webp b/testdata/test.webp similarity index 100% rename from fixtures/test.webp rename to testdata/test.webp diff --git a/fixtures/test_gif.jpg b/testdata/test_gif.jpg similarity index 100% rename from fixtures/test_gif.jpg rename to testdata/test_gif.jpg diff --git a/fixtures/test_icc_prophoto.jpg b/testdata/test_icc_prophoto.jpg similarity index 100% rename from fixtures/test_icc_prophoto.jpg rename to testdata/test_icc_prophoto.jpg diff --git a/fixtures/test_issue.jpg b/testdata/test_issue.jpg similarity index 100% rename from fixtures/test_issue.jpg rename to testdata/test_issue.jpg diff --git a/fixtures/test_pdf.jpg b/testdata/test_pdf.jpg similarity index 100% rename from fixtures/test_pdf.jpg rename to testdata/test_pdf.jpg diff --git a/testdata/test_smart_crop.jpg b/testdata/test_smart_crop.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ff4a349165c366be811b30f8b8a1f468c7646d1d GIT binary patch literal 17088 zcmb4pbyOTdv+rVAAh;#L9TrP)CqS@Wd~px13oNb)9^Bn+@x_8W1cC=!T!Ita0)&u| z$9M02=iPr_&&=tXQ`Nt!=`-D3-BtgV{%rz?APQgw02&$qfcA6&{%rw*d*Apzp|DyjR{cjcU4)6>U>lqg2vu9Y(fWT+ixJ0ML&ii=CiPDw$@ z{{LP6^#O>n(YVmKFwhtQ=)`Ck#AyEp0n`8hIy%OGI_&=zj3;B!(18H#C$1C`01X2J z10Cz>M#sQ@`f4w&AK4hrv0>99y4{1kz0#pXRyMyw^Z@aYg+(O>i~DTL zbEa-AR;>5c-GG5K#)y)4Jn%`!eO0ucBa&FkfqAl=^I-t0{>|^r8^l;Jg1RkfF`KB3 z7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A z^dz@!?MA3}bCBXD#_-1!y<`sO_{yq3WV0Q0yq4Z!?X80=0?9FDHAFZ*mrVp-h4Ho_ zDvSK{J!rcZVt!|jtE@Q>PlKAW$z~m5@+APaf|=OcmNXKK(zXr%{h2>)K7EO*vk~s) zXcQ|D7Ut_u&Oje8Es5tAc-&QIU`^9G9OjFM(8CHzpMGD)>dThh#S2v&h0Gep@hmsF zikb;s!&?<+U%MBv&7-qLk#P&=kJ_ugb4mRwx@)$=6=`TiJ0|<7VVC%k^SqO4nC|}s z*#Rd0%HP|qDA{aK5TP=62{T;R#198_OWJ=mkz*0`cgVJS;V#=ew0goyr)-q+M?7~l z+C@JM;T{|7?3IG`c(`GUv}PD_`==e9$#CufgWP)02D&$a-Y2t``n+bY%v#&s+lHC3 zQ{*-tY%8Hxbpkr~2lHGjOqkM{=Z6jyvWfU4lT@sM=6&l_WcM_6EK!y}x%MWQ@dp)~ z)jF38a=RNA@F=|~yiLkt>9-VRNdt}mNhA}^QS?WRnqtSp>~=RW)=|vLEZwzo;iiI; zl_!)a5@uv1gVY%{^AgV2c;mG-VarP%&ItX*ZElsCV~uXw&#M#S{y2D9VRdJG+Vj@w z4ZV!GZ7M^BTqs9mgX>C%KmZ~*s1ZVifKZ^3)2~Q8 z*Ar`i1vH*+BiXD#0jdeb=z^PlG MwA5<;?v+9R+2IT)y8r+H literal 0 HcmV?d00001 diff --git a/fixtures/test_square.jpg b/testdata/test_square.jpg similarity index 100% rename from fixtures/test_square.jpg rename to testdata/test_square.jpg diff --git a/fixtures/test_svg.jpg b/testdata/test_svg.jpg similarity index 100% rename from fixtures/test_svg.jpg rename to testdata/test_svg.jpg diff --git a/fixtures/transparent.png b/testdata/transparent.png similarity index 100% rename from fixtures/transparent.png rename to testdata/transparent.png diff --git a/fixtures/transparent_trim.png b/testdata/transparent_trim.png similarity index 100% rename from fixtures/transparent_trim.png rename to testdata/transparent_trim.png diff --git a/fixtures/vertical.jpg b/testdata/vertical.jpg similarity index 100% rename from fixtures/vertical.jpg rename to testdata/vertical.jpg diff --git a/fixtures/vertical.webp b/testdata/vertical.webp similarity index 100% rename from fixtures/vertical.webp rename to testdata/vertical.webp diff --git a/type_test.go b/type_test.go index 5bbb23d..a5168b5 100644 --- a/type_test.go +++ b/type_test.go @@ -22,7 +22,7 @@ func TestDeterminateImageType(t *testing.T) { } for _, file := range files { - img, _ := os.Open(path.Join("fixtures", file.name)) + img, _ := os.Open(path.Join("testdata", file.name)) buf, _ := ioutil.ReadAll(img) defer img.Close() @@ -49,7 +49,7 @@ func TestDeterminateImageTypeName(t *testing.T) { } for _, file := range files { - img, _ := os.Open(path.Join("fixtures", file.name)) + img, _ := os.Open(path.Join("testdata", file.name)) buf, _ := ioutil.ReadAll(img) defer img.Close() diff --git a/vendor/github.com/tj/go-debug/History.md b/vendor/github.com/tj/go-debug/History.md new file mode 100644 index 0000000..318ceb4 --- /dev/null +++ b/vendor/github.com/tj/go-debug/History.md @@ -0,0 +1,21 @@ + +v2.0.0 / 2014-10-22 +================== + + * remove live toggling feature. Closes #10 + +1.1.1 / 2014-07-07 +================== + + * fix: dispose socket. Closes #1 + +1.1.0 / 2014-06-29 +================== + + * add unix domain socket live debugging support + * add support for enabling/disabling at runtime + +0.1.0 / 2014-05-24 +================== + + * add global and debug relative deltas diff --git a/vendor/github.com/tj/go-debug/Makefile b/vendor/github.com/tj/go-debug/Makefile new file mode 100644 index 0000000..16bc6d3 --- /dev/null +++ b/vendor/github.com/tj/go-debug/Makefile @@ -0,0 +1,8 @@ + +test: + @go test + +bench: + @go test -bench=. + +.PHONY: bench test \ No newline at end of file diff --git a/vendor/github.com/tj/go-debug/Readme.md b/vendor/github.com/tj/go-debug/Readme.md new file mode 100644 index 0000000..6560af8 --- /dev/null +++ b/vendor/github.com/tj/go-debug/Readme.md @@ -0,0 +1,75 @@ + +# go-debug + + Conditional debug logging for Go libraries. + + View the [docs](http://godoc.org/github.com/tj/go-debug). + +## Installation + +``` +$ go get github.com/tj/go-debug +``` + +## Example + +```go +package main + +import . "github.com/tj/go-debug" +import "time" + +var debug = Debug("single") + +func main() { + for { + debug("sending mail") + debug("send email to %s", "tobi@segment.io") + debug("send email to %s", "loki@segment.io") + debug("send email to %s", "jane@segment.io") + time.Sleep(500 * time.Millisecond) + } +} +``` + +If you run the program with the `DEBUG=*` environment variable you will see: + +``` +15:58:15.115 34us 33us single - sending mail +15:58:15.116 3us 3us single - send email to tobi@segment.io +15:58:15.116 1us 1us single - send email to loki@segment.io +15:58:15.116 1us 1us single - send email to jane@segment.io +15:58:15.620 504ms 504ms single - sending mail +15:58:15.620 6us 6us single - send email to tobi@segment.io +15:58:15.620 4us 4us single - send email to loki@segment.io +15:58:15.620 4us 4us single - send email to jane@segment.io +15:58:16.123 503ms 503ms single - sending mail +15:58:16.123 7us 7us single - send email to tobi@segment.io +15:58:16.123 4us 4us single - send email to loki@segment.io +15:58:16.123 4us 4us single - send email to jane@segment.io +15:58:16.625 501ms 501ms single - sending mail +15:58:16.625 4us 4us single - send email to tobi@segment.io +15:58:16.625 4us 4us single - send email to loki@segment.io +15:58:16.625 5us 5us single - send email to jane@segment.io +``` + +A timestamp and two deltas are displayed. The timestamp consists of hour, minute, second and microseconds. The left-most delta is relative to the previous debug call of any name, followed by a delta specific to that debug function. These may be useful to identify timing issues and potential bottlenecks. + +## The DEBUG environment variable + + Executables often support `--verbose` flags for conditional logging, however + libraries typically either require altering your code to enable logging, + or simply omit logging all together. go-debug allows conditional logging + to be enabled via the __DEBUG__ environment variable, where one or more + patterns may be specified. + + For example suppose your application has several models and you want + to output logs for users only, you might use `DEBUG=models:user`. In contrast + if you wanted to see what all database activity was you might use `DEBUG=models:*`, + or if you're love being swamped with logs: `DEBUG=*`. You may also specify a list of names delimited by a comma, for example `DEBUG=mongo,redis:*`. + + The name given _should_ be the package name, however you can use whatever you like. + +# License + +MIT \ No newline at end of file diff --git a/vendor/github.com/tj/go-debug/debug.go b/vendor/github.com/tj/go-debug/debug.go new file mode 100644 index 0000000..016ca46 --- /dev/null +++ b/vendor/github.com/tj/go-debug/debug.go @@ -0,0 +1,128 @@ +package debug + +import ( + "fmt" + "io" + "math/rand" + "os" + "regexp" + "strconv" + "strings" + "sync" + "time" +) + +var ( + writer io.Writer = os.Stderr + reg *regexp.Regexp + m sync.Mutex + enabled = false +) + +// Debugger function. +type DebugFunction func(string, ...interface{}) + +// Terminal colors used at random. +var colors []string = []string{ + "31", + "32", + "33", + "34", + "35", + "36", +} + +// Initialize with DEBUG environment variable. +func init() { + env := os.Getenv("DEBUG") + + if "" != env { + Enable(env) + } +} + +// SetWriter replaces the default of os.Stderr with `w`. +func SetWriter(w io.Writer) { + m.Lock() + defer m.Unlock() + writer = w +} + +// Disable all pattern matching. This function is thread-safe. +func Disable() { + m.Lock() + defer m.Unlock() + enabled = false +} + +// Enable the given debug `pattern`. Patterns take a glob-like form, +// for example if you wanted to enable everything, just use "*", or +// if you had a library named mongodb you could use "mongodb:connection", +// or "mongodb:*". Multiple matches can be made with a comma, for +// example "mongo*,redis*". +// +// This function is thread-safe. +func Enable(pattern string) { + m.Lock() + defer m.Unlock() + pattern = regexp.QuoteMeta(pattern) + pattern = strings.Replace(pattern, "\\*", ".*?", -1) + pattern = strings.Replace(pattern, ",", "|", -1) + pattern = "^(" + pattern + ")$" + reg = regexp.MustCompile(pattern) + enabled = true +} + +// Debug creates a debug function for `name` which you call +// with printf-style arguments in your application or library. +func Debug(name string) DebugFunction { + prevGlobal := time.Now() + color := colors[rand.Intn(len(colors))] + prev := time.Now() + + return func(format string, args ...interface{}) { + if !enabled { + return + } + + if !reg.MatchString(name) { + return + } + + d := deltas(prevGlobal, prev, color) + fmt.Fprintf(writer, d+" \033["+color+"m"+name+"\033[0m - "+format+"\n", args...) + prevGlobal = time.Now() + prev = time.Now() + } +} + +// Return formatting for deltas. +func deltas(prevGlobal, prev time.Time, color string) string { + now := time.Now() + global := now.Sub(prevGlobal).Nanoseconds() + delta := now.Sub(prev).Nanoseconds() + ts := now.UTC().Format("15:04:05.000") + deltas := fmt.Sprintf("%s %-6s \033["+color+"m%-6s", ts, humanizeNano(global), humanizeNano(delta)) + return deltas +} + +// Humanize nanoseconds to a string. +func humanizeNano(n int64) string { + var suffix string + + switch { + case n > 1e9: + n /= 1e9 + suffix = "s" + case n > 1e6: + n /= 1e6 + suffix = "ms" + case n > 1e3: + n /= 1e3 + suffix = "us" + default: + suffix = "ns" + } + + return strconv.Itoa(int(n)) + suffix +} diff --git a/vendor/github.com/tj/go-debug/debug_test.go b/vendor/github.com/tj/go-debug/debug_test.go new file mode 100644 index 0000000..7ce2764 --- /dev/null +++ b/vendor/github.com/tj/go-debug/debug_test.go @@ -0,0 +1,152 @@ +package debug + +import "testing" +import "strings" +import "bytes" +import "time" + +func assertContains(t *testing.T, str, substr string) { + if !strings.Contains(str, substr) { + t.Fatalf("expected %q to contain %q", str, substr) + } +} + +func assertNotContains(t *testing.T, str, substr string) { + if strings.Contains(str, substr) { + t.Fatalf("expected %q to not contain %q", str, substr) + } +} + +func TestDefault(t *testing.T) { + var b []byte + buf := bytes.NewBuffer(b) + SetWriter(buf) + + debug := Debug("foo") + debug("something") + debug("here") + debug("whoop") + + if buf.Len() != 0 { + t.Fatalf("buffer should be empty") + } +} + +func TestEnable(t *testing.T) { + var b []byte + buf := bytes.NewBuffer(b) + SetWriter(buf) + + Enable("foo") + + debug := Debug("foo") + debug("something") + debug("here") + debug("whoop") + + if buf.Len() == 0 { + t.Fatalf("buffer should have output") + } + + str := string(buf.Bytes()) + assertContains(t, str, "something") + assertContains(t, str, "here") + assertContains(t, str, "whoop") +} + +func TestMultipleOneEnabled(t *testing.T) { + var b []byte + buf := bytes.NewBuffer(b) + SetWriter(buf) + + Enable("foo") + + foo := Debug("foo") + foo("foo") + + bar := Debug("bar") + bar("bar") + + if buf.Len() == 0 { + t.Fatalf("buffer should have output") + } + + str := string(buf.Bytes()) + assertContains(t, str, "foo") + assertNotContains(t, str, "bar") +} + +func TestMultipleEnabled(t *testing.T) { + var b []byte + buf := bytes.NewBuffer(b) + SetWriter(buf) + + Enable("foo,bar") + + foo := Debug("foo") + foo("foo") + + bar := Debug("bar") + bar("bar") + + if buf.Len() == 0 { + t.Fatalf("buffer should have output") + } + + str := string(buf.Bytes()) + assertContains(t, str, "foo") + assertContains(t, str, "bar") +} + +func TestEnableDisable(t *testing.T) { + var b []byte + buf := bytes.NewBuffer(b) + SetWriter(buf) + + Enable("foo,bar") + Disable() + + foo := Debug("foo") + foo("foo") + + bar := Debug("bar") + bar("bar") + + if buf.Len() != 0 { + t.Fatalf("buffer should not have output") + } +} + +func ExampleEnable() { + Enable("mongo:connection") + Enable("mongo:*") + Enable("foo,bar,baz") + Enable("*") +} + +func ExampleDebug() { + var debug = Debug("single") + + for { + debug("sending mail") + debug("send email to %s", "tobi@segment.io") + debug("send email to %s", "loki@segment.io") + debug("send email to %s", "jane@segment.io") + time.Sleep(500 * time.Millisecond) + } +} + +func BenchmarkDisabled(b *testing.B) { + debug := Debug("something") + for i := 0; i < b.N; i++ { + debug("stuff") + } +} + +func BenchmarkNonMatch(b *testing.B) { + debug := Debug("something") + Enable("nonmatch") + for i := 0; i < b.N; i++ { + debug("stuff") + } +} diff --git a/vendor/github.com/tj/go-debug/example/multiple.go b/vendor/github.com/tj/go-debug/example/multiple.go new file mode 100644 index 0000000..81c3308 --- /dev/null +++ b/vendor/github.com/tj/go-debug/example/multiple.go @@ -0,0 +1,25 @@ +package main + +import . "github.com/visionmedia/go-debug" +import "time" + +var a = Debug("multiple:a") +var b = Debug("multiple:b") +var c = Debug("multiple:c") + +func work(debug DebugFunction, delay time.Duration) { + for { + debug("doing stuff") + time.Sleep(delay) + } +} + +func main() { + q := make(chan bool) + + go work(a, 1000*time.Millisecond) + go work(b, 250*time.Millisecond) + go work(c, 100*time.Millisecond) + + <-q +} diff --git a/vendor/github.com/tj/go-debug/example/single.go b/vendor/github.com/tj/go-debug/example/single.go new file mode 100644 index 0000000..fccfe33 --- /dev/null +++ b/vendor/github.com/tj/go-debug/example/single.go @@ -0,0 +1,16 @@ +package main + +import . "github.com/visionmedia/go-debug" +import "time" + +var debug = Debug("single") + +func main() { + for { + debug("sending mail") + debug("send email to %s", "tobi@segment.io") + debug("send email to %s", "loki@segment.io") + debug("send email to %s", "jane@segment.io") + time.Sleep(500 * time.Millisecond) + } +} diff --git a/vips_test.go b/vips_test.go index 9972fdb..d8bd2b2 100644 --- a/vips_test.go +++ b/vips_test.go @@ -163,7 +163,7 @@ func TestVipsMemory(t *testing.T) { } func readImage(file string) []byte { - img, _ := os.Open(path.Join("fixtures", file)) + img, _ := os.Open(path.Join("testdata", file)) buf, _ := ioutil.ReadAll(img) defer img.Close() return buf