Docker template generator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config_test.go 815B

12345678910111213141516171819202122232425262728293031
  1. package main
  2. import (
  3. "reflect"
  4. "testing"
  5. )
  6. func Test_splitList(t *testing.T) {
  7. type args struct {
  8. input string
  9. }
  10. tests := []struct {
  11. name string
  12. args args
  13. want []string
  14. }{
  15. {"empty string", args{""}, []string{}},
  16. {"single item", args{"test"}, []string{"test"}},
  17. {"spaces", args{"test1 test2 test3"}, []string{"test1", "test2", "test3"}},
  18. {"commas", args{"test1,test2,test3"}, []string{"test1", "test2", "test3"}},
  19. {"gaps", args{"test1 test2 test3 "}, []string{"test1", "test2", "test3"}},
  20. {"mixed", args{" test1, test2 test3,,,"}, []string{"test1", "test2", "test3"}},
  21. }
  22. for _, tt := range tests {
  23. t.Run(tt.name, func(t *testing.T) {
  24. if got := splitList(tt.args.input); !reflect.DeepEqual(got, tt.want) {
  25. t.Errorf("splitList() = %v, want %v", got, tt.want)
  26. }
  27. })
  28. }
  29. }