summaryrefslogtreecommitdiffstats
path: root/modules/log/writer_test.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2021-06-07 07:27:09 +0200
committerGitHub <noreply@github.com>2021-06-07 07:27:09 +0200
commit3607f79d7869046d919fed05a21b55b6e61df1fa (patch)
tree9a176a4d5b67ac3a81ae210e9164d81959221ce0 /modules/log/writer_test.go
parent51775f65bc933843199320b040186703a2bb9f51 (diff)
downloadgitea-3607f79d7869046d919fed05a21b55b6e61df1fa.tar.gz
gitea-3607f79d7869046d919fed05a21b55b6e61df1fa.zip
Fixed assert statements. (#16089)
Diffstat (limited to 'modules/log/writer_test.go')
-rw-r--r--modules/log/writer_test.go39
1 files changed, 19 insertions, 20 deletions
diff --git a/modules/log/writer_test.go b/modules/log/writer_test.go
index 886dd58fb3..99a5fd3406 100644
--- a/modules/log/writer_test.go
+++ b/modules/log/writer_test.go
@@ -64,44 +64,44 @@ func TestBaseLogger(t *testing.T) {
expected := fmt.Sprintf("%s%s %s:%d:%s [%c] %s\n", prefix, dateString, event.filename, event.line, event.caller, strings.ToUpper(event.level.String())[0], event.msg)
b.LogEvent(&event)
assert.Equal(t, expected, string(written))
- assert.Equal(t, false, closed)
+ assert.False(t, closed)
written = written[:0]
event.level = DEBUG
expected = ""
b.LogEvent(&event)
assert.Equal(t, expected, string(written))
- assert.Equal(t, false, closed)
+ assert.False(t, closed)
event.level = TRACE
expected = ""
b.LogEvent(&event)
assert.Equal(t, expected, string(written))
- assert.Equal(t, false, closed)
+ assert.False(t, closed)
event.level = WARN
expected = fmt.Sprintf("%s%s %s:%d:%s [%c] %s\n", prefix, dateString, event.filename, event.line, event.caller, strings.ToUpper(event.level.String())[0], event.msg)
b.LogEvent(&event)
assert.Equal(t, expected, string(written))
- assert.Equal(t, false, closed)
+ assert.False(t, closed)
written = written[:0]
event.level = ERROR
expected = fmt.Sprintf("%s%s %s:%d:%s [%c] %s\n", prefix, dateString, event.filename, event.line, event.caller, strings.ToUpper(event.level.String())[0], event.msg)
b.LogEvent(&event)
assert.Equal(t, expected, string(written))
- assert.Equal(t, false, closed)
+ assert.False(t, closed)
written = written[:0]
event.level = CRITICAL
expected = fmt.Sprintf("%s%s %s:%d:%s [%c] %s\n", prefix, dateString, event.filename, event.line, event.caller, strings.ToUpper(event.level.String())[0], event.msg)
b.LogEvent(&event)
assert.Equal(t, expected, string(written))
- assert.Equal(t, false, closed)
+ assert.False(t, closed)
written = written[:0]
b.Close()
- assert.Equal(t, true, closed)
+ assert.True(t, closed)
}
func TestBaseLoggerDated(t *testing.T) {
@@ -142,46 +142,46 @@ func TestBaseLoggerDated(t *testing.T) {
expected := fmt.Sprintf("%s%s %s:%d [%s] %s", prefix, dateString, "FILENAME", event.line, strings.ToUpper(event.level.String()), event.msg)
b.LogEvent(&event)
assert.Equal(t, expected, string(written))
- assert.Equal(t, false, closed)
+ assert.False(t, closed)
written = written[:0]
event.level = INFO
expected = ""
b.LogEvent(&event)
assert.Equal(t, expected, string(written))
- assert.Equal(t, false, closed)
+ assert.False(t, closed)
written = written[:0]
event.level = ERROR
expected = fmt.Sprintf("%s%s %s:%d [%s] %s", prefix, dateString, "FILENAME", event.line, strings.ToUpper(event.level.String()), event.msg)
b.LogEvent(&event)
assert.Equal(t, expected, string(written))
- assert.Equal(t, false, closed)
+ assert.False(t, closed)
written = written[:0]
event.level = DEBUG
expected = ""
b.LogEvent(&event)
assert.Equal(t, expected, string(written))
- assert.Equal(t, false, closed)
+ assert.False(t, closed)
written = written[:0]
event.level = CRITICAL
expected = fmt.Sprintf("%s%s %s:%d [%s] %s", prefix, dateString, "FILENAME", event.line, strings.ToUpper(event.level.String()), event.msg)
b.LogEvent(&event)
assert.Equal(t, expected, string(written))
- assert.Equal(t, false, closed)
+ assert.False(t, closed)
written = written[:0]
event.level = TRACE
expected = ""
b.LogEvent(&event)
assert.Equal(t, expected, string(written))
- assert.Equal(t, false, closed)
+ assert.False(t, closed)
written = written[:0]
b.Close()
- assert.Equal(t, true, closed)
+ assert.True(t, closed)
}
func TestBaseLoggerMultiLineNoFlagsRegexp(t *testing.T) {
@@ -222,20 +222,20 @@ func TestBaseLoggerMultiLineNoFlagsRegexp(t *testing.T) {
expected := "TEST\n\tMESSAGE\n\tTEST\n"
b.LogEvent(&event)
assert.Equal(t, expected, string(written))
- assert.Equal(t, false, closed)
+ assert.False(t, closed)
written = written[:0]
event.filename = "ELSEWHERE"
b.LogEvent(&event)
assert.Equal(t, "", string(written))
- assert.Equal(t, false, closed)
+ assert.False(t, closed)
written = written[:0]
event.caller = "FILENAME"
b.LogEvent(&event)
assert.Equal(t, expected, string(written))
- assert.Equal(t, false, closed)
+ assert.False(t, closed)
written = written[:0]
event = Event{
@@ -249,9 +249,8 @@ func TestBaseLoggerMultiLineNoFlagsRegexp(t *testing.T) {
expected = "TEST\n\tFILENAME\n\tTEST\n"
b.LogEvent(&event)
assert.Equal(t, expected, string(written))
- assert.Equal(t, false, closed)
+ assert.False(t, closed)
written = written[:0]
-
}
func TestBrokenRegexp(t *testing.T) {
@@ -273,5 +272,5 @@ func TestBrokenRegexp(t *testing.T) {
b.NewWriterLogger(c)
assert.Empty(t, b.regexp)
b.Close()
- assert.Equal(t, true, closed)
+ assert.True(t, closed)
}