generated from stscoundrel/go-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_test.go
111 lines (86 loc) · 3.44 KB
/
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package main
import (
"errors"
"os"
"testing"
)
func TestCreatesJsonBuild(t *testing.T) {
ToJson()
// JSON
_, err1 := os.Stat("./build/old-swedish-dictionary.json")
_, err2 := os.Stat("./build/old-swedish-dictionary-vol-i-to-iii.json")
_, err3 := os.Stat("./build/old-swedish-dictionary-vol-iv-to-v.json")
_, err4 := os.Stat("./build/old-swedish-medieval-law-dictionary.json")
if errors.Is(err1, os.ErrNotExist) {
t.Error("JSON output file not found in build directory for combined dictionary")
}
if errors.Is(err2, os.ErrNotExist) {
t.Error("JSON output file not found in build directory for Volumes I to III")
}
if errors.Is(err3, os.ErrNotExist) {
t.Error("JSON output file not found in build directory for Volumes IV to V")
}
if errors.Is(err4, os.ErrNotExist) {
t.Error("JSON output file not found in build directory for Schlyters Medieval Law dictionary")
}
}
func TestCreatesMinifiedJsonBuild(t *testing.T) {
ToMinifiedJson()
// Minified JSON
_, err1 := os.Stat("./build/old-swedish-dictionary.min.json")
_, err2 := os.Stat("./build/old-swedish-dictionary-vol-i-to-iii.min.json")
_, err3 := os.Stat("./build/old-swedish-dictionary-vol-iv-to-v.min.json")
_, err4 := os.Stat("./build/old-swedish-medieval-law-dictionary.min.json")
if errors.Is(err1, os.ErrNotExist) {
t.Error("JSON output file not found in build directory for combined dictionary")
}
if errors.Is(err2, os.ErrNotExist) {
t.Error("JSON output file not found in build directory for Volumes I to III")
}
if errors.Is(err3, os.ErrNotExist) {
t.Error("JSON output file not found in build directory for Volumes IV to V")
}
if errors.Is(err4, os.ErrNotExist) {
t.Error("JSON output file not found in build directory for Schlyters Medieval Law dictionary")
}
}
func TestCreatesGzippedJsonBuild(t *testing.T) {
ToCompressedJson()
// Compressed JSON
_, err1 := os.Stat("./build/old-swedish-dictionary.json.gz")
_, err2 := os.Stat("./build/old-swedish-dictionary-vol-i-to-iii.json.gz")
_, err3 := os.Stat("./build/old-swedish-dictionary-vol-iv-to-v.json.gz")
_, err4 := os.Stat("./build/old-swedish-medieval-law-dictionary.json.gz")
if errors.Is(err1, os.ErrNotExist) {
t.Error("GZIP JSON output file not found in build directory for combined dictionary")
}
if errors.Is(err2, os.ErrNotExist) {
t.Error("GZIP JSON output file not found in build directory for Volumes I to III")
}
if errors.Is(err3, os.ErrNotExist) {
t.Error("GZIP JSON output file not found in build directory for Volumes IV to V")
}
if errors.Is(err4, os.ErrNotExist) {
t.Error("GZIP JSON output file not found in build directory for Schlyters Medieval Law dictionary")
}
}
func TestCreatesDSLBuild(t *testing.T) {
ToDsl()
// DSL
_, err1 := os.Stat("./build/old-swedish-dictionary.dsl")
_, err2 := os.Stat("./build/old-swedish-dictionary-vol-i-to-iii.dsl")
_, err3 := os.Stat("./build/old-swedish-dictionary-vol-iv-to-v.dsl")
_, err4 := os.Stat("./build/old-swedish-medieval-law-dictionary.dsl")
if errors.Is(err1, os.ErrNotExist) {
t.Error("DSL output file not found in build directory for combined dictionary")
}
if errors.Is(err2, os.ErrNotExist) {
t.Error("DSL output file not found in build directory for Volumes I to III")
}
if errors.Is(err3, os.ErrNotExist) {
t.Error("DSL output file not found in build directory for Volumes IV to V")
}
if errors.Is(err4, os.ErrNotExist) {
t.Error("DSL output file not found in build directory for Schlyters Medieval Law dictionary")
}
}