mirror of
https://github.com/retailcrm/mg-bot-api-client-go.git
synced 2024-11-23 13:26:03 +03:00
25 lines
455 B
Go
25 lines
455 B
Go
|
package v1
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
type wrappedLogger struct {
|
||
|
lastMessage string
|
||
|
}
|
||
|
|
||
|
func (w *wrappedLogger) Debugf(msg string, v ...interface{}) {
|
||
|
w.lastMessage = fmt.Sprintf(msg, v...)
|
||
|
}
|
||
|
|
||
|
func TestDebugLoggerAdapter_Printf(t *testing.T) {
|
||
|
wrapped := &wrappedLogger{}
|
||
|
logger := DebugLoggerAdapter(wrapped)
|
||
|
logger.Printf("Test message #%d", 1)
|
||
|
|
||
|
assert.Equal(t, "Test message #1", wrapped.lastMessage)
|
||
|
}
|