sub3 为子测试,只做加法测试
(t *testing.T)
| 32 | |
| 33 | // sub3 为子测试,只做加法测试 |
| 34 | func sub3(t *testing.T) { |
| 35 | var a = 1 |
| 36 | var b = 2 |
| 37 | var expected = 3 |
| 38 | |
| 39 | actual := gotest.Add(a, b) |
| 40 | if actual != expected { |
| 41 | t.Errorf("Add(%d, %d) = %d; expected: %d", a, b, actual, expected) |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | // TestSub 内部调用sub1、sub2和sub3三个子测试 |
| 46 | func TestSub(t *testing.T) { |