Skip to content

Commit

Permalink
Fixed bug #11: Inability to set field to empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Farah committed Jun 6, 2017
1 parent d07e436 commit cdd78af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func updateYaml(args []string) interface{} {

func parseValue(argument string) interface{} {
var value, err interface{}
var inQuotes = argument[0] == '"'
var inQuotes = len(argument) > 0 && argument[0] == '"'
if !inQuotes {
value, err = strconv.ParseFloat(argument, 64)
if err == nil {
Expand Down
1 change: 1 addition & 0 deletions yaml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var parseValueTests = []struct {
{"\"true\"", "true", "boolean as string"},
{"3.4", 3.4, "number"},
{"\"3.4\"", "3.4", "number as string"},
{"", "", "empty string"},
}

func TestParseValue(t *testing.T) {
Expand Down

0 comments on commit cdd78af

Please sign in to comment.