Skip to content

Commit 12886a2

Browse files
committed
repl: reorder want/got into got/want
This CL reverts the display of want/got into got/want in order to follow good Go practices. Also align got/want display so as to ease deciphering the error for normal humans. Signed-off-by: Sebastien Binet <[email protected]>
1 parent 7595575 commit 12886a2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

repl/repl_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ func (rt *replTest) Print(out string) {
2626

2727
func (rt *replTest) assert(t *testing.T, what, wantPrompt, wantOut string) {
2828
if rt.prompt != wantPrompt {
29-
t.Errorf("%s: Prompt wrong, want %q got %q", what, wantPrompt, rt.prompt)
29+
t.Errorf("%s: Prompt wrong:\ngot= %q\nwant=%q", what, rt.prompt, wantPrompt)
3030
}
3131
if rt.out != wantOut {
32-
t.Errorf("%s: Output wrong, want %q got %q", what, wantOut, rt.out)
32+
t.Errorf("%s: Output wrong:\ngot= %q\nwant=%q", what, rt.out, wantOut)
3333
}
3434
rt.out = ""
3535
}
@@ -118,13 +118,13 @@ func TestCompleter(t *testing.T) {
118118
t.Run(fmt.Sprintf("line=%q,pos=%d)", test.line, test.pos), func(t *testing.T) {
119119
gotHead, gotCompletions, gotTail := r.Completer(test.line, test.pos)
120120
if test.wantHead != gotHead {
121-
t.Errorf("head: want %q got %q", test.wantHead, gotHead)
121+
t.Errorf("invalid head:\ngot= %q\nwant=%q", gotHead, test.wantHead)
122122
}
123123
if !reflect.DeepEqual(test.wantCompletions, gotCompletions) {
124-
t.Errorf("completions: want %#v got %#v", test.wantCompletions, gotCompletions)
124+
t.Errorf("invalid completions:\ngot= %#v\nwant=%#v", gotCompletions, test.wantCompletions)
125125
}
126126
if test.wantTail != gotTail {
127-
t.Errorf("tail: want %q got %q", test.wantTail, gotTail)
127+
t.Errorf("invalid tail:\ngot= %q\nwant=%q", gotTail, test.wantTail)
128128
}
129129
})
130130
}

0 commit comments

Comments
 (0)