add conditions to BuildHeaders unit tests
diff --git a/params_test.go b/params_test.go
index cb3b4d2..c158f53 100644
--- a/params_test.go
+++ b/params_test.go
@@ -74,7 +74,7 @@
func TestBuildHeaders(t *testing.T) {
testStruct := struct {
Accept string `h:"Accept"`
- Num int `h:"Number"`
+ Num int `h:"Number,required"`
Style bool `h:"Style"`
}{
Accept: "application/json",
@@ -85,6 +85,17 @@
actual, err := BuildHeaders(&testStruct)
th.CheckNoErr(t, err)
th.CheckDeepEquals(t, expected, actual)
+
+ testStruct.Num = 0
+ _, err = BuildHeaders(&testStruct)
+ if err == nil {
+ t.Errorf("Expected error: 'Required header not set'")
+ }
+
+ _, err = BuildHeaders(map[string]interface{}{"Number": 4})
+ if err == nil {
+ t.Errorf("Expected error: 'Options type is not a struct'")
+ }
}
func TestIsZero(t *testing.T) {