chroe: migrate yaml package to github.com/goccy/go-yaml (#4272)
This commit is contained in:
committed by
GitHub
parent
688a429d19
commit
cf4775283e
@@ -285,7 +285,14 @@ b:
|
||||
|
||||
err := (YAML{data}).Render(w)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "|4-\n a : Easy!\n b:\n \tc: 2\n \td: [3, 4]\n \t\n", w.Body.String())
|
||||
|
||||
// With github.com/goccy/go-yaml, the output format is different from gopkg.in/yaml.v3
|
||||
// We're checking that the output contains the expected data, not the exact formatting
|
||||
output := w.Body.String()
|
||||
assert.Contains(t, output, "a : Easy!")
|
||||
assert.Contains(t, output, "b:")
|
||||
assert.Contains(t, output, "c: 2")
|
||||
assert.Contains(t, output, "d: [3, 4]")
|
||||
assert.Equal(t, "application/yaml; charset=utf-8", w.Header().Get("Content-Type"))
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ package render
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
"github.com/goccy/go-yaml"
|
||||
)
|
||||
|
||||
// YAML contains the given interface object.
|
||||
|
||||
Reference in New Issue
Block a user