Browse Source

Add test ensuring [] decodes as zero-length slice.

Reported as #42 and previously fixed in 08859840.
Gustavo Niemeyer 11 years ago
parent
commit
bef53efd0c
1 changed files with 6 additions and 0 deletions
  1. 6 0
      decode_test.go

+ 6 - 0
decode_test.go

@@ -540,6 +540,12 @@ var unmarshalTests = []struct {
 		"a: 1.2.3.4\n",
 		map[string]net.IP{"a": net.IPv4(1, 2, 3, 4)},
 	},
+
+	// Encode empty lists as zero-length slices.
+	{
+		"a: []",
+		&struct{ A []int }{[]int{}},
+	},
 }
 
 type M map[interface{}]interface{}