Fix failing tests

This commit is contained in:
Dave Cunningham 2015-01-28 16:20:14 -05:00
parent 3cbf1a3230
commit aa2015ccd0
2 changed files with 5 additions and 5 deletions

View File

@ -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)
}

View File

@ -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,
},
}