mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-10-31 10:37:24 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			18 lines
		
	
	
		
			332 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			332 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package main
 | |
| 
 | |
| import "testing"
 | |
| 
 | |
| // This works because it does not have the same signature as the
 | |
| // conventional "TestMain" function described in the testing package
 | |
| // godoc.
 | |
| func TestMain(t *testing.T) {
 | |
| 	var ran bool
 | |
| 	run = func() {
 | |
| 		ran = true
 | |
| 	}
 | |
| 	main()
 | |
| 	if !ran {
 | |
| 		t.Error("Expected Run() to be called, but it wasn't")
 | |
| 	}
 | |
| }
 |