mirror of
				https://github.com/TeaOSLab/EdgeCommon.git
				synced 2025-11-04 21:50:26 +08:00 
			
		
		
		
	
		
			
	
	
		
			22 lines
		
	
	
		
			541 B
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			22 lines
		
	
	
		
			541 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| 
								 | 
							
								// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								package serverconfigs
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import (
							 | 
						||
| 
								 | 
							
									"github.com/iwind/TeaGo/assert"
							 | 
						||
| 
								 | 
							
									"testing"
							 | 
						||
| 
								 | 
							
								)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								func TestWebPImageConfig_MatchAccept(t *testing.T) {
							 | 
						||
| 
								 | 
							
									var a = assert.NewAssertion(t)
							 | 
						||
| 
								 | 
							
									{
							 | 
						||
| 
								 | 
							
										var c = &WebPImageConfig{}
							 | 
						||
| 
								 | 
							
										a.IsFalse(c.MatchAccept(""))
							 | 
						||
| 
								 | 
							
										a.IsTrue(c.MatchAccept("image/webp"))
							 | 
						||
| 
								 | 
							
										a.IsTrue(c.MatchAccept("image/webp,image/png"))
							 | 
						||
| 
								 | 
							
										a.IsTrue(c.MatchAccept("image/jpeg,image/webp,image/png"))
							 | 
						||
| 
								 | 
							
										a.IsFalse(c.MatchAccept("mimage/webp"))
							 | 
						||
| 
								 | 
							
										a.IsFalse(c.MatchAccept("image/webpm"))
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								}
							 |