The module is now git.unbound.se/shiny/presenter. The API is unchanged. Tags up to v0.3.7 declare gitea.unbound.se/shiny/presenter and stay resolvable through that alias. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kko4x3MYEcWMMdkx12WpBa
25 lines
858 B
Go
25 lines
858 B
Go
package presenter_test
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"git.unbound.se/shiny/presenter"
|
|
)
|
|
|
|
func TestCodedError_ErrorIs(t *testing.T) {
|
|
require.True(t, errors.Is(ErrActivityNotFound, ErrActivityNotFound))
|
|
require.False(t, errors.Is(ErrActivityNotFound, fmt.Errorf("other")))
|
|
require.False(t, errors.Is(ErrActivityNotFound, ErrEntryNotFound))
|
|
require.False(t, errors.Is(ErrActivityNotFound, ErrActivityNotFound.WithParam("some", "value")))
|
|
require.False(t, errors.Is(ErrActivityNotFound.WithParam("some", "other"), ErrActivityNotFound.WithParam("some", "value")))
|
|
}
|
|
|
|
var (
|
|
ErrActivityNotFound = presenter.NewCodedError("activity not found", presenter.CodeNotFound, presenter.EntityActivity)
|
|
ErrEntryNotFound = presenter.NewCodedError("entry not found", presenter.CodeNotFound, presenter.EntityEntry)
|
|
)
|