|
@@ -45,15 +45,43 @@ func TestMarshal(t *testing.T) {
|
|
|
|
|
|
for _, field := range fields {
|
|
|
var name string = field.Name
|
|
|
- var got string
|
|
|
- var expect string
|
|
|
+ var isType reflect.Kind = verify_value.FieldByName(name).Kind()
|
|
|
|
|
|
- got = verify_value.FieldByName(name).String()
|
|
|
- expect = config_value.FieldByName(name).String()
|
|
|
+ // t.Logf("%s is %s\n", name, isType)
|
|
|
|
|
|
- if got != expect {
|
|
|
- t.Errorf("For %s Got %s, Expected %s", name, got, expect)
|
|
|
+ if isType == reflect.String {
|
|
|
+ var got, expect string
|
|
|
+
|
|
|
+ got = verify_value.FieldByName(name).String()
|
|
|
+ expect = config_value.FieldByName(name).String()
|
|
|
+
|
|
|
+ if got != expect {
|
|
|
+ t.Errorf("For %s Got %s, Expected %s", name, got, expect)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ if isType == reflect.Bool {
|
|
|
+ var got, expect bool
|
|
|
+
|
|
|
+ got = verify_value.FieldByName(name).Bool()
|
|
|
+ expect = config_value.FieldByName(name).Bool()
|
|
|
+
|
|
|
+ if got != expect {
|
|
|
+ t.Errorf("For %s Got %t, Expected %t", name, got, expect)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if isType == reflect.Int {
|
|
|
+ var got, expect int64
|
|
|
+
|
|
|
+ got = verify_value.FieldByName(name).Int()
|
|
|
+ expect = config_value.FieldByName(name).Int()
|
|
|
+
|
|
|
+ if got != expect {
|
|
|
+ t.Errorf("For %s Got %d, Expected %d", name, got, expect)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|