-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
main_test.go
50 lines (43 loc) · 1014 Bytes
/
main_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"os"
"testing"
)
var themeDir = "./public/themes"
var imageNames = [...]string{"data01.png", "data02.png", "data03.png"}
func TestThemeImages(t *testing.T) {
var err error
_, err = os.Stat(themeDir)
if err != nil {
t.Fatal("themes file is not found : ", err)
}
themedirs, err := os.ReadDir(themeDir)
if err != nil {
t.Fatal("themes file is not found : ", err)
}
for _, themedir := range themedirs {
if themedir.IsDir() {
t.Log("found theme : ", themedir.Name())
files, err := os.ReadDir(themeDir + "/" + themedir.Name())
if err != nil {
t.Log("theme image is not found. skipping,,, : ", err)
continue
}
chkflg := [len(imageNames)]bool{}
for _, file := range files {
if !file.IsDir() {
for i, v := range imageNames {
if file.Name() == v {
chkflg[i] = true
}
}
}
}
for i, v := range chkflg {
if !v {
t.Error(imageNames[i] + " is not found in " + themedir.Name() + "theme")
}
}
}
}
}