| 
									
										
										
										
											2017-08-19 15:22:09 +01:00
										 |  |  | 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."},
 | 
					
						
							| 
									
										
										
										
											2018-09-22 15:12:02 +01:00
										 |  |  | 		{[]string{"example", "org."}, "example.org."}, // technically we should not be called like this.
 | 
					
						
							| 
									
										
										
										
											2017-08-19 15:22:09 +01:00
										 |  |  | 		{[]string{"."}, "."},
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	for i, tc := range tests {
 | 
					
						
							| 
									
										
										
										
											2018-09-22 15:12:02 +01:00
										 |  |  | 		if x := Join(tc.in...); x != tc.out {
 | 
					
						
							| 
									
										
										
										
											2017-08-19 15:22:09 +01:00
										 |  |  | 			t.Errorf("Test %d, expected %s, got %s", i, tc.out, x)
 | 
					
						
							|  |  |  | 		}
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | }
 |