MCPcopy
hub / github.com/grafana/dskit / Test_Bytes_MarshalYAML

Function Test_Bytes_MarshalYAML

flagext/bytes_test.go:89–116  ·  flagext/bytes_test.go::Test_Bytes_MarshalYAML
(t *testing.T)

Source from the content-addressed store, hash-verified

87 }
88}
89func Test_Bytes_MarshalYAML(t *testing.T) {
90 for _, tcase := range []struct {
91 input uint64
92 expected string
93 }{
94 {
95 input: (1024 + 512) * 1024 * 1024,
96 expected: "1GiB512MiB\n",
97 },
98 {
99 input: 1024 * 1024 * 1024,
100 expected: "1GiB\n",
101 },
102 {
103 input: 1024 * 1024,
104 expected: "1MiB\n",
105 },
106 {
107 input: 1024,
108 expected: "1KiB\n",
109 },
110 } {
111 b := Bytes(tcase.input)
112 y, err := yaml.Marshal(b)
113 require.NoError(t, err)
114 require.Equal(t, []byte(tcase.expected), y)
115 }
116}
117
118func Test_Bytes_UnmarshalYAML(t *testing.T) {
119 for _, tcase := range []struct {

Callers

nothing calls this directly

Calls 3

BytesTypeAlias · 0.85
MarshalMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected