add validation error type, fix tests, add number tests
This commit is contained in:
+5
-2
@@ -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 {
|
||||
|
||||
+5
-2
@@ -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 {
|
||||
|
||||
+5
-2
@@ -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 {
|
||||
|
||||
+5
-2
@@ -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
|
||||
}
|
||||
|
||||
+5
-2
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user