MCPcopy
hub / github.com/carvel-dev/ytt / TestLoadAbs

Function TestLoadAbs

pkg/cmd/template/cmd_root_library_test.go:12–49  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestLoadAbs(t *testing.T) {
13 configTplData := []byte(`
14#@ load("/config.lib.yml", "func1")
15#@ load("/dir/config.lib.yml", "func2")
16#@ load("dir/config.lib.yml", func3="func2")
17func1: #@ func1()
18func2: #@ func2()
19func3: #@ func3()`)
20
21 configLibData := []byte(`
22#@ def func1():
23func1: true
24#@ end`)
25
26 dirConfigLibData := []byte(`
27#@ load("/config.lib.yml", "func1")
28#@ def func2():
29func2: #@ func1()
30#@ end`)
31
32 expectedYAMLTplData := `func1:
33 func1: true
34func2:
35 func2:
36 func1: true
37func3:
38 func2:
39 func1: true
40`
41
42 filesToProcess := files.NewSortedFiles([]*files.File{
43 files.MustNewFileFromSource(files.NewBytesSource("config.yml", configTplData)),
44 files.MustNewFileFromSource(files.NewBytesSource("config.lib.yml", configLibData)),
45 files.MustNewFileFromSource(files.NewBytesSource("dir/config.lib.yml", dirConfigLibData)),
46 })
47
48 runAndCompare(t, filesToProcess, expectedYAMLTplData)
49}
50
51func TestLoadAbsWithinYttLibDirectory(t *testing.T) {
52 configTplData := []byte(`

Callers

nothing calls this directly

Calls 4

NewSortedFilesFunction · 0.92
MustNewFileFromSourceFunction · 0.92
NewBytesSourceFunction · 0.92
runAndCompareFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…