MCPcopy
hub / github.com/pelletier/go-toml / TestUnmarshal

Function TestUnmarshal

unmarshaler_test.go:460–2512  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

458}
459
460func TestUnmarshal(t *testing.T) {
461 type test struct {
462 target interface{}
463 expected interface{}
464 err bool
465 assert func(t *testing.T, test test)
466 }
467 examples := []struct {
468 skip bool
469 desc string
470 input string
471 gen func() test
472 }{
473 {
474 desc: "kv string",
475 input: `A = "foo"`,
476 gen: func() test {
477 type doc struct {
478 A string
479 }
480
481 return test{
482 target: &doc{},
483 expected: &doc{A: "foo"},
484 }
485 },
486 },
487 {
488 desc: "kv literal string",
489 input: `A = 'foo 🙂 '`,
490 gen: func() test {
491 type doc struct {
492 A string
493 }
494
495 return test{
496 target: &doc{},
497 expected: &doc{A: "foo 🙂 "},
498 }
499 },
500 },
501 {
502 desc: "kv text key",
503 input: `a-1 = "foo"`,
504 gen: func() test {
505 type doc = map[unmarshalTextKey]string
506
507 return test{
508 target: &doc{},
509 expected: &doc{{A: "a", B: "1"}: "foo"},
510 }
511 },
512 },
513 {
514 desc: "table text key",
515 input: `["a-1"]
516foo = "bar"`,
517 gen: func() test {

Callers

nothing calls this directly

Calls 3

EqualFunction · 0.92
ErrorFunction · 0.92
NoErrorFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…