本文整理匯總了Golang中github.com/iNamik/go_pkg/compose/maybe.New函數的典型用法代碼示例。如果您正苦於以下問題:Golang New函數的具體用法?Golang New怎麽用?Golang New使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了New函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestGetOrElse_Something
// TestGetOrElse_Something
func TestGetOrElse_Something(t *testing.T) {
m := maybe.New(SOMETHING)
assertGetOrElse(t, m, ELSE, SOMETHING)
}
示例2: TestComposeMap_Increment_Double_Something
// TestComposeMap_Increment_Double_Something
func TestComposeMap_Increment_Double_Something(t *testing.T) {
f := maybe.ComposeMap(double, increment)
_m := maybe.New(2)
m := f(_m)
assertSomethingValue(t, m, 6)
}
示例3: TestComposeFilter_True_Something
// TestComposeFilter_True_Something
func TestComposeFilter_True_Something(t *testing.T) {
f := maybe.ComposeFilter(FilterTrue)
m := maybe.New(SOMETHING)
b := f(m)
assertTrue(t, b)
}
示例4: TestCall_Multi_Nil
// TestCall_Multi_Nil
func TestCall_Multi_Nil(t *testing.T) {
arg1 := maybe.New("one")
arg2 := maybe.Nothing()
m := maybe.Call(MultiArgs_Last, arg1, arg2)
assertNothing(t, m)
}
示例5: TestComposeMap_Empty_Something
// TestComposeMap_Empty_Something
func TestComposeMap_Empty_Something(t *testing.T) {
f := maybe.ComposeMap()
_m := maybe.New(SOMETHING)
m := f(_m)
assertSomething(t, m)
}
示例6: TestCall_Something_Echo
// TestCall_Something_Echo
func TestCall_Something_Echo(t *testing.T) {
_m := maybe.New(SOMETHING)
m := maybe.Call(MapAny_Echo, _m)
assertSomething(t, m)
}
示例7: TestCall_Multi_Something_Last
// TestCall_Multi_Something_Last
func TestCall_Multi_Something_Last(t *testing.T) {
arg1 := maybe.New("one")
arg2 := maybe.New("two")
m := maybe.Call(MultiArgs_Last, arg1, arg2)
assertSomethingValue(t, m, "two")
}
示例8: TestMap_Something_Any_Something
// TestMap_Something_Any_Something
func TestMap_Something_Any_Something(t *testing.T) {
_m := maybe.New(SOMETHING)
m := _m.Map(MapAny_Echo)
assertSomething(t, m)
}
示例9: TestMap_Something_Ok_False
// TestMap_Something_Ok_False
func TestMap_Something_Ok_False(t *testing.T) {
_m := maybe.New(SOMETHING)
m := _m.Map(MapOk_False)
assertNothing(t, m)
}
示例10: TestMap_Something_Nothing
// TestMap_Something_Nothing
func TestMap_Something_Nothing(t *testing.T) {
_m := maybe.New(SOMETHING)
m := _m.Map(MapNothing)
assertNothing(t, m)
}
示例11: TestMap_Something_Something
// TestMap_Something_Something
func TestMap_Something_Something(t *testing.T) {
_m := maybe.New(SOMETHING)
m := _m.Map(MapSomething)
assertSomethingValue(t, m, MAPPED)
}
示例12: TestMap_Something_NonFunc
// TestMap_Something_NonFunc
func TestMap_Something_NonFunc(t *testing.T) {
m := maybe.New(SOMETHING)
f := func() { m.Map(0) } // int 0 is not a func
assertPanic(t, f, MAP_FUNC_ERR)
}
示例13: TestMap_Something_NoReturn
// TestMap_Something_NoReturn
func TestMap_Something_NoReturn(t *testing.T) {
m := maybe.New(SOMETHING)
f := func() { m.Map(Map_NoReturn) }
assertPanic(t, f, MAP_FUNC_RET_ERR)
}
示例14: TestMap_Something_Nil
// TestMap_Something_Nil
func TestMap_Something_Nil(t *testing.T) {
m := maybe.New(SOMETHING)
f := func() { m.Map(nil) }
assertPanic(t, f, MAP_FUNC_ERR)
}
示例15: TestFilter_Something_NoReturn
// TestFilter_Something_NoReturn
func TestFilter_Something_NoReturn(t *testing.T) {
m := maybe.New(SOMETHING)
f := func() { m.Filter(Filter_NoReturn) }
assertPanic(t, f, FILTER_FUNC_ERR)
}