Przeglądaj źródła

Fix handling of < in values, broken by map merging

Fixes issue #24.
Gustavo Niemeyer 11 lat temu
rodzic
commit
feb4ca7964
3 zmienionych plików z 12 dodań i 1 usunięć
  1. 6 0
      decode_test.go
  2. 6 0
      encode_test.go
  3. 0 1
      resolve.go

+ 6 - 0
decode_test.go

@@ -371,6 +371,12 @@ var unmarshalTests = []struct {
 		"a: 3s",
 		map[string]time.Duration{"a": 3 * time.Second},
 	},
+
+	// Issue #24. 
+	{
+		"a: <foo>",
+		map[string]string{"a": "<foo>"},
+	},
 }
 
 type inlineB struct {

+ 6 - 0
encode_test.go

@@ -219,6 +219,12 @@ var marshalTests = []struct {
 		map[string]time.Duration{"a": 3 * time.Second},
 		"a: 3s\n",
 	},
+
+	// Issue #24. 
+	{
+		map[string]string{"a": "<foo>"},
+		"a: <foo>\n",
+	},
 }
 
 func (s *S) TestMarshal(c *C) {

+ 0 - 1
resolve.go

@@ -27,7 +27,6 @@ func init() {
 		t[int(c)] = 'M' // In map
 	}
 	t[int('.')] = '.' // Float (potentially in map)
-	t[int('<')] = '<' // Merge
 
 	var resolveMapList = []struct {
 		v   interface{}