From b5dedd1b9efc7a41be93ea048beaad2ea201712e Mon Sep 17 00:00:00 2001 From: Levi Gross Date: Sun, 26 Nov 2017 18:55:54 -0500 Subject: [PATCH] We now include and pass tests Signed-off-by: Levi Gross --- gen/decoder.go | 4 ++-- tests/data.go | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/gen/decoder.go b/gen/decoder.go index 184b229..f7e415f 100644 --- a/gen/decoder.go +++ b/gen/decoder.go @@ -48,8 +48,8 @@ var primitiveStringDecoders = map[reflect.Kind]string{ reflect.Uint32: "in.Uint32Str()", reflect.Uint64: "in.Uint64Str()", reflect.Uintptr: "in.UintptrStr()", - reflect.Float32: "in.Float32()Str", - reflect.Float64: "in.Float64()Str", + reflect.Float32: "in.Float32Str()", + reflect.Float64: "in.Float64Str()", } var customDecoders = map[string]string{ diff --git a/tests/data.go b/tests/data.go index 5f18a98..f6d6653 100644 --- a/tests/data.go +++ b/tests/data.go @@ -38,8 +38,11 @@ type PrimitiveTypes struct { Uint32String uint32 `json:",string"` Uint64String uint64 `json:",string"` - Float32 float32 `json:",string"` - Float64 float64 `json:",string"` + Float32 float32 + Float64 float64 + + Float32String float32 `json:",string"` + Float64String float64 `json:",string"` Ptr *string PtrNil *string @@ -77,6 +80,9 @@ var primitiveTypesValue = PrimitiveTypes{ Float32: 1.5, Float64: math.MaxFloat64, + Float32String: 1.5, + Float64String: math.MaxFloat64, + Ptr: &str, } @@ -110,6 +116,9 @@ var primitiveTypesString = "{" + `"Float32":` + fmt.Sprint(1.5) + `,` + `"Float64":` + fmt.Sprint(math.MaxFloat64) + `,` + + `"Float32String":"` + fmt.Sprint(1.5) + `",` + + `"Float64String":"` + fmt.Sprint(math.MaxFloat64) + `",` + + `"Ptr":"bla",` + `"PtrNil":null` +