From aa2015ccd08b03c52e8c2020b51ec1e7f767fa05 Mon Sep 17 00:00:00 2001 From: Dave Cunningham Date: Wed, 28 Jan 2015 16:20:14 -0500 Subject: [PATCH] Fix failing tests --- helper/schema/field_writer_map.go | 4 ++-- helper/schema/resource_data_test.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/helper/schema/field_writer_map.go b/helper/schema/field_writer_map.go index 3c9b0bf1a..b9064709f 100644 --- a/helper/schema/field_writer_map.go +++ b/helper/schema/field_writer_map.go @@ -237,13 +237,13 @@ func (w *MapFieldWriter) setPrimitive( if err := mapstructure.Decode(v, &n); err != nil { return fmt.Errorf("%s: %s", k, err) } + set = strconv.FormatInt(int64(n), 10) case TypeFloat: var n float64 if err := mapstructure.Decode(v, &n); err != nil { return fmt.Errorf("%s: %s", k, err) } - - set = strconv.FormatInt(int64(n), 10) + set = strconv.FormatFloat(float64(n), 'G', -1, 64) default: return fmt.Errorf("Unknown type: %#v", schema.Type) } diff --git a/helper/schema/resource_data_test.go b/helper/schema/resource_data_test.go index f62810347..f7b211810 100644 --- a/helper/schema/resource_data_test.go +++ b/helper/schema/resource_data_test.go @@ -633,7 +633,7 @@ func TestResourceDataGet(t *testing.T) { Key: "ratio", - Value: []interface{}{0.0}, + Value: 0.0, }, // #21 Float given @@ -657,7 +657,7 @@ func TestResourceDataGet(t *testing.T) { Key: "ratio", - Value: []interface{}{0.5}, + Value: 0.5, }, // #22 Float diff @@ -689,7 +689,7 @@ func TestResourceDataGet(t *testing.T) { Key: "ratio", - Value: []interface{}{33.0}, + Value: 33.0, }, }