本文整理汇总了Golang中github.com/davelondon/ktest/require.Len函数的典型用法代码示例。如果您正苦于以下问题:Golang Len函数的具体用法?Golang Len怎么用?Golang Len使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Len函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
}),
)
}
开发者ID:kego,项目名称:ke,代码行数:26,代码来源:marshal_map_ext_test.go
示例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())
}),
)
}
开发者ID:kego,项目名称:ke,代码行数:17,代码来源:marshal_array_ext_test.go
示例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])
}),
)
}
开发者ID:kego,项目名称:ke,代码行数:17,代码来源:marshal_array_ext_test.go
示例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())
}),
)
}
开发者ID:kego,项目名称:ke,代码行数:17,代码来源:marshal_map_ext_test.go
示例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)
}),
)
}
开发者ID:kego,项目名称:ke,代码行数:20,代码来源:marshal_array_ext_test.go
示例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())
}),
)
}
开发者ID:kego,项目名称:ke,代码行数:13,代码来源:marshal_array_ext_test.go
示例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])
}),
)
}
开发者ID:kego,项目名称:ke,代码行数:13,代码来源:marshal_array_ext_test.go
示例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])
}),
)
}
开发者ID:kego,项目名称:ke,代码行数:13,代码来源:marshal_array_ext_test.go
示例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"])
}),
)
}
开发者ID:kego,项目名称:ke,代码行数:13,代码来源:marshal_map_ext_test.go
示例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())
}),
)
}
开发者ID:kego,项目名称:ke,代码行数:13,代码来源:marshal_array_ext_test.go
示例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"])
}),
)
}
开发者ID:kego,项目名称:ke,代码行数:13,代码来源:marshal_map_ext_test.go
示例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"])
}),
)
}
开发者ID:kego,项目名称:ke,代码行数:13,代码来源:marshal_map_ext_test.go
示例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())
}),
)
}
开发者ID:kego,项目名称:ke,代码行数:13,代码来源:marshal_map_ext_test.go
示例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())
}),
)
}
开发者ID:kego,项目名称:ke,代码行数:13,代码来源:marshal_map_ext_test.go
示例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)
}),
)
}
开发者ID:kego,项目名称:ke,代码行数:16,代码来源:marshal_map_ext_test.go
示例16: TestAi
func TestAi(t *testing.T) {
ctx := ke.NewContext(context.Background(), "kego.io/tests/data", nil)
Run(t, ctx, `{
"type": "multi",
"ai": [{
"type": "facea",
"a": "a1"
},{
"type": "faceb",
"b": "b1"
}]
}`,
TestValue(func(t *testing.T, v interface{}) {
require.Len(t, v.(*data.Multi).Ai, 2)
assert.Equal(t, "a1", v.(*data.Multi).Ai[0].Face())
assert.Equal(t, "b1", v.(*data.Multi).Ai[1].Face())
}),
)
}
开发者ID:kego,项目名称:ke,代码行数:19,代码来源:marshal_array_ext_test.go
示例17: TestAm
func TestAm(t *testing.T) {
ctx := ke.NewContext(context.Background(), "kego.io/tests/data", nil)
Run(t, ctx, `{
"type": "multi",
"am": [{
"type": "multi",
"js": "a"
},{
"type": "multi",
"js": "b"
}]
}`,
TestValue(func(t *testing.T, v interface{}) {
require.Len(t, v.(*data.Multi).Am, 2)
assert.Equal(t, "a", v.(*data.Multi).Am[0].Js)
assert.Equal(t, "b", v.(*data.Multi).Am[1].Js)
}),
)
}
开发者ID:kego,项目名称:ke,代码行数:19,代码来源:marshal_array_ext_test.go
示例18: TestAri
func TestAri(t *testing.T) {
ctx := ke.NewContext(context.Background(), "kego.io/tests/data", nil)
Run(t, ctx, `{
"type": "multi",
"ari": [{
"type": "system:@string",
"max-length": 2
},{
"type": "system:@bool",
"default": true
}]
}`,
TestValue(func(t *testing.T, v interface{}) {
require.Len(t, v.(*data.Multi).Ari, 2)
assert.Equal(t, 2, v.(*data.Multi).Ari[0].(*system.StringRule).MaxLength.Value())
assert.Equal(t, true, v.(*data.Multi).Ari[1].(*system.BoolRule).Default.Value())
}),
)
}
开发者ID:kego,项目名称:ke,代码行数:19,代码来源:marshal_array_ext_test.go
示例19: TestMnri
func TestMnri(t *testing.T) {
ctx := ke.NewContext(context.Background(), "kego.io/tests/data", nil)
Run(t, ctx, `{
"type": "multi",
"mnri": {
"a": "a",
"b": {"type": "system:int", "value": 1},
"c": {"type": "alajs", "value": ["a", "b", "c"]},
"d": {"type": "almjs", "value": {"a": "b", "c": "d"}}
}
}`,
TestValue(func(t *testing.T, v interface{}) {
require.Len(t, v.(*data.Multi).Mnri, 4)
assert.Equal(t, "a", v.(*data.Multi).Mnri["a"].GetString(ctx).Value())
assert.Equal(t, "1", v.(*data.Multi).Mnri["b"].GetString(ctx).Value())
assert.Equal(t, "abc", v.(*data.Multi).Mnri["c"].GetString(ctx).Value())
assert.Equal(t, "abcd", v.(*data.Multi).Mnri["d"].GetString(ctx).Value())
}),
)
}
开发者ID:kego,项目名称:ke,代码行数:20,代码来源:marshal_map_ext_test.go
注:本文中的github.com/davelondon/ktest/require.Len函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论