/
githubmirror
/
photoprism
Обзор
Документация
Войти
/
githubmirror
/
photoprism
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
pkg/clean/header_test.go
39 строк
990 B
promalert
refactor: use b.Loop() to simplify the code and improve performance
13 ноя 2025, 10:54
13 ноя 2025, 10:54
5d0aa10
Код
Авторство
О чём код?
package clean import ( "testing" "github.com/stretchr/testify/assert" ) func TestHeader(t *testing.T) { t.Run("Ok", func(t *testing.T) { expected := "https://docs.photoprism.app/getting-started/config-options/#file-converters" result := Header(expected) assert.Equal(t, expected, result) }) t.Run("Tabs", func(t *testing.T) { result := Header("https://..docs.photoprism.app/gettin\\g-started/config-options/\tfile-converters") assert.Equal(t, "https://..docs.photoprism.app/gettin\\g-started/config-options/file-converters", result) }) t.Run("Emoji", func(t *testing.T) { result := Header("Hello 👍") assert.Equal(t, "Hello ", result) }) t.Run("Empty", func(t *testing.T) { result := Header("") assert.Equal(t, "", result) }) } func BenchmarkHeader(b *testing.B) { for b.Loop() { Header("https://..docs.photoprism.app/gettin\\g-started/config-options/\tfile-converters") } } func BenchmarkHeaderEmpty(b *testing.B) { for b.Loop() { Header("") } }