-
Notifications
You must be signed in to change notification settings - Fork 24
/
fmt_test.go
112 lines (99 loc) · 1.72 KB
/
fmt_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
112
package ffmt
import (
"time"
"testing"
)
func TestMultiPrint(t *testing.T) {
ff := []func(a ...interface{}) string{
Sputs,
Sp,
Sd,
Sprint,
Spjson,
}
for _, f := range ff {
if f([]interface{}{1, 2}) != f(1, 2) {
t.Fail()
}
}
}
func TestNewOptional(t *testing.T) {
o := NewOptional(0, 0, 0)
o.Print(testdata)
}
func TestPrint(t *testing.T) {
Print(testdata)
}
func TestPuts(t *testing.T) {
Puts(testdata)
}
func TestP(t *testing.T) {
P(testdata)
}
func TestPjson(t *testing.T) {
Pjson(testdata)
}
func TestD(t *testing.T) {
D(testdata)
}
type bbb struct {
A int
}
type T struct {
bbb
Msg string
Msg2 string
Msg3 string
msg string
Msgs []string
Stru []struct {
Msg string
AA [8]int
}
Floats [6]float32
Ints [][]int
Maps map[string]string
B bool
T time.Time
TTT interface{}
TTT2 interface{}
Chan interface{}
Fun interface{}
Uintptr uintptr
Self *T
}
var testdata *T
func init() {
testdata = &T{
bbb{},
"Display a friendly fmt for golang",
"你好",
"hello all hello all hello all hello all hello all hello all ",
"Display ",
[]string{"hello", "world", "bey", "bey", "宽字符制表显示正常仅限等宽字体", "效率又降低了", "哈哈哈哈哈啊", "咳咳", "然而并没有什么卵用"},
[]struct {
Msg string
AA [8]int
}{{}, {
"Test",
[8]int{2222, 3333},
}},
[6]float32{2.1, 3.3},
[][]int{{1, 4, 5, 1, 4, 5, 6, 11999, 0}, {3}, {}},
map[string]string{
"aa": "hi world",
"bb": "bye world",
"一二三四五12345adcde": "1122334455",
"鱼鱼鱼": "yuyuyu",
},
true,
time.Now(),
nil,
(*int)(nil),
make(chan int, 10),
Printf,
0x12345,
nil,
}
testdata.Self = testdata
}