| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package module_name
- import "testing"
- func TestNewAModuleName_ok(t *testing.T) {
- t.Parallel()
- cases := []string{
- "mod",
- "module_1",
- "модуль",
- }
- for _, tc := range cases {
- t.Run(tc, func(t *testing.T) {
- t.Parallel()
- mn := NewAModuleName(tc)
- if mn == nil {
- t.Fatalf("NewAModuleName(): nil")
- }
- if got := mn.val.Get(); got != tc {
- t.Fatalf("Get(): got=%q want=%q", got, tc)
- }
- if got := mn.val.Get(); got != tc {
- t.Fatalf("String(): got=%q want=%q", got, tc)
- }
- })
- }
- }
- func TestNewAModuleName_empty_panics(t *testing.T) {
- t.Parallel()
- defer func() {
- if r := recover(); r == nil {
- t.Fatalf("expected panic, got nil")
- }
- }()
- _ = NewAModuleName("")
- }
|