diff options
author | Corey Hulen <corey@hulen.com> | 2017-03-24 23:31:34 -0700 |
---|---|---|
committer | enahum <nahumhbl@gmail.com> | 2017-03-25 03:31:34 -0300 |
commit | 54d3d47daf9190275bbdaf8703b84969a4593451 (patch) | |
tree | 05899b296d0186c1a0da8a540bc486e34ad8eec9 /vendor/github.com/spf13/jwalterweatherman/notepad_test.go | |
parent | 7460302dec7796e01c98264e84bece8169cb6ed9 (diff) | |
download | chat-54d3d47daf9190275bbdaf8703b84969a4593451.tar.gz chat-54d3d47daf9190275bbdaf8703b84969a4593451.tar.bz2 chat-54d3d47daf9190275bbdaf8703b84969a4593451.zip |
PLT-6076 Adding viper libs for config file changes (#5871)
* Adding viper libs for config file changes
* Removing the old fsnotify lib
* updating some missing libs
Diffstat (limited to 'vendor/github.com/spf13/jwalterweatherman/notepad_test.go')
-rw-r--r-- | vendor/github.com/spf13/jwalterweatherman/notepad_test.go | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/vendor/github.com/spf13/jwalterweatherman/notepad_test.go b/vendor/github.com/spf13/jwalterweatherman/notepad_test.go new file mode 100644 index 000000000..d0e3ab04b --- /dev/null +++ b/vendor/github.com/spf13/jwalterweatherman/notepad_test.go @@ -0,0 +1,41 @@ +// Copyright © 2016 Steve Francia <spf@spf13.com>. +// +// Use of this source code is governed by an MIT-style +// license that can be found in the LICENSE file. + +package jwalterweatherman + +import ( + "bytes" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestNotepad(t *testing.T) { + + var logHandle, outHandle bytes.Buffer + + n := NewNotepad(LevelCritical, LevelError, &outHandle, &logHandle, "TestNotePad", 0) + + require.Equal(t, LevelCritical, n.GetStdoutThreshold()) + require.Equal(t, LevelError, n.GetLogThreshold()) + + n.DEBUG.Println("Some debug") + n.ERROR.Println("Some error") + n.CRITICAL.Println("Some critical error") + + require.Contains(t, logHandle.String(), "[TestNotePad] ERROR Some error") + require.NotContains(t, logHandle.String(), "Some debug") + require.NotContains(t, outHandle.String(), "Some error") + require.Contains(t, outHandle.String(), "Some critical error") + + require.Equal(t, n.LogCountForLevel(LevelError), uint64(1)) + require.Equal(t, n.LogCountForLevel(LevelDebug), uint64(1)) + require.Equal(t, n.LogCountForLevel(LevelTrace), uint64(0)) +} + +func TestThresholdString(t *testing.T) { + require.Equal(t, LevelError.String(), "ERROR") + require.Equal(t, LevelTrace.String(), "TRACE") +} |