File: doc.go

package info (click to toggle)
golang-github-cheekybits-is 0.0~git20150225.0.68e9c06-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 84 kB
  • sloc: makefile: 2
file content (56 lines) | stat: -rw-r--r-- 1,485 bytes parent folder | download | duplicates (3)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// 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)
//       })
//     }
//
// Relaxed
//
// To prevent is from stopping when the first assertion fails,
// you can use is.Relaxed(t), rather than is.New(t).
//
//     func TestManyThings(t *testing.T) {
//       is := is.Relaxed(t)
//       thing, err := Something();
//       is.OK(thing)
//       is.Nil(err)
//       another, err := Another();
//       is.Nil(another)
//       is.Err(err)
//       // all assertions will be tried
//     }
package is