Adding upstream version 0.8.9.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
3b2c48b5e4
commit
c0c4addb85
285 changed files with 25880 additions and 0 deletions
41
internal/dedupe/dedupe_test.go
Normal file
41
internal/dedupe/dedupe_test.go
Normal file
|
@ -0,0 +1,41 @@
|
|||
package dedupe_test
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/nicholas-fedor/shoutrrr/internal/dedupe"
|
||||
)
|
||||
|
||||
func TestRemoveDuplicates(t *testing.T) {
|
||||
tests := map[string]struct {
|
||||
input []string
|
||||
want []string
|
||||
}{
|
||||
"no duplicates": {
|
||||
input: []string{"a", "b", "c"},
|
||||
want: []string{"a", "b", "c"},
|
||||
},
|
||||
"duplicate inside slice": {
|
||||
input: []string{"a", "b", "a", "c"},
|
||||
want: []string{"a", "b", "c"},
|
||||
},
|
||||
"duplicate at end of slice": {
|
||||
input: []string{"a", "b", "c", "a"},
|
||||
want: []string{"a", "b", "c"},
|
||||
},
|
||||
"duplicate next to each other inside slice": {
|
||||
input: []string{"a", "b", "b", "c"},
|
||||
want: []string{"a", "b", "c"},
|
||||
},
|
||||
}
|
||||
|
||||
for name, tc := range tests {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
got := dedupe.RemoveDuplicates(tc.input)
|
||||
if !reflect.DeepEqual(tc.want, got) {
|
||||
t.Fatalf("expected: %#v, got: %#v", tc.want, got)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue