cmd/clef, log: fix testcodes

This commit is contained in:
trillom8 2024-05-26 17:26:54 +09:00
parent 6a52162ce3
commit fec649a07a
2 changed files with 2 additions and 2 deletions

View file

@ -48,7 +48,7 @@ func TestImportRaw(t *testing.T) {
// Run clef importraw // Run clef importraw
clef := runClef(t, "--suppress-bootwarn", "--lightkdf", "importraw", keyPath) clef := runClef(t, "--suppress-bootwarn", "--lightkdf", "importraw", keyPath)
clef.input("myverylongpassword1").input("myverylongpassword2").WaitExit() clef.input("myverylongpassword1").input("myverylongpassword2").WaitExit()
if have, want := clef.StderrText(), "Passwords do not match\n"; have != want { if have, want := clef.StderrText(), "passwords do not match\n"; have != want {
t.Errorf("have %q, want %q", have, want) t.Errorf("have %q, want %q", have, want)
} }
}) })

View file

@ -150,7 +150,7 @@ func TestLoggerOutput(t *testing.T) {
have := out.String() have := out.String()
t.Logf("output %v", out.String()) t.Logf("output %v", out.String())
want := `INFO [11-07|19:14:33.821] This is a message foo=123 bytes="[0 0 0 0 0 0 0 0 0 0]" bonk="a string with text" time=0001-01-01T00:00:00+0000 bigint=100 nilbig=<nil> err="Oh nooes it's crap" struct="{A:Foo B:12}" struct="{A:Foo\nLinebreak B:122}" ptrstruct="&{A:Foo B:12}" smalluint=500,000 bigUint=1,600,660,942,523,603,594,864,898,306,482,794,244,293,965,082,972,225,630,372,095 want := `INFO [11-07|19:14:33.821] This is a message foo=123 bytes="[0 0 0 0 0 0 0 0 0 0]" bonk="a string with text" time=0001-01-01T00:00:00+0000 bigint=100 nilbig=<nil> err="oh nooes it's crap" struct="{A:Foo B:12}" struct="{A:Foo\nLinebreak B:122}" ptrstruct="&{A:Foo B:12}" smalluint=500,000 bigUint=1,600,660,942,523,603,594,864,898,306,482,794,244,293,965,082,972,225,630,372,095
` `
if !bytes.Equal([]byte(have)[25:], []byte(want)[25:]) { if !bytes.Equal([]byte(have)[25:], []byte(want)[25:]) {
t.Errorf("Error\nhave: %q\nwant: %q", have, want) t.Errorf("Error\nhave: %q\nwant: %q", have, want)