Tests for log constants
This commit is contained in:
parent
a5c97d68e7
commit
47cf94ad01
2
Makefile
2
Makefile
|
@ -4,7 +4,7 @@ all:
|
||||||
go build -o telegabber
|
go build -o telegabber
|
||||||
|
|
||||||
test:
|
test:
|
||||||
go test -v ./config
|
go test -v ./config ./ ./telegram
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
$(GOPATH)/bin/golint ./...
|
$(GOPATH)/bin/golint ./...
|
||||||
|
|
21
log_test.go
Normal file
21
log_test.go
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestLogInfo(t *testing.T) {
|
||||||
|
logrusConstant := stringToLogConstant(":info")
|
||||||
|
if logrusConstant != log.InfoLevel {
|
||||||
|
t.Errorf("Wrong logrus constant for info")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestLogInvalid(t *testing.T) {
|
||||||
|
logrusConstant := stringToLogConstant("ziz")
|
||||||
|
if logrusConstant != log.FatalLevel {
|
||||||
|
t.Errorf("Unknown strings should return fatal loglevel")
|
||||||
|
}
|
||||||
|
}
|
19
telegram/client_test.go
Normal file
19
telegram/client_test.go
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
package telegram
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestLogInfo(t *testing.T) {
|
||||||
|
tdlibConstant := stringToLogConstant(":info")
|
||||||
|
if tdlibConstant != 3 {
|
||||||
|
t.Errorf("Wrong TDlib constant for info")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestLogInvalid(t *testing.T) {
|
||||||
|
tdlibConstant := stringToLogConstant("ziz")
|
||||||
|
if tdlibConstant != 0 {
|
||||||
|
t.Errorf("Unknown strings should return fatal loglevel")
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue