Update yaml test cases to reflect fact yaml.v3 uses 4 spaces by default

Though this can be customised, see: https://ubuntu.com/blog/api-v3-of-the-yaml-package-for-go-is-available

Signed-off-by: Silas Davis <silas@monax.io>
pull/7963/head
Silas Davis 6 years ago
parent f610f74218
commit 5bad22a4df
No known key found for this signature in database
GPG Key ID: 4CBFD0FF2D395219

@ -1,6 +1,6 @@
package yaml package yaml
import "gopkg.in/yaml.v2" import "gopkg.in/yaml.v3"
// Convert JSON to YAML. // Convert JSON to YAML.
func FromJSON(j []byte) ([]byte, error) { func FromJSON(j []byte) ([]byte, error) {

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v3"
) )
func ToJSON(y []byte) ([]byte, error) { func ToJSON(y []byte) ([]byte, error) {

@ -76,8 +76,8 @@ func TestYAMLToJSON(t *testing.T) {
}, { }, {
"- t: a\n" + "- t: a\n" +
"- t:\n" + "- t:\n" +
" b: 1\n" + " b: 1\n" +
" c: 2\n", " c: 2\n",
`[{"t":"a"},{"t":{"b":1,"c":2}}]`, `[{"t":"a"},{"t":{"b":1,"c":2}}]`,
nil, nil,
}, { }, {
@ -85,8 +85,8 @@ func TestYAMLToJSON(t *testing.T) {
`[{"t":"a"},{"t":{"b":1,"c":2}}]`, `[{"t":"a"},{"t":{"b":1,"c":2}}]`,
strPtr("- t: a\n" + strPtr("- t: a\n" +
"- t:\n" + "- t:\n" +
" b: 1\n" + " b: 1\n" +
" c: 2\n"), " c: 2\n"),
}, { }, {
"- t: \n", "- t: \n",
`[{"t":null}]`, `[{"t":null}]`,

Loading…
Cancel
Save