summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/spf13/jwalterweatherman
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-04-16 05:37:14 -0700
committerJoram Wilander <jwawilander@gmail.com>2018-04-16 08:37:14 -0400
commit6e2cb00008cbf09e556b00f87603797fcaa47e09 (patch)
tree3c0eb55ff4226a3f024aad373140d1fb860a6404 /vendor/github.com/spf13/jwalterweatherman
parentbf24f51c4e1cc6286885460672f7f449e8c6f5ef (diff)
downloadchat-6e2cb00008cbf09e556b00f87603797fcaa47e09.tar.gz
chat-6e2cb00008cbf09e556b00f87603797fcaa47e09.tar.bz2
chat-6e2cb00008cbf09e556b00f87603797fcaa47e09.zip
Depenancy upgrades and movign to dep. (#8630)
Diffstat (limited to 'vendor/github.com/spf13/jwalterweatherman')
-rw-r--r--vendor/github.com/spf13/jwalterweatherman/default_notepad_test.go102
-rw-r--r--vendor/github.com/spf13/jwalterweatherman/notepad_test.go50
2 files changed, 0 insertions, 152 deletions
diff --git a/vendor/github.com/spf13/jwalterweatherman/default_notepad_test.go b/vendor/github.com/spf13/jwalterweatherman/default_notepad_test.go
deleted file mode 100644
index 2670c8d96..000000000
--- a/vendor/github.com/spf13/jwalterweatherman/default_notepad_test.go
+++ /dev/null
@@ -1,102 +0,0 @@
-// 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"
- "io/ioutil"
- "sync"
- "testing"
-
- "github.com/stretchr/testify/require"
-)
-
-func TestThresholds(t *testing.T) {
- SetStdoutThreshold(LevelError)
- require.Equal(t, StdoutThreshold(), LevelError)
- SetLogThreshold(LevelCritical)
- require.Equal(t, LogThreshold(), LevelCritical)
- require.NotEqual(t, StdoutThreshold(), LevelCritical)
- SetStdoutThreshold(LevelWarn)
- require.Equal(t, StdoutThreshold(), LevelWarn)
-}
-
-func TestDefaultLogging(t *testing.T) {
- var outputBuf, logBuf bytes.Buffer
-
- defaultNotepad.logHandle = &logBuf
- defaultNotepad.outHandle = &outputBuf
-
- SetLogThreshold(LevelWarn)
- SetStdoutThreshold(LevelError)
-
- FATAL.Println("fatal err")
- CRITICAL.Println("critical err")
- ERROR.Println("an error")
- WARN.Println("a warning")
- INFO.Println("information")
- DEBUG.Println("debugging info")
- TRACE.Println("trace")
-
- require.Contains(t, logBuf.String(), "fatal err")
- require.Contains(t, logBuf.String(), "critical err")
- require.Contains(t, logBuf.String(), "an error")
- require.Contains(t, logBuf.String(), "a warning")
- require.NotContains(t, logBuf.String(), "information")
- require.NotContains(t, logBuf.String(), "debugging info")
- require.NotContains(t, logBuf.String(), "trace")
-
- require.Contains(t, outputBuf.String(), "fatal err")
- require.Contains(t, outputBuf.String(), "critical err")
- require.Contains(t, outputBuf.String(), "an error")
- require.NotContains(t, outputBuf.String(), "a warning")
- require.NotContains(t, outputBuf.String(), "information")
- require.NotContains(t, outputBuf.String(), "debugging info")
- require.NotContains(t, outputBuf.String(), "trace")
-}
-
-func TestLogCounter(t *testing.T) {
- defaultNotepad.logHandle = ioutil.Discard
- defaultNotepad.outHandle = ioutil.Discard
-
- SetLogThreshold(LevelTrace)
- SetStdoutThreshold(LevelTrace)
-
- FATAL.Println("fatal err")
- CRITICAL.Println("critical err")
- WARN.Println("a warning")
- WARN.Println("another warning")
- INFO.Println("information")
- DEBUG.Println("debugging info")
- TRACE.Println("trace")
-
- wg := &sync.WaitGroup{}
-
- for i := 0; i < 10; i++ {
- wg.Add(1)
- go func() {
- defer wg.Done()
- for j := 0; j < 10; j++ {
- ERROR.Println("error", j)
- // check for data races
- require.True(t, LogCountForLevel(LevelError) > uint64(j))
- require.True(t, LogCountForLevelsGreaterThanorEqualTo(LevelError) > uint64(j))
- }
- }()
-
- }
-
- wg.Wait()
-
- require.Equal(t, uint64(1), LogCountForLevel(LevelFatal))
- require.Equal(t, uint64(1), LogCountForLevel(LevelCritical))
- require.Equal(t, uint64(2), LogCountForLevel(LevelWarn))
- require.Equal(t, uint64(1), LogCountForLevel(LevelInfo))
- require.Equal(t, uint64(1), LogCountForLevel(LevelDebug))
- require.Equal(t, uint64(1), LogCountForLevel(LevelTrace))
- require.Equal(t, uint64(100), LogCountForLevel(LevelError))
- require.Equal(t, uint64(102), LogCountForLevelsGreaterThanorEqualTo(LevelError))
-}
diff --git a/vendor/github.com/spf13/jwalterweatherman/notepad_test.go b/vendor/github.com/spf13/jwalterweatherman/notepad_test.go
deleted file mode 100644
index 69ad6f8fc..000000000
--- a/vendor/github.com/spf13/jwalterweatherman/notepad_test.go
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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")
-}
-
-func BenchmarkLogPrintOnlyToCounter(b *testing.B) {
- var logHandle, outHandle bytes.Buffer
- n := NewNotepad(LevelCritical, LevelCritical, &outHandle, &logHandle, "TestNotePad", 0)
-
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- n.INFO.Print("Test")
- }
-}