forked from ixre/gof
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregistry_test.go
More file actions
37 lines (34 loc) · 738 Bytes
/
registry_test.go
File metadata and controls
37 lines (34 loc) · 738 Bytes
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
package gof
import (
"testing"
)
func TestRegistry_Set(t *testing.T) {
r, _ := NewRegistry("./tmp/conf/", ".")
rt := r.Use("core")
key := "config.user_name"
val := rt.Get(key)
if val == nil {
err := rt.Set(key, "jarrysix")
if err != nil {
t.Error(err)
t.FailNow()
}
rt.Flush()
val = rt.Get(key)
}
t.Log("result :", val.(string))
}
func TestRegistryOld(t *testing.T) {
r, _ := NewRegistry("./tmp/conf/", ".")
key := "core.config.user_name"
val := r.Get(key)
node := r.Use("core")
if node.Exists() {
node.Set("description", `
Using the Hello World guide, you’ll create a repository,
start a branch,write comments, and open a pull request.
`)
node.Flush()
}
t.Log("result :", val.(string))
}