chore: simplify workflows and unify tool logging and mail presentation
This commit is contained in:
1 parent
f4d96de79e
commit
c93f2bf8b2
40 files changed
+523
-1515
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package logging
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFormat(t *testing.T) {
|
||||
for _, tc := range []struct {
|
||||
level, code string
|
||||
}{{"I", "32"}, {"W", "33"}, {"E", "31"}, {"F", "35"}} {
|
||||
t.Run(tc.level, func(t *testing.T) {
|
||||
for _, color := range []bool{false, true} {
|
||||
var buf bytes.Buffer
|
||||
write(&buf, color, tc.level, "Builder", "first\r\nsecond\n")
|
||||
label := "[" + tc.level + "]"
|
||||
if color {
|
||||
label = "\033[" + tc.code + "m" + label + "\033[0m"
|
||||
}
|
||||
want := label + " [Builder] first\n" + label + " [Builder] second\n"
|
||||
if buf.String() != want {
|
||||
t.Fatalf("got %q, want %q", buf.String(), want)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user