forked from gin-gonic/gin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebug_test.go
38 lines (30 loc) · 861 Bytes
/
debug_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package gin
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestIsDebugging(t *testing.T) {
SetMode(DebugMode)
assert.True(t, IsDebugging())
SetMode(ReleaseMode)
assert.False(t, IsDebugging())
SetMode(TestMode)
assert.False(t, IsDebugging())
}
// TODO
// func TestDebugPrint(t *testing.T) {
// buffer := bytes.NewBufferString("")
// debugLogger.
// log.SetOutput(buffer)
// SetMode(ReleaseMode)
// debugPrint("This is a example")
// assert.Equal(t, buffer.Len(), 0)
// SetMode(DebugMode)
// debugPrint("This is %s", "a example")
// assert.Equal(t, buffer.String(), "[GIN-debug] This is a example")
// SetMode(TestMode)
// log.SetOutput(os.Stdout)
// }