(t *testing.T)
| 147 | } |
| 148 | |
| 149 | func TestDataListRelativeToLibraryRoot(t *testing.T) { |
| 150 | yamlTplData := []byte(` |
| 151 | #@ load("@ytt:data", "data") |
| 152 | #@ load("funcs/funcs.lib.yml", "nested_data_list", "nested_data_read") |
| 153 | |
| 154 | rootlist: #@ data.list("/") |
| 155 | rootdata: #@ data.read("/funcs/data") |
| 156 | |
| 157 | nestedlist: #@ nested_data_list() |
| 158 | nesteddata: #@ nested_data_read()`) |
| 159 | |
| 160 | yamlFuncsTplData := []byte(` |
| 161 | #@ load("@ytt:data", "data") |
| 162 | #@ load("funcs.lib.yml", "nested_data_list", "nested_data_read") |
| 163 | |
| 164 | rootlist: #@ data.list("/") |
| 165 | rootdata: #@ data.read("/funcs/data") |
| 166 | |
| 167 | nestedlist: #@ nested_data_list() |
| 168 | nesteddata: #@ nested_data_read() |
| 169 | `) |
| 170 | |
| 171 | expectedYAMLTplData := `rootlist: |
| 172 | - /tpl.yml |
| 173 | - /funcs/funcs.lib.yml |
| 174 | - /funcs/tpl.yml |
| 175 | - /funcs/data |
| 176 | rootdata: |- |
| 177 | data |
| 178 | data |
| 179 | nestedlist: |
| 180 | list: |
| 181 | - /tpl.yml |
| 182 | - /funcs/funcs.lib.yml |
| 183 | - /funcs/tpl.yml |
| 184 | - /funcs/data |
| 185 | nesteddata: |
| 186 | data: |- |
| 187 | data |
| 188 | data |
| 189 | ` |
| 190 | |
| 191 | yamlFuncsData := []byte(` |
| 192 | #@ load("@ytt:data", "data") |
| 193 | |
| 194 | #@ def/end nested_data_list(): |
| 195 | list: #@ data.list("/") |
| 196 | |
| 197 | #@ def/end nested_data_read(): |
| 198 | data: #@ data.read("/funcs/data")`) |
| 199 | |
| 200 | filesToProcess := files.NewSortedFiles([]*files.File{ |
| 201 | files.MustNewFileFromSource(files.NewBytesSource("tpl.yml", yamlTplData)), |
| 202 | files.MustNewFileFromSource(files.NewBytesSource("funcs/funcs.lib.yml", yamlFuncsData)), |
| 203 | files.MustNewFileFromSource(files.NewBytesSource("funcs/tpl.yml", yamlFuncsTplData)), |
| 204 | files.MustNewFileFromSource(files.NewBytesSource("funcs/data", []byte("data\ndata"))), |
| 205 | files.MustNewFileFromSource(files.NewBytesSource("_ytt_lib/lib1/other", []byte("lib1\ndata"))), |
| 206 | }) |
nothing calls this directly
no test coverage detected
searching dependent graphs…