-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgogtm_test.go
60 lines (52 loc) · 1.25 KB
/
gogtm_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
package gogtm_test
import (
"fmt"
"github.com/szydell/gogtm"
)
func ExampleGet() {
data, err := gogtm.Get("^test", "ababababababababa")
if err != nil {
fmt.Println("gogtm.Get failed: ", err.Error())
}
if data == "ababababababababa" {
fmt.Println("Global ^test empty, default value returned")
} else {
fmt.Println("Value of global ^test is: " + data)
}
}
func ExampleKill() {
err := gogtm.Kill("^test")
if err != nil {
fmt.Println("gogtm.Kill failed: ", err.Error())
}
}
func ExampleOrder() {
data, err := gogtm.Order("^test", "")
if err != nil {
fmt.Println("gogtm.Order failed", err.Error())
}
rev, err := gogtm.Order("^test", "-1")
if err != nil {
fmt.Println("gogtm.Order with the reverse direction flag failed", err.Error())
}
fmt.Printf("gogtm.Order returned %s, in the reverse direction returned %s", data, rev)
}
func ExampleQuery() {
data, err := gogtm.Query("^test")
if err != nil {
fmt.Println("gogtm.Query failed", err.Error())
}
fmt.Printf("gogtm.Query returned %s.", data)
}
func ExampleSet() {
err := gogtm.Set("^test", "aaa")
if err != nil {
fmt.Println("gogtm.Set failed: ", err.Error())
}
}
func ExampleZKill() {
err := gogtm.ZKill("^test")
if err != nil {
fmt.Println("gogtm.ZKill failed: ", err.Error())
}
}