Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sparkprime authored and Yahya Poonawala committed Mar 13, 2015
1 parent f6eb2c9 commit 379ec53
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions helper/schema/field_writer_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions helper/schema/resource_data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ func TestResourceDataGet(t *testing.T) {

Key: "ratio",

Value: []interface{}{0.0},
Value: 0.0,
},

// #21 Float given
Expand All @@ -657,7 +657,7 @@ func TestResourceDataGet(t *testing.T) {

Key: "ratio",

Value: []interface{}{0.5},
Value: 0.5,
},

// #22 Float diff
Expand Down Expand Up @@ -689,7 +689,7 @@ func TestResourceDataGet(t *testing.T) {

Key: "ratio",

Value: []interface{}{33.0},
Value: 33.0,
},
}

Expand Down

0 comments on commit 379ec53

Please sign in to comment.