@@ -269,3 +269,32 @@ func TestIsIteratee(t *testing.T) {
269
269
270
270
is .False (IsIteratee (nil ))
271
271
}
272
+
273
+ func TestIsFunction (t * testing.T ) {
274
+ is := assert .New (t )
275
+
276
+ is .False (IsFunction (nil ))
277
+ is .False (IsFunction ("" ))
278
+ is .True (IsFunction (func () {}))
279
+ is .True (IsFunction (func (string , string , string ) bool { return false }, 3 ))
280
+ is .False (IsFunction (func (string , string , string ) bool { return false }, 3 , 0 ))
281
+ is .True (IsFunction (func (string , string , string ) (bool , error ) { return false , nil }, 3 , 2 ))
282
+ }
283
+
284
+ func TestIsPredicate (t * testing.T ) {
285
+ is := assert .New (t )
286
+
287
+ is .False (IsPredicate (nil ))
288
+ is .False (IsPredicate ("" ))
289
+ is .False (IsPredicate (func () {}))
290
+ is .False (IsPredicate (func () bool { return false }))
291
+ is .True (IsPredicate (func (int ) bool { return false }))
292
+ is .True (IsPredicate (func (int ) bool { return false }, nil ))
293
+ is .False (IsPredicate (func (int ) bool { return false }, reflect .TypeOf ("" )))
294
+ is .True (IsPredicate (func (int ) bool { return false }, reflect .TypeOf (0 )))
295
+ is .False (IsPredicate (func (int , string ) bool { return false }, reflect .TypeOf ("" )))
296
+ is .False (IsPredicate (func (int , string ) bool { return false }, reflect .TypeOf ("" ), reflect .TypeOf (0 )))
297
+ is .True (IsPredicate (func (int , string ) bool { return false }, reflect .TypeOf (0 ), reflect .TypeOf ("" )))
298
+ is .False (IsPredicate (func (struct {}, string ) bool { return false }, reflect .TypeOf (0 ), reflect .TypeOf ("" )))
299
+ is .True (IsPredicate (func (struct {}, string ) bool { return false }, nil , reflect .TypeOf ("" )))
300
+ }
0 commit comments