Documentation
¶
Overview ¶
Package problemtest checks that a client's message catalog covers an application's problem types.
Index ¶
- func CheckArgs(msg string, params []string) error
- func CheckCatalog(tb testing.TB, path string, registries ...*problem.Registry)
- func CheckGoCatalog(tb testing.TB, c *problem.Catalog, registries ...*problem.Registry)
- func CheckMessages(tb testing.TB, messages map[string]string, registries ...*problem.Registry)
- func MessageArgs(msg string) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckArgs ¶
CheckArgs returns an error if the ICU message msg does not parse or uses an argument not in params.
func CheckCatalog ¶
CheckCatalog fails t unless the JSON catalog at path has a message at apiErrors.<code> for every type in registries, using only the type's Params as ICU arguments. The shared codes' messages ship with @parallelworks/problem, so the catalog needs only the application's own.
func CheckGoCatalog ¶ added in v0.11.0
CheckGoCatalog fails tb unless c, a catalog a server localizes problems with, has an English message for every type in registries, and every language's message for a type uses only the type's Params.
func CheckMessages ¶ added in v0.6.0
CheckMessages is CheckCatalog for an apiErrors map the caller has already loaded, such as a catalog split into one file per namespace.
func MessageArgs ¶
MessageArgs returns the names of the arguments an ICU message format string uses, including those inside plural and select branches.
Types ¶
This section is empty.