MCPcopy
hub / github.com/EngoEngine/engo / TestFilesMultipleLoad

Function TestFilesMultipleLoad

assets_test.go:92–125  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

90}
91
92func TestFilesMultipleLoad(t *testing.T) {
93 Files.Register(".test", &testLoader{})
94
95 content := []byte("testing")
96 dir, err := ioutil.TempDir(".", "testing")
97 if err != nil {
98 t.Errorf("failed to create temp directory for testing, error: %v", err)
99 }
100 defer os.RemoveAll(dir)
101
102 Files.SetRoot(dir)
103
104 tmpfn := filepath.Join(dir, "test1.test")
105
106 if err = ioutil.WriteFile(tmpfn, content, 0666); err != nil {
107 t.Errorf("failed to create temp file for testing, file: %v, error: %v", tmpfn, err)
108 }
109
110 tmpfn = filepath.Join(dir, "test2.test")
111
112 if err = ioutil.WriteFile(tmpfn, content, 0666); err != nil {
113 t.Errorf("failed to create temp file for testing, file: %v, error: %v", tmpfn, err)
114 }
115
116 tmpfn = filepath.Join(dir, "test3.test")
117
118 if err = ioutil.WriteFile(tmpfn, content, 0666); err != nil {
119 t.Errorf("failed to create temp file for testing, file: %v, error: %v", tmpfn, err)
120 }
121
122 if err = Files.Load("test1.test", "test2.test", "test3.test"); err != nil {
123 t.Errorf("could not load test file %v, error: %v", "test1.test", err)
124 }
125}
126
127func TestFilesLoadNotExist(t *testing.T) {
128 Files.Register(".test", &testLoader{})

Callers

nothing calls this directly

Calls 3

SetRootMethod · 0.65
LoadMethod · 0.65
RegisterMethod · 0.45

Tested by

no test coverage detected