mirror of
				https://github.com/coredns/coredns.git
				synced 2025-11-03 02:33:21 -05:00 
			
		
		
		
	* plugin/kubernetes: remove bunch a string ops This removes a bunch of appends to where not needed, makes dnsutil.Join take variadic args which removes the need to wrap in a new string slice. Signed-off-by: Miek Gieben <miek@miek.nl> * Fix calls to dnsutil.Join Signed-off-by: Miek Gieben <miek@miek.nl> * Revert these Signed-off-by: Miek Gieben <miek@miek.nl>
		
			
				
	
	
		
			22 lines
		
	
	
		
			496 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			496 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package dnsutil
 | 
						|
 | 
						|
import "testing"
 | 
						|
 | 
						|
func TestJoin(t *testing.T) {
 | 
						|
	tests := []struct {
 | 
						|
		in  []string
 | 
						|
		out string
 | 
						|
	}{
 | 
						|
		{[]string{"bla", "bliep", "example", "org"}, "bla.bliep.example.org."},
 | 
						|
		{[]string{"example", "."}, "example."},
 | 
						|
		{[]string{"example", "org."}, "example.org."}, // technically we should not be called like this.
 | 
						|
		{[]string{"."}, "."},
 | 
						|
	}
 | 
						|
 | 
						|
	for i, tc := range tests {
 | 
						|
		if x := Join(tc.in...); x != tc.out {
 | 
						|
			t.Errorf("Test %d, expected %s, got %s", i, tc.out, x)
 | 
						|
		}
 | 
						|
	}
 | 
						|
}
 |