mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 19:38:23 +00:00 
			
		
		
		
	Make labels list use consistent gap --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
		
			
				
	
	
		
			25 lines
		
	
	
		
			707 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			707 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright 2024 The Gitea Authors. All rights reserved.
 | |
| // SPDX-License-Identifier: MIT
 | |
| 
 | |
| package htmlutil
 | |
| 
 | |
| import (
 | |
| 	"html/template"
 | |
| 	"testing"
 | |
| 
 | |
| 	"github.com/stretchr/testify/assert"
 | |
| )
 | |
| 
 | |
| type testStringer struct{}
 | |
| 
 | |
| func (t testStringer) String() string {
 | |
| 	return "&StringMethod"
 | |
| }
 | |
| 
 | |
| func TestHTMLFormat(t *testing.T) {
 | |
| 	assert.Equal(t, template.HTML("<a>< < 1</a>"), HTMLFormat("<a>%s %s %d</a>", "<", template.HTML("<"), 1))
 | |
| 	assert.Equal(t, template.HTML("%!s(<nil>)"), HTMLFormat("%s", nil))
 | |
| 	assert.Equal(t, template.HTML("<>"), HTMLFormat("%s", template.URL("<>")))
 | |
| 	assert.Equal(t, template.HTML("&StringMethod &StringMethod"), HTMLFormat("%s %s", testStringer{}, &testStringer{}))
 | |
| }
 |