(extraFiles ...testFile)
| 14 | } |
| 15 | |
| 16 | func createTestFS(extraFiles ...testFile) fs.FS { |
| 17 | mapFS := fstest.MapFS{ |
| 18 | "layout.html": &fstest.MapFile{Data: []byte(`<html><body>{{render}}<br>{{partial "partial2.html" .Age}}</body></html>`)}, |
| 19 | "view.html": &fstest.MapFile{Data: []byte(`Hello, {{.Name}}!<br>{{partial "partial.html" .Location}}`)}, |
| 20 | "partial.html": &fstest.MapFile{Data: []byte(`Location: {{.}}`)}, |
| 21 | "partial2.html": &fstest.MapFile{Data: []byte(`Age: {{.}}`)}, |
| 22 | "skip.txt": &fstest.MapFile{}, |
| 23 | ".hidden_file": &fstest.MapFile{}, |
| 24 | ".hidden/.file": &fstest.MapFile{}, |
| 25 | } |
| 26 | for _, f := range extraFiles { |
| 27 | mapFS[f.name] = &fstest.MapFile{Data: []byte(f.data)} |
| 28 | } |
| 29 | return mapFS |
| 30 | } |
| 31 | |
| 32 | func TestNew(t *testing.T) { |
| 33 | defer func() { |
no outgoing calls
no test coverage detected