MCPcopy Create free account
hub / github.com/abiosoft/mold / createTestFS

Function createTestFS

mold_test.go:16–30  ·  view source on GitHub ↗
(extraFiles ...testFile)

Source from the content-addressed store, hash-verified

14}
15
16func 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
32func TestNew(t *testing.T) {
33 defer func() {

Callers 15

TestNewFunction · 0.85
TestNew_SubFunction · 0.85
TestNew_InvalidSubFunction · 0.85
TestNew_PanicFunction · 0.85
TestNew_LayoutNotFoundFunction · 0.85
TestNew_LayoutParseErrorFunction · 0.85
TestNew_LayoutInvalidExtFunction · 0.85
TestNew_ViewParseErrorFunction · 0.85
TestNew_ExtFunction · 0.85
TestNew_FuncMapFunction · 0.85
TestRenderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected