mirror of
				https://github.com/Monibuca/plugin-hdl.git
				synced 2025-10-31 03:56:28 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			24 lines
		
	
	
		
			442 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			442 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package hdl
 | |
| 
 | |
| import (
 | |
| 	"testing"
 | |
| )
 | |
| 
 | |
| func TestHDLHandler(t *testing.T) {
 | |
| 	tests := map[string]string{
 | |
| 		"/hdl/abc.flv": "abc", "/hdl/abc": "abc", "/abc": "abc", "/abc.flv": "abc",
 | |
| 	}
 | |
| 	for name, result := range tests {
 | |
| 		t.Run(name, func(t *testing.T) {
 | |
| 			parts := streamPathReg.FindStringSubmatch(name)
 | |
| 			stringPath := parts[3]
 | |
| 			if stringPath == "" {
 | |
| 				stringPath = parts[5]
 | |
| 			}
 | |
| 			if stringPath != result {
 | |
| 				t.Fail()
 | |
| 			}
 | |
| 		})
 | |
| 	}
 | |
| }
 | 
