Skip to content

Commit

Permalink
Drop y/n and on/off as booleans per YAML 1.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
niemeyer committed Mar 14, 2019
1 parent d8c328e commit b145382
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
19 changes: 2 additions & 17 deletions decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"time"

. "gopkg.in/check.v1"
"gopkg.in/yaml.v2"
"gopkg.in/niemeyer/ynext.v3"
)

var unmarshalIntTest = 123
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -255,9 +243,6 @@ var unmarshalTests = []struct {
&struct {
B int "a"
}{1},
}, {
"a: y",
&struct{ A bool }{true},
},

// Some cross type conversions
Expand Down
4 changes: 0 additions & 4 deletions resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}},
Expand Down

0 comments on commit b145382

Please sign in to comment.