diff --git a/filter_test.go b/filter_test.go index 378b19b..42af4dd 100644 --- a/filter_test.go +++ b/filter_test.go @@ -1,6 +1,9 @@ package qs -import "testing" +import ( + "errors" + "testing" +) func TestReadFilters(t *testing.T) { type TestCase struct { @@ -32,7 +35,7 @@ func TestReadFilters(t *testing.T) { filters, err := ReadStringFilters(tc.Input, nil) - if err != tc.Err { + if !errors.Is(err, tc.Err) { t.Errorf("Expected error %v, got %v", tc.Err, err) } if tc.Err != nil { diff --git a/join_test.go b/join_test.go index 5090c3e..5e6cb1d 100644 --- a/join_test.go +++ b/join_test.go @@ -1,6 +1,9 @@ package qs -import "testing" +import ( + "errors" + "testing" +) func TestReadJoins(t *testing.T) { type TestCase struct { @@ -27,7 +30,7 @@ func TestReadJoins(t *testing.T) { joins, err := ReadStringJoins(tc.Input, nil) - if err != tc.Err { + if !errors.Is(err, tc.Err) { t.Errorf("Expected error %v, got %v", tc.Err, err) } if tc.Err != nil { diff --git a/page_test.go b/page_test.go index c2ade05..9654b3e 100644 --- a/page_test.go +++ b/page_test.go @@ -1,6 +1,9 @@ package qs -import "testing" +import ( + "errors" + "testing" +) func TestReadPage(t *testing.T) { type TestCase struct { @@ -64,7 +67,7 @@ func TestReadPage(t *testing.T) { page, err := ReadStringPage(tc.Input, tc.Opt) - if err != tc.Err { + if !errors.Is(err, tc.Err) { t.Errorf("Expected error %v, got %v", tc.Err, err) } if tc.Err != nil { diff --git a/pagination_test.go b/pagination_test.go index 9947dea..37534ef 100644 --- a/pagination_test.go +++ b/pagination_test.go @@ -1,6 +1,9 @@ package qs -import "testing" +import ( + "errors" + "testing" +) func TestReadPagination(t *testing.T) { type TestCase struct { @@ -34,7 +37,7 @@ func TestReadPagination(t *testing.T) { pag, err := ReadStringPagination(tc.Input, tc.Opt) - if err != tc.Err { + if !errors.Is(err, tc.Err) { t.Errorf("Expected error %v, got %v", tc.Err, err) continue } diff --git a/sort_test.go b/sort_test.go index 1885c99..aa18a8a 100644 --- a/sort_test.go +++ b/sort_test.go @@ -1,6 +1,9 @@ package qs -import "testing" +import ( + "errors" + "testing" +) func TestReadSorts(t *testing.T) { type TestCase struct { @@ -32,7 +35,7 @@ func TestReadSorts(t *testing.T) { sorts, err := ReadStringSorts(tc.Input, nil) - if err != tc.Err { + if !errors.Is(err, tc.Err) { t.Errorf("Expected error %v, got %v", tc.Err, err) } if tc.Err != nil {