当前仓库属于暂停状态,部分功能使用受限,详情请查阅 仓库状态说明
6 Star 9 Fork 1

wzshiming / ffmt
暂停

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
fmt_test.go 1.72 KB
一键复制 编辑 原始数据 按行查看 历史
wzshiming 提交于 2018-08-15 14:24 . add test
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
}
Go
1
https://gitee.com/wzshiming/ffmt.git
git@gitee.com:wzshiming/ffmt.git
wzshiming
ffmt
ffmt
master

搜索帮助