(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func 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") |
| 17 | func1: #@ func1() |
| 18 | func2: #@ func2() |
| 19 | func3: #@ func3()`) |
| 20 | |
| 21 | configLibData := []byte(` |
| 22 | #@ def func1(): |
| 23 | func1: true |
| 24 | #@ end`) |
| 25 | |
| 26 | dirConfigLibData := []byte(` |
| 27 | #@ load("/config.lib.yml", "func1") |
| 28 | #@ def func2(): |
| 29 | func2: #@ func1() |
| 30 | #@ end`) |
| 31 | |
| 32 | expectedYAMLTplData := `func1: |
| 33 | func1: true |
| 34 | func2: |
| 35 | func2: |
| 36 | func1: true |
| 37 | func3: |
| 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 | |
| 51 | func TestLoadAbsWithinYttLibDirectory(t *testing.T) { |
| 52 | configTplData := []byte(` |
nothing calls this directly
no test coverage detected
searching dependent graphs…