Просмотр исходного кода

Drop y/n and on/off as booleans per YAML 1.2.

Gustavo Niemeyer 7 лет назад
Родитель
Сommit
b145382a4c
2 измененных файлов с 2 добавлено и 21 удалено
  1. 2 17
      decode_test.go
  2. 0 4
      resolve.go

+ 2 - 17
decode_test.go

@@ -9,7 +9,7 @@ import (
 	"time"
 
 	. "gopkg.in/check.v1"
-	"gopkg.in/yaml.v2"
+	"gopkg.in/niemeyer/ynext.v3"
 )
 
 var unmarshalIntTest = 123
@@ -95,20 +95,8 @@ var unmarshalTests = []struct {
 
 	// Bools from spec
 	{
-		"canonical: y",
+		"canonical: true",
 		map[string]interface{}{"canonical": true},
-	}, {
-		"answer: NO",
-		map[string]interface{}{"answer": false},
-	}, {
-		"logical: True",
-		map[string]interface{}{"logical": true},
-	}, {
-		"option: on",
-		map[string]interface{}{"option": true},
-	}, {
-		"option: on",
-		map[string]bool{"option": true},
 	},
 	// Ints from spec
 	{
@@ -255,9 +243,6 @@ var unmarshalTests = []struct {
 		&struct {
 			B int "a"
 		}{1},
-	}, {
-		"a: y",
-		&struct{ A bool }{true},
 	},
 
 	// Some cross type conversions

+ 0 - 4
resolve.go

@@ -34,12 +34,8 @@ func init() {
 		tag string
 		l   []string
 	}{
-		{true, yaml_BOOL_TAG, []string{"y", "Y", "yes", "Yes", "YES"}},
 		{true, yaml_BOOL_TAG, []string{"true", "True", "TRUE"}},
-		{true, yaml_BOOL_TAG, []string{"on", "On", "ON"}},
-		{false, yaml_BOOL_TAG, []string{"n", "N", "no", "No", "NO"}},
 		{false, yaml_BOOL_TAG, []string{"false", "False", "FALSE"}},
-		{false, yaml_BOOL_TAG, []string{"off", "Off", "OFF"}},
 		{nil, yaml_NULL_TAG, []string{"", "~", "null", "Null", "NULL"}},
 		{math.NaN(), yaml_FLOAT_TAG, []string{".nan", ".NaN", ".NAN"}},
 		{math.Inf(+1), yaml_FLOAT_TAG, []string{".inf", ".Inf", ".INF"}},