|
4 | 4 | "reflect" |
5 | 5 | "testing" |
6 | 6 |
|
7 | | - "github.com/m-lab/go/rtx" |
| 7 | + "github.com/m-lab/go/testingx" |
8 | 8 | ) |
9 | 9 |
|
10 | 10 | func TestName(t *testing.T) { |
@@ -295,18 +295,22 @@ func TestName_String(t *testing.T) { |
295 | 295 | }, |
296 | 296 | { |
297 | 297 | name: "ndt-lol12345-abcdef01.mlab.sandbox.measurement-lab.org", |
298 | | - want: "lol12345-abcdef01.mlab.sandbox.measurement-lab.org", |
| 298 | + want: "ndt-lol12345-abcdef01.mlab.sandbox.measurement-lab.org", |
299 | 299 | }, |
300 | 300 | } |
301 | 301 | for _, tt := range tests { |
302 | 302 | t.Run(tt.name, func(t *testing.T) { |
303 | 303 | n, err := Parse(tt.name) |
304 | | - rtx.Must(err, "Failed to parse: %s", tt.name) |
| 304 | + testingx.Must(t, err, "Failed to parse: %s", tt.name) |
305 | 305 | if got := n.String(); got != tt.want { |
306 | 306 | t.Errorf("Name.String() = %v, want %v", got, tt.want) |
307 | 307 | } |
308 | 308 | }) |
309 | 309 | } |
| 310 | + // Verify an empty Name returns an empty string. |
| 311 | + if (Name{}).String() != "" { |
| 312 | + t.Errorf("Name.String() = %v, want ''", (Name{}).String()) |
| 313 | + } |
310 | 314 | } |
311 | 315 |
|
312 | 316 | func TestName_StringWithService(t *testing.T) { |
@@ -338,7 +342,7 @@ func TestName_StringWithService(t *testing.T) { |
338 | 342 | for _, tt := range tests { |
339 | 343 | t.Run(tt.name, func(t *testing.T) { |
340 | 344 | n, err := Parse(tt.name) |
341 | | - rtx.Must(err, "Failed to parse: %s", tt.name) |
| 345 | + testingx.Must(t, err, "Failed to parse: %s", tt.name) |
342 | 346 | if got := n.StringWithService(); got != tt.want { |
343 | 347 | t.Errorf("Name.StringWithService() = %v, want %v", got, tt.want) |
344 | 348 | } |
@@ -369,13 +373,13 @@ func TestName_StringWithSuffix(t *testing.T) { |
369 | 373 | }, |
370 | 374 | { |
371 | 375 | name: "ndt-lol12345-abcdef01.mlab.sandbox.measurement-lab.org", |
372 | | - want: "lol12345-abcdef01.mlab.sandbox.measurement-lab.org", |
| 376 | + want: "ndt-lol12345-abcdef01.mlab.sandbox.measurement-lab.org", |
373 | 377 | }, |
374 | 378 | } |
375 | 379 | for _, tt := range tests { |
376 | 380 | t.Run(tt.name, func(t *testing.T) { |
377 | 381 | n, err := Parse(tt.name) |
378 | | - rtx.Must(err, "Failed to parse: %s", tt.name) |
| 382 | + testingx.Must(t, err, "Failed to parse: %s", tt.name) |
379 | 383 | if got := n.StringWithSuffix(); got != tt.want { |
380 | 384 | t.Errorf("Name.StringWithSuffix() = %v, want %v", got, tt.want) |
381 | 385 | } |
@@ -412,7 +416,7 @@ func TestName_StringAll(t *testing.T) { |
412 | 416 | for _, tt := range tests { |
413 | 417 | t.Run(tt.name, func(t *testing.T) { |
414 | 418 | n, err := Parse(tt.name) |
415 | | - rtx.Must(err, "Failed to parse: %s", tt.name) |
| 419 | + testingx.Must(t, err, "Failed to parse: %s", tt.name) |
416 | 420 | if got := n.StringAll(); got != tt.want { |
417 | 421 | t.Errorf("Name.StringAll() = %v, want %v", got, tt.want) |
418 | 422 | } |
|
0 commit comments