Docker template generator
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

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. }