(t *testing.T)
| 22 | ) |
| 23 | |
| 24 | func TestFillSliceWithString(t *testing.T) { |
| 25 | type args struct { |
| 26 | str string |
| 27 | num int |
| 28 | } |
| 29 | tests := []struct { |
| 30 | name string |
| 31 | args args |
| 32 | want *[]string |
| 33 | }{ |
| 34 | { |
| 35 | name: "Fill Slice Test1", |
| 36 | args: args{ |
| 37 | str: "foo", |
| 38 | num: 3, |
| 39 | }, |
| 40 | want: &[]string{"foo", "foo", "foo"}, |
| 41 | }, |
| 42 | { |
| 43 | name: "Fill Slice Test2", |
| 44 | args: args{ |
| 45 | str: "bar", |
| 46 | num: 0, |
| 47 | }, |
| 48 | want: &[]string{}, |
| 49 | }, |
| 50 | } |
| 51 | for _, tt := range tests { |
| 52 | t.Run(tt.name, func(t *testing.T) { |
| 53 | if got := FillSliceWithString(tt.args.str, tt.args.num); !reflect.DeepEqual(got, tt.want) { |
| 54 | t.Errorf("FillSliceWithString() = %v, want %v", got, tt.want) |
| 55 | } |
| 56 | }) |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | func TestSubtractString(t *testing.T) { |
| 61 | testcases := map[string]struct { |
nothing calls this directly
no test coverage detected