| 
									
										
										
										
											2016-04-19 11:13:24 +01:00
										 |  |  | package cache
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import (
 | 
					
						
							|  |  |  | 	"testing"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	"github.com/miekg/dns"
 | 
					
						
							|  |  |  | )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func TestKey(t *testing.T) {
 | 
					
						
							| 
									
										
										
										
											2016-10-02 08:31:44 +01:00
										 |  |  | 	if x := rawKey("miek.nl.", dns.TypeMX, false); x != "0miek.nl..15" {
 | 
					
						
							|  |  |  | 		t.Errorf("failed to create correct key, got %s", x)
 | 
					
						
							| 
									
										
										
										
											2016-04-19 11:13:24 +01:00
										 |  |  | 	}
 | 
					
						
							| 
									
										
										
										
											2016-10-02 08:31:44 +01:00
										 |  |  | 	if x := rawKey("miek.nl.", dns.TypeMX, true); x != "1miek.nl..15" {
 | 
					
						
							|  |  |  | 		t.Errorf("failed to create correct key, got %s", x)
 | 
					
						
							| 
									
										
										
										
											2016-04-19 11:13:24 +01:00
										 |  |  | 	}
 | 
					
						
							| 
									
										
										
										
											2016-10-02 08:31:44 +01:00
										 |  |  | 	// rawKey does not lowercase.
 | 
					
						
							|  |  |  | 	if x := rawKey("miEK.nL.", dns.TypeMX, true); x != "1miEK.nL..15" {
 | 
					
						
							|  |  |  | 		t.Errorf("failed to create correct key, got %s", x)
 | 
					
						
							| 
									
										
										
										
											2016-04-19 11:13:24 +01:00
										 |  |  | 	}
 | 
					
						
							|  |  |  | }
 |