1
0
Fork 0
forked from forgejo/forgejo

Less naked returns (#25713)

just a step towards  #25655

and some related refactoring
This commit is contained in:
6543 2023-07-07 07:31:56 +02:00 committed by GitHub
parent b1eb1676aa
commit 8995046110
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 254 additions and 239 deletions

View file

@ -224,3 +224,12 @@ func TestToTitleCase(t *testing.T) {
assert.Equal(t, ToTitleCase(`foo bar baz`), `Foo Bar Baz`)
assert.Equal(t, ToTitleCase(`FOO BAR BAZ`), `Foo Bar Baz`)
}
func TestToPointer(t *testing.T) {
assert.Equal(t, "abc", *ToPointer("abc"))
assert.Equal(t, 123, *ToPointer(123))
abc := "abc"
assert.False(t, &abc == ToPointer(abc))
val123 := 123
assert.False(t, &val123 == ToPointer(val123))
}