Add empty string to test as well, as suggested by Dave.
diff --git a/encode_test.go b/encode_test.go
index c077343..fe1c497 100644
--- a/encode_test.go
+++ b/encode_test.go
@@ -187,6 +187,7 @@
uint(2),
2.0,
2.1,
+ "",
".1",
".2",
".a",
@@ -222,8 +223,8 @@
last := 0
for i, k := range order {
repr := fmt.Sprint(k)
- if _, ok := k.(string); ok {
- if _, err = strconv.ParseFloat(repr, 32); err == nil {
+ if s, ok := k.(string); ok {
+ if _, err = strconv.ParseFloat(repr, 32); s == "" || err == nil {
repr = `"` + repr + `"`
}
}