From 12886a2728c232f1fef7b758a1d0f4ff1934e522 Mon Sep 17 00:00:00 2001 From: Sebastien Binet Date: Fri, 22 Apr 2022 16:11:37 +0200 Subject: [PATCH] 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 --- repl/repl_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/repl/repl_test.go b/repl/repl_test.go index 3c13c7c6..06395234 100644 --- a/repl/repl_test.go +++ b/repl/repl_test.go @@ -26,10 +26,10 @@ func (rt *replTest) Print(out string) { func (rt *replTest) assert(t *testing.T, what, wantPrompt, wantOut string) { if rt.prompt != wantPrompt { - t.Errorf("%s: Prompt wrong, want %q got %q", what, wantPrompt, rt.prompt) + t.Errorf("%s: Prompt wrong:\ngot= %q\nwant=%q", what, rt.prompt, wantPrompt) } if rt.out != wantOut { - t.Errorf("%s: Output wrong, want %q got %q", what, wantOut, rt.out) + t.Errorf("%s: Output wrong:\ngot= %q\nwant=%q", what, rt.out, wantOut) } rt.out = "" } @@ -118,13 +118,13 @@ func TestCompleter(t *testing.T) { t.Run(fmt.Sprintf("line=%q,pos=%d)", test.line, test.pos), func(t *testing.T) { gotHead, gotCompletions, gotTail := r.Completer(test.line, test.pos) if test.wantHead != gotHead { - t.Errorf("head: want %q got %q", test.wantHead, gotHead) + t.Errorf("invalid head:\ngot= %q\nwant=%q", gotHead, test.wantHead) } if !reflect.DeepEqual(test.wantCompletions, gotCompletions) { - t.Errorf("completions: want %#v got %#v", test.wantCompletions, gotCompletions) + t.Errorf("invalid completions:\ngot= %#v\nwant=%#v", gotCompletions, test.wantCompletions) } if test.wantTail != gotTail { - t.Errorf("tail: want %q got %q", test.wantTail, gotTail) + t.Errorf("invalid tail:\ngot= %q\nwant=%q", gotTail, test.wantTail) } }) } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy