mirror of
				https://github.com/coredns/coredns.git
				synced 2025-11-03 18:53:13 -05:00 
			
		
		
		
	
		
			
	
	
		
			21 lines
		
	
	
		
			397 B
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			21 lines
		
	
	
		
			397 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| 
								 | 
							
								package auto
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import "testing"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								func TestRewriteToExpand(t *testing.T) {
							 | 
						||
| 
								 | 
							
									tests := []struct {
							 | 
						||
| 
								 | 
							
										in       string
							 | 
						||
| 
								 | 
							
										expected string
							 | 
						||
| 
								 | 
							
									}{
							 | 
						||
| 
								 | 
							
										{in: "", expected: ""},
							 | 
						||
| 
								 | 
							
										{in: "{1}", expected: "${1}"},
							 | 
						||
| 
								 | 
							
										{in: "{1", expected: "${1"},
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
									for i, tc := range tests {
							 | 
						||
| 
								 | 
							
										got := rewriteToExpand(tc.in)
							 | 
						||
| 
								 | 
							
										if got != tc.expected {
							 | 
						||
| 
								 | 
							
											t.Errorf("Test %d: Expected error %v, but got %v", i, tc.expected, got)
							 | 
						||
| 
								 | 
							
										}
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								}
							 |