File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -49,11 +49,19 @@ func TestSumAll(t *testing.T) {
49
49
}
50
50
51
51
func TestSumAllTails (t * testing.T ) {
52
+ t .Run ("make the sums of some slices" , func (t * testing.T ) {
53
+ got := SumAllTails ([]int {1 , 2 }, []int {0 , 9 })
54
+ want := []int {2 , 9 }
52
55
53
- got := SumAllTails ([]int {1 , 2 }, []int {0 , 9 })
54
- want := []int {2 , 9 }
55
-
56
- if ! reflect .DeepEqual (got , want ) {
57
- t .Errorf ("got %v, want %v" , got , want )
58
- }
56
+ if ! reflect .DeepEqual (got , want ) {
57
+ t .Errorf ("got %v, want %v" , got , want )
58
+ }
59
+ })
60
+ t .Run ("safely sum empty slices" , func (t * testing.T ) {
61
+ got := SumAllTails ([]int {}, []int {3 , 4 , 5 })
62
+ want := []int {0 , 9 }
63
+ if ! reflect .DeepEqual (got , want ) {
64
+ t .Errorf ("got %v, want %v" , got , want )
65
+ }
66
+ })
59
67
}
You can’t perform that action at this time.
0 commit comments