forked from devfeel/dotweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdotweb_test.go
43 lines (35 loc) · 924 Bytes
/
dotweb_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
package dotweb
import (
"testing"
)
// 以下为功能测试
// 测试RunMode函数无配置文件时的返回值
func Test_RunMode_1(t *testing.T) {
app := New()
runMode := app.RunMode()
t.Log("RunMode:", runMode)
}
// 测试RunMode函数有配置文件时的返回值
func Test_RunMode_2(t *testing.T) {
runModes := []string{"dev", "development", "prod", "production"}
app := New()
for _, value := range runModes {
app.Config.App.RunMode = value
runMode := app.RunMode()
t.Log("runModes value:", value, "RunMode:", runMode)
}
}
//测试IsDevelopmentMode函数
func Test_IsDevelopmentMode_1(t *testing.T) {
app := New()
app.Config.App.RunMode = "development"
b := app.IsDevelopmentMode()
t.Log("Run IsDevelopmentMode :", b)
}
func Test_IsDevelopmentMode_2(t *testing.T) {
app := New()
app.Config.App.RunMode = "production"
b := app.IsDevelopmentMode()
t.Log("Run IsDevelopmentMode :", b)
}
//