golang.org/x/tools@v0.21.1-0.20240520172518-788d39e776b1/internal/event/keys/util_test.go (about) 1 // Copyright 2023 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package keys 6 7 import "testing" 8 9 func TestJoin(t *testing.T) { 10 type T string 11 type S []T 12 13 tests := []struct { 14 data S 15 want string 16 }{ 17 {S{"a", "b", "c"}, "a,b,c"}, 18 {S{"b", "a", "c"}, "a,b,c"}, 19 {S{"c", "a", "b"}, "a,b,c"}, 20 {nil, ""}, 21 {S{}, ""}, 22 } 23 24 for _, test := range tests { 25 if got := Join(test.data); got != test.want { 26 t.Errorf("Join(%v) = %q, want %q", test.data, got, test.want) 27 } 28 } 29 }