(t *testing.T)
| 313 | } |
| 314 | |
| 315 | func TestDisallowDirectLibraryLoading(t *testing.T) { |
| 316 | yamlTplData := []byte(`#@ load("_ytt_lib/data.lib.star", "data")`) |
| 317 | |
| 318 | expectedErr := ` |
| 319 | - cannot load _ytt_lib/data.lib.star: Expected to find file '_ytt_lib/data.lib.star', but did not: Encountered private library '_ytt_lib' |
| 320 | in <toplevel> |
| 321 | tpl.yml:1 | #@ load("_ytt_lib/data.lib.star", "data")` |
| 322 | |
| 323 | filesToProcess := []*files.File{ |
| 324 | files.MustNewFileFromSource(files.NewBytesSource("tpl.yml", yamlTplData)), |
| 325 | files.MustNewFileFromSource(files.NewBytesSource("_ytt_lib/data.lib.star", []byte("data = 3"))), |
| 326 | } |
| 327 | |
| 328 | ui := ui.NewTTY(false) |
| 329 | opts := cmdtpl.NewOptions() |
| 330 | |
| 331 | out := opts.RunWithFiles(cmdtpl.Input{Files: filesToProcess}, ui) |
| 332 | require.EqualError(t, out.Err, expectedErr) |
| 333 | } |
| 334 | |
| 335 | func TestRelativeLoadInLibraries(t *testing.T) { |
| 336 | yamlTplData := []byte(` |
nothing calls this directly
no test coverage detected
searching dependent graphs…