clean up: put test description in head to locate quickly

This commit is contained in:
zhengjiajin 2017-05-19 02:04:59 +08:00
parent 7df0178076
commit 9ecab7e20c
2 changed files with 9 additions and 9 deletions

View File

@ -157,19 +157,19 @@ func TestPodAndContainerAttach(t *testing.T) {
err := options.Complete(f, cmd, test.args) err := options.Complete(f, cmd, test.args)
if test.expectError && err == nil { if test.expectError && err == nil {
t.Errorf("unexpected non-error (%s)", test.name) t.Errorf("%s: unexpected non-error", test.name)
} }
if !test.expectError && err != nil { if !test.expectError && err != nil {
t.Errorf("unexpected error: %v (%s)", err, test.name) t.Errorf("%s: unexpected error: %v", test.name, err)
} }
if err != nil { if err != nil {
continue continue
} }
if options.PodName != test.expectedPod { if options.PodName != test.expectedPod {
t.Errorf("expected: %s, got: %s (%s)", test.expectedPod, options.PodName, test.name) t.Errorf("%s: expected: %s, got: %s", test.name, test.expectedPod, options.PodName)
} }
if options.ContainerName != test.expectedContainer { if options.ContainerName != test.expectedContainer {
t.Errorf("expected: %s, got: %s (%s)", test.expectedContainer, options.ContainerName, test.name) t.Errorf("%s: expected: %s, got: %s", test.name, test.expectedContainer, options.ContainerName)
} }
} }
} }

View File

@ -141,22 +141,22 @@ func TestPodAndContainer(t *testing.T) {
options := test.p options := test.p
err := options.Complete(f, cmd, test.args, test.argsLenAtDash) err := options.Complete(f, cmd, test.args, test.argsLenAtDash)
if test.expectError && err == nil { if test.expectError && err == nil {
t.Errorf("unexpected non-error (%s)", test.name) t.Errorf("%s: unexpected non-error", test.name)
} }
if !test.expectError && err != nil { if !test.expectError && err != nil {
t.Errorf("unexpected error: %v (%s)", err, test.name) t.Errorf("%s: unexpected error: %v", test.name, err)
} }
if err != nil { if err != nil {
continue continue
} }
if options.PodName != test.expectedPod { if options.PodName != test.expectedPod {
t.Errorf("expected: %s, got: %s (%s)", test.expectedPod, options.PodName, test.name) t.Errorf("%s: expected: %s, got: %s", test.name, test.expectedPod, options.PodName)
} }
if options.ContainerName != test.expectedContainer { if options.ContainerName != test.expectedContainer {
t.Errorf("expected: %s, got: %s (%s)", test.expectedContainer, options.ContainerName, test.name) t.Errorf("%s: expected: %s, got: %s", test.name, test.expectedContainer, options.ContainerName)
} }
if !reflect.DeepEqual(test.expectedArgs, options.Command) { if !reflect.DeepEqual(test.expectedArgs, options.Command) {
t.Errorf("expected: %v, got %v (%s)", test.expectedArgs, options.Command, test.name) t.Errorf("%s: expected: %v, got %v", test.name, test.expectedArgs, options.Command)
} }
} }
} }