MCPcopy
hub / github.com/helm/helm / TestParseIntoFile

Function TestParseIntoFile

pkg/strvals/parser_test.go:714–745  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

712}
713
714func TestParseIntoFile(t *testing.T) {
715 got := map[string]any{}
716 input := "name1=path1"
717 expect := map[string]any{
718 "name1": "value1",
719 }
720 rs2v := func(rs []rune) (any, error) {
721 v := string(rs)
722 if v != "path1" {
723 t.Errorf("%s: runesToVal: Expected value path1, got %s", input, v)
724 return "", nil
725 }
726 return "value1", nil
727 }
728
729 if err := ParseIntoFile(input, got, rs2v); err != nil {
730 t.Fatal(err)
731 }
732
733 y1, err := yaml.Marshal(expect)
734 if err != nil {
735 t.Fatal(err)
736 }
737 y2, err := yaml.Marshal(got)
738 if err != nil {
739 t.Fatalf("Error serializing parsed value: %s", err)
740 }
741
742 if string(y1) != string(y2) {
743 t.Errorf("%s: Expected:\n%s\nGot:\n%s", input, y1, y2)
744 }
745}
746
747func TestToYAML(t *testing.T) {
748 // The TestParse does the hard part. We just verify that YAML formatting is

Callers

nothing calls this directly

Calls 3

ParseIntoFileFunction · 0.85
FatalMethod · 0.80
FatalfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…