本文整理汇总了Golang中github.com/davelondon/ktest/require.Len函数的典型用法代码示例。如果您正苦于以下问题:Golang Len函数的具体用法?Golang Len怎么用?Golang Len使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Len函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestMalms
func TestMalms(t *testing.T) {
ctx := ke.NewContext(context.Background(), "kego.io/tests/data", nil)
Run(t, ctx, `{
"type": "multi",
"malms": {
"a": {
"b": {"type":"simple", "js": "c"},
"d": {"type":"simple", "js": "e"}
},
"f": {
"g": {"type":"simple", "js": "h"},
"i": {"type":"simple", "js": "j"}
}
}
}`,
TestValue(func(t *testing.T, v interface{}) {
require.Len(t, v.(*data.Multi).Malms, 2)
require.Len(t, v.(*data.Multi).Malms["a"], 2)
require.Len(t, v.(*data.Multi).Malms["f"], 2)
assert.Equal(t, "c", v.(*data.Multi).Malms["a"]["b"].Js)
assert.Equal(t, "e", v.(*data.Multi).Malms["a"]["d"].Js)
assert.Equal(t, "h", v.(*data.Multi).Malms["f"]["g"].Js)
assert.Equal(t, "j", v.(*data.Multi).Malms["f"]["i"].Js)
}),
)
}
示例2: TestAalmss
func TestAalmss(t *testing.T) {
ctx := ke.NewContext(context.Background(), "kego.io/tests/data", nil)
Run(t, ctx, `{
"type": "multi",
"aalmss": [{"a": "b", "c": "d"}, {"e": "f", "g": "h"}]
}`,
TestValue(func(t *testing.T, v interface{}) {
require.Len(t, v.(*data.Multi).Aalmss, 2)
require.Len(t, v.(*data.Multi).Aalmss[0], 2)
require.Len(t, v.(*data.Multi).Aalmss[1], 2)
assert.Equal(t, "b", v.(*data.Multi).Aalmss[0]["a"].Value())
assert.Equal(t, "d", v.(*data.Multi).Aalmss[0]["c"].Value())
assert.Equal(t, "f", v.(*data.Multi).Aalmss[1]["e"].Value())
assert.Equal(t, "h", v.(*data.Multi).Aalmss[1]["g"].Value())
}),
)
}
示例3: TestAalajs
func TestAalajs(t *testing.T) {
ctx := ke.NewContext(context.Background(), "kego.io/tests/data", nil)
Run(t, ctx, `{
"type": "multi",
"aalajs": [["a", "b"],["c", "d"]]
}`,
TestValue(func(t *testing.T, v interface{}) {
require.Len(t, v.(*data.Multi).Aalajs, 2)
require.Len(t, v.(*data.Multi).Aalajs[0], 2)
require.Len(t, v.(*data.Multi).Aalajs[1], 2)
assert.Equal(t, "a", v.(*data.Multi).Aalajs[0][0])
assert.Equal(t, "b", v.(*data.Multi).Aalajs[0][1])
assert.Equal(t, "c", v.(*data.Multi).Aalajs[1][0])
assert.Equal(t, "d", v.(*data.Multi).Aalajs[1][1])
}),
)
}
示例4: TestMalass
func TestMalass(t *testing.T) {
ctx := ke.NewContext(context.Background(), "kego.io/tests/data", nil)
Run(t, ctx, `{
"type": "multi",
"malass": {"a": ["b", "c"], "d": ["e", "f"]}
}`,
TestValue(func(t *testing.T, v interface{}) {
require.Len(t, v.(*data.Multi).Malass, 2)
require.Len(t, v.(*data.Multi).Malass["a"], 2)
require.Len(t, v.(*data.Multi).Malass["d"], 2)
assert.Equal(t, "b", v.(*data.Multi).Malass["a"][0].Value())
assert.Equal(t, "c", v.(*data.Multi).Malass["a"][1].Value())
assert.Equal(t, "e", v.(*data.Multi).Malass["d"][0].Value())
assert.Equal(t, "f", v.(*data.Multi).Malass["d"][1].Value())
}),
)
}
示例5: TestAalas
func TestAalas(t *testing.T) {
ctx := ke.NewContext(context.Background(), "kego.io/tests/data", nil)
Run(t, ctx, `{
"type": "multi",
"aalas": [
[{"type": "simple", "js": "a"}, {"type": "simple", "js": "b"}],
[{"type": "simple", "js": "c"}, {"type": "simple", "js": "d"}]
]
}`,
TestValue(func(t *testing.T, v interface{}) {
require.Len(t, v.(*data.Multi).Aalas, 2)
require.Len(t, v.(*data.Multi).Aalas[0], 2)
require.Len(t, v.(*data.Multi).Aalas[1], 2)
assert.Equal(t, "a", v.(*data.Multi).Aalas[0][0].Js)
assert.Equal(t, "b", v.(*data.Multi).Aalas[0][1].Js)
assert.Equal(t, "c", v.(*data.Multi).Aalas[1][0].Js)
assert.Equal(t, "d", v.(*data.Multi).Aalas[1][1].Js)
}),
)
}
示例6: TestAalss
func TestAalss(t *testing.T) {
ctx := ke.NewContext(context.Background(), "kego.io/tests/data", nil)
Run(t, ctx, `{
"type": "multi",
"aalss": ["a", "b"]
}`,
TestValue(func(t *testing.T, v interface{}) {
require.Len(t, v.(*data.Multi).Aalss, 2)
assert.Equal(t, "a", v.(*data.Multi).Aalss[0].Value())
assert.Equal(t, "b", v.(*data.Multi).Aalss[1].Value())
}),
)
}
示例7: TestAjn
func TestAjn(t *testing.T) {
ctx := ke.NewContext(context.Background(), "kego.io/tests/data", nil)
Run(t, ctx, `{
"type": "multi",
"ajn": [1.1, 1.2]
}`,
TestValue(func(t *testing.T, v interface{}) {
require.Len(t, v.(*data.Multi).Ajn, 2)
assert.Equal(t, 1.1, v.(*data.Multi).Ajn[0])
assert.Equal(t, 1.2, v.(*data.Multi).Ajn[1])
}),
)
}
示例8: TestAjb
func TestAjb(t *testing.T) {
ctx := ke.NewContext(context.Background(), "kego.io/tests/data", nil)
Run(t, ctx, `{
"type": "multi",
"ajb": [true, false]
}`,
TestValue(func(t *testing.T, v interface{}) {
require.Len(t, v.(*data.Multi).Ajb, 2)
assert.Equal(t, true, v.(*data.Multi).Ajb[0])
assert.Equal(t, false, v.(*data.Multi).Ajb[1])
}),
)
}
示例9: TestMjb
func TestMjb(t *testing.T) {
ctx := ke.NewContext(context.Background(), "kego.io/tests/data", nil)
Run(t, ctx, `{
"type": "multi",
"mjb": {"a": true, "b": false}
}`,
TestValue(func(t *testing.T, v interface{}) {
require.Len(t, v.(*data.Multi).Mjb, 2)
assert.Equal(t, true, v.(*data.Multi).Mjb["a"])
assert.Equal(t, false, v.(*data.Multi).Mjb["b"])
}),
)
}
示例10: TestAsi
func TestAsi(t *testing.T) {
ctx := ke.NewContext(context.Background(), "kego.io/tests/data", nil)
Run(t, ctx, `{
"type": "multi",
"asi": [2, 3]
}`,
TestValue(func(t *testing.T, v interface{}) {
require.Len(t, v.(*data.Multi).Asi, 2)
assert.Equal(t, 2, v.(*data.Multi).Asi[0].Value())
assert.Equal(t, 3, v.(*data.Multi).Asi[1].Value())
}),
)
}
示例11: TestMjs
func TestMjs(t *testing.T) {
ctx := ke.NewContext(context.Background(), "kego.io/tests/data", nil)
Run(t, ctx, `{
"type": "multi",
"mjs": {"a": "b", "c": "d"}
}`,
TestValue(func(t *testing.T, v interface{}) {
require.Len(t, v.(*data.Multi).Mjs, 2)
assert.Equal(t, "b", v.(*data.Multi).Mjs["a"])
assert.Equal(t, "d", v.(*data.Multi).Mjs["c"])
}),
)
}
示例12: TestMjn
func TestMjn(t *testing.T) {
ctx := ke.NewContext(context.Background(), "kego.io/tests/data", nil)
Run(t, ctx, `{
"type": "multi",
"mjn": {"a": 1.1, "b": 1.2}
}`,
TestValue(func(t *testing.T, v interface{}) {
require.Len(t, v.(*data.Multi).Mjn, 2)
assert.Equal(t, 1.1, v.(*data.Multi).Mjn["a"])
assert.Equal(t, 1.2, v.(*data.Multi).Mjn["b"])
}),
)
}
示例13: TestMsi
func TestMsi(t *testing.T) {
ctx := ke.NewContext(context.Background(), "kego.io/tests/data", nil)
Run(t, ctx, `{
"type": "multi",
"msi": {"a": 2, "b": 3}
}`,
TestValue(func(t *testing.T, v interface{}) {
require.Len(t, v.(*data.Multi).Msi, 2)
assert.Equal(t, 2, v.(*data.Multi).Msi["a"].Value())
assert.Equal(t, 3, v.(*data.Multi).Msi["b"].Value())
}),
)
}
示例14: TestMsr
func TestMsr(t *testing.T) {
ctx := ke.NewContext(context.Background(), "kego.io/tests/data", nil)
Run(t, ctx, `{
"type": "multi",
"msr": {"a": "a", "b": "system:b"}
}`,
TestValue(func(t *testing.T, v interface{}) {
require.Len(t, v.(*data.Multi).Msr, 2)
assert.Equal(t, "kego.io/tests/data:a", v.(*data.Multi).Msr["a"].Value())
assert.Equal(t, "kego.io/system:b", v.(*data.Multi).Msr["b"].Value())
}),
)
}
示例15: TestMsp
func TestMsp(t *testing.T) {
ctx := ke.NewContext(context.Background(), "kego.io/tests/data", nil)
Run(t, ctx, `{
"type": "multi",
"msp": {
"a": {"type": "system:package", "recursive": true},
"b": {"type": "system:package"}
}
}`,
TestValue(func(t *testing.T, v interface{}) {
require.Len(t, v.(*data.Multi).Msp, 2)
assert.Equal(t, true, v.(*data.Multi).Msp["a"].Recursive)
assert.Equal(t, false, v.(*data.Multi).Msp["b"].Recursive)
}),
)
}