| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package store_key
- import "testing"
- func TestNewAStoreKey_ok(t *testing.T) {
- t.Parallel()
- cases := []string{
- "key",
- "key_1",
- "ключ",
- "topic/partition/offset",
- }
- for _, tc := range cases {
- t.Run(tc, func(t *testing.T) {
- t.Parallel()
- k := NewAStoreKey(tc)
- if k == nil {
- t.Fatalf("NewAStoreKey(): nil")
- }
- if got := k.Get(); got != tc {
- t.Fatalf("Get(): got=%q want=%q", got, tc)
- }
- if got := k.String(); got != tc {
- t.Fatalf("String(): got=%q want=%q", got, tc)
- }
- })
- }
- }
- func TestNewAStoreKey_empty_panics(t *testing.T) {
- t.Parallel()
- defer func() {
- if r := recover(); r == nil {
- t.Fatalf("expected panic, got nil")
- }
- }()
- _ = NewAStoreKey("")
- }
|