harness-drone/vendor/github.com/gin-gonic/gin/mode_test.go

32 lines
648 B
Go
Raw Normal View History

2015-05-22 18:37:40 +00:00
// 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"
2015-09-30 01:21:17 +00:00
"github.com/stretchr/testify/assert"
2015-05-22 18:37:40 +00:00
)
func init() {
SetMode(TestMode)
}
func TestSetMode(t *testing.T) {
SetMode(DebugMode)
assert.Equal(t, ginMode, debugCode)
assert.Equal(t, Mode(), DebugMode)
SetMode(ReleaseMode)
assert.Equal(t, ginMode, releaseCode)
assert.Equal(t, Mode(), ReleaseMode)
SetMode(TestMode)
assert.Equal(t, ginMode, testCode)
assert.Equal(t, Mode(), TestMode)
assert.Panics(t, func() { SetMode("unknown") })
}