11package blurhash_test
22
33import (
4+ "errors"
45 "image"
56 "image/png"
67 "io"
@@ -82,7 +83,7 @@ func TestComponentsInvalidHash(t *testing.T) {
8283 shortHashes := []string {"" , "A" , "ABCDE" }
8384 for _ , hash := range shortHashes {
8485 _ , _ , err := blurhash .Components (hash )
85- if err != blurhash .ErrInvalidHash {
86+ if ! errors . Is ( err , blurhash .ErrInvalidHash ) {
8687 t .Errorf ("short hash %q should return ErrInvalidHash, got %v" , hash , err )
8788 }
8889 }
@@ -94,7 +95,7 @@ func TestComponentsInvalidHash(t *testing.T) {
9495 if err == nil {
9596 t .Fatal ("invalid character should return error" )
9697 }
97- if err != base83 .ErrInvalidInput {
98+ if ! errors . Is ( err , base83 .ErrInvalidInput ) {
9899 t .Errorf ("expected invalid base83 error, got %v" , err )
99100 }
100101 })
@@ -103,13 +104,13 @@ func TestComponentsInvalidHash(t *testing.T) {
103104 // '9' encodes 1x2 components (sizeFlag=9), expecting 4+2*1*2=8 chars
104105 // but we provide only 6 chars
105106 _ , _ , err := blurhash .Components ("900000" )
106- if err != blurhash .ErrInvalidHash {
107+ if ! errors . Is ( err , blurhash .ErrInvalidHash ) {
107108 t .Errorf ("wrong length should return ErrInvalidHash, got %v" , err )
108109 }
109110
110111 // Valid 1x1 hash is 6 chars, but provide 8
111112 _ , _ , err = blurhash .Components ("00000000" )
112- if err != blurhash .ErrInvalidHash {
113+ if ! errors . Is ( err , blurhash .ErrInvalidHash ) {
113114 t .Errorf ("wrong length should return ErrInvalidHash, got %v" , err )
114115 }
115116 })
@@ -173,7 +174,7 @@ func TestDecodeInvalidDimensions(t *testing.T) {
173174 for _ , tt := range tests {
174175 t .Run (tt .name , func (t * testing.T ) {
175176 _ , err := blurhash .Decode (testFixtures [0 ].hash , tt .width , tt .height , 1 )
176- if err != blurhash .ErrInvalidDimensions {
177+ if ! errors . Is ( err , blurhash .ErrInvalidDimensions ) {
177178 t .Errorf ("invalid dimensions should return ErrInvalidDimensions, got %v" , err )
178179 }
179180 })
0 commit comments