/
githubmirror
/
photoprism
Обзор
Документация
Войти
/
githubmirror
/
photoprism
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
pkg/clean/error_test.go
29 строк
804 B
graciousgrey
Tests: Add unit tests
29 апр 2024, 19:36
29 апр 2024, 19:36
43011da
Код
Авторство
О чём код?
package clean import ( "errors" "testing" "github.com/stretchr/testify/assert" ) func TestLogError(t *testing.T) { t.Run("Nil", func(t *testing.T) { assert.Equal(t, "no error", Error(nil)) }) t.Run("Empty", func(t *testing.T) { assert.Equal(t, "unknown error", Error(errors.New(""))) }) t.Run("Simple", func(t *testing.T) { assert.Equal(t, "simple", Error(errors.New("simple"))) }) t.Run("Spaces", func(t *testing.T) { assert.Equal(t, "the quick brown fox", Error(errors.New("the quick brown fox"))) }) t.Run("Invalid", func(t *testing.T) { assert.Equal(t, "??https://?host?:?port?/?path??", Error(errors.New("${https://<host>:<port>/<path>}"))) }) t.Run("Quotes", func(t *testing.T) { assert.Equal(t, "the quick 'brown fox", Error(errors.New("the quick `brown fox"))) }) }