(t *testing.T)
| 628 | } |
| 629 | |
| 630 | func TestRenderDependency(t *testing.T) { |
| 631 | deptpl := `{{define "myblock"}}World{{end}}` |
| 632 | toptpl := `Hello {{template "myblock"}}` |
| 633 | modTime := time.Now() |
| 634 | ch := &chart.Chart{ |
| 635 | Metadata: &chart.Metadata{Name: "outerchart"}, |
| 636 | Templates: []*common.File{ |
| 637 | {Name: "templates/outer", ModTime: modTime, Data: []byte(toptpl)}, |
| 638 | }, |
| 639 | } |
| 640 | ch.AddDependency(&chart.Chart{ |
| 641 | Metadata: &chart.Metadata{Name: "innerchart"}, |
| 642 | Templates: []*common.File{ |
| 643 | {Name: "templates/inner", ModTime: modTime, Data: []byte(deptpl)}, |
| 644 | }, |
| 645 | }) |
| 646 | |
| 647 | out, err := Render(ch, map[string]any{}) |
| 648 | if err != nil { |
| 649 | t.Fatalf("failed to render chart: %s", err) |
| 650 | } |
| 651 | |
| 652 | if len(out) != 2 { |
| 653 | t.Errorf("Expected 2, got %d", len(out)) |
| 654 | } |
| 655 | |
| 656 | expect := "Hello World" |
| 657 | if out["outerchart/templates/outer"] != expect { |
| 658 | t.Errorf("Expected %q, got %q", expect, out["outer"]) |
| 659 | } |
| 660 | |
| 661 | } |
| 662 | |
| 663 | func TestRenderNestedValues(t *testing.T) { |
| 664 | innerpath := "templates/inner.tpl" |
nothing calls this directly
no test coverage detected
searching dependent graphs…