MCPcopy Create free account
hub / github.com/Monibuca/engine / TestModify

Function TestModify

config/config_test.go:7–32  ·  view source on GitHub ↗

TestModify 测试动态修改配置文件,比较值是否修改,修改后是否有Modify属性

(t *testing.T)

Source from the content-addressed store, hash-verified

5)
6// TestModify 测试动态修改配置文件,比较值是否修改,修改后是否有Modify属性
7func TestModify(t *testing.T) {
8 t.Run(t.Name(), func(t *testing.T) {
9 var defaultValue struct{
10 Subscribe
11 }
12 defaultValue.SubAudio = false
13 var conf Config
14 conf.Parse(&defaultValue)
15 conf.ParseModifyFile(map[string]any{
16 "subscribe": map[string]any{
17 "subaudio": false,
18 },
19 })
20 if conf.Modify != nil {
21 t.Fail()
22 }
23 conf.ParseModifyFile(map[string]any{
24 "subscribe": map[string]any{
25 "subaudio": true,
26 },
27 })
28 if conf.Modify == nil {
29 t.Fail()
30 }
31 })
32}
33
34// TestGlobal 测试全局配置
35func TestGlobal(t *testing.T) {

Callers

nothing calls this directly

Calls 2

ParseMethod · 0.95
ParseModifyFileMethod · 0.95

Tested by

no test coverage detected