-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdoc.go
40 lines (40 loc) · 1.04 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Package is is a mini testing helper.
//
// func TestSomething(t *testing.T) {
// is := is.New(t)
// obj, err := MethodBeingTested()
// is.OK(obj, err) // list of objects, all must be OK
// is.Equal(obj, "Hello world")
// }
//
// OK
//
// is.OK asserts that the specified object is OK, which means
// different things for different types:
//
// bool - OK means not false
// int - OK means not zero
// error - OK means nil
// string - OK means not ""
// func() - OK means does not panic
// everything else - OK means not nil
//
// Equality
//
// is.Equal asserts that two objects are effectively equal.
//
// Panics
//
// is.Panic and is.PanicWith asserts that the func() will panic.
// PanicWith specifies the panic text that is expected:
//
// func TestInvalidArgs(t *testing.T) {
// is := is.New(t)
// is.Panic(func(){
// SomeMethod(1)
// })
// is.PanicWith("invalid args, both cannot be nil", func(){
// OtherMethod(nil, nil)
// })
// }
package is