(t *testing.T)
| 31 | } |
| 32 | |
| 33 | func TestMessageFormat(t *testing.T) { |
| 34 | t.Parallel() |
| 35 | a := assertions.New(t) |
| 36 | |
| 37 | args := errors.MessageFormatArguments( |
| 38 | "Application with ID {app_id} could not be found in namespace { ns } or namespace { ns } does not exist", |
| 39 | ) |
| 40 | a.So(args, should.HaveLength, 2) // no duplicates |
| 41 | a.So(args, should.Contain, "app_id") |
| 42 | a.So(args, should.Contain, "ns") |
| 43 | |
| 44 | err := errors.Define("test_message_format", "MessageFormat {foo}, {bar}") |
| 45 | instance := err.WithAttributes("foo", "my-foo", "bar", "my-bar") |
| 46 | a.So(instance.PublicAttributes(), should.ContainKey, "foo") |
| 47 | a.So(instance.PublicAttributes(), should.ContainKey, "bar") |
| 48 | } |
nothing calls this directly
no test coverage detected