MCPcopy
hub / github.com/knadh/koanf / TestLoadMergeYamlJson

Function TestLoadMergeYamlJson

tests/koanf_test.go:383–407  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

381}
382
383func TestLoadMergeYamlJson(t *testing.T) {
384 var (
385 assert = assert.New(t)
386 k = koanf.New(delim)
387 )
388
389 assert.NoError(k.Load(file.Provider(mockYAML), yaml.Parser()),
390 "error loading file")
391 // loading json after yaml causes the intbools to be loaded as []float64
392 assert.NoError(k.Load(file.Provider(mockJSON), yaml.Parser()),
393 "error loading file")
394
395 // checking that there is no issues with expecting it to be an []int64
396 v := k.Int64s("intbools")
397 assert.Len(v, 3)
398
399 defer func() {
400 if err := recover(); err != nil {
401 assert.Failf("panic", "received panic: %v", err)
402 }
403 }()
404
405 v2 := k.MustInt64s("intbools")
406 assert.Len(v2, 3)
407}
408
409func TestLoadMergeJsonYaml(t *testing.T) {
410 var (

Callers

nothing calls this directly

Calls 3

LoadMethod · 0.80
Int64sMethod · 0.80
MustInt64sMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…