mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 10:56:10 +01:00 
			
		
		
		
	Refactor tests to prevent from unnecessary preparations (#32398)
This commit is contained in:
		| @@ -240,3 +240,16 @@ func TestReserveLineBreakForTextarea(t *testing.T) { | ||||
| 	assert.Equal(t, ReserveLineBreakForTextarea("test\r\ndata"), "test\ndata") | ||||
| 	assert.Equal(t, ReserveLineBreakForTextarea("test\r\ndata\r\n"), "test\ndata\n") | ||||
| } | ||||
|  | ||||
| func TestOptionalArg(t *testing.T) { | ||||
| 	foo := func(other any, optArg ...int) int { | ||||
| 		return OptionalArg(optArg) | ||||
| 	} | ||||
| 	bar := func(other any, optArg ...int) int { | ||||
| 		return OptionalArg(optArg, 42) | ||||
| 	} | ||||
| 	assert.Equal(t, 0, foo(nil)) | ||||
| 	assert.Equal(t, 100, foo(nil, 100)) | ||||
| 	assert.Equal(t, 42, bar(nil)) | ||||
| 	assert.Equal(t, 100, bar(nil, 100)) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user