(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestHasPrefixes(t *testing.T) { |
| 12 | type args struct { |
| 13 | src string |
| 14 | prefixes []string |
| 15 | } |
| 16 | tests := []struct { |
| 17 | name string |
| 18 | args args |
| 19 | want bool |
| 20 | }{ |
| 21 | { |
| 22 | name: "has prefixes", |
| 23 | args: args{ |
| 24 | src: "abc", |
| 25 | prefixes: []string{"a", "b", "c"}, |
| 26 | }, |
| 27 | want: true, |
| 28 | }, |
| 29 | { |
| 30 | name: "has no matching prefix", |
| 31 | args: args{ |
| 32 | src: "this is a sentence", |
| 33 | prefixes: []string{"that", "x", "y"}, |
| 34 | }, |
| 35 | want: false, |
| 36 | }, |
| 37 | } |
| 38 | for i := range tests { |
| 39 | tt := tests[i] |
| 40 | t.Run(tt.name, func(t *testing.T) { |
| 41 | got := HasPrefixes(tt.args.src, tt.args.prefixes...) |
| 42 | assert.Equal(t, got, tt.want) |
| 43 | }) |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | func TestTruncateString(t *testing.T) { |
| 48 | tests := []struct { |
nothing calls this directly
no test coverage detected