diff options
author | obscuren <geffobscura@gmail.com> | 2014-07-07 16:53:25 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-07-07 16:53:25 +0800 |
commit | 9dab7dcc3c99d387ad2c0a1623b574d3023bdfae (patch) | |
tree | 8f98cce69568d29a954410e18dce8c121d25592e /ethlog/loggers_test.go | |
parent | d40cba3042564f3471aa20a5cf477cafcacc2189 (diff) | |
parent | b958179263aa1fa5060dd5d5848b8bb092a4165c (diff) | |
download | dexon-9dab7dcc3c99d387ad2c0a1623b574d3023bdfae.tar.gz dexon-9dab7dcc3c99d387ad2c0a1623b574d3023bdfae.tar.zst dexon-9dab7dcc3c99d387ad2c0a1623b574d3023bdfae.zip |
Merge branch 'develop' of github.com-obscure:ethereum/eth-go into develop
Diffstat (limited to 'ethlog/loggers_test.go')
-rw-r--r-- | ethlog/loggers_test.go | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/ethlog/loggers_test.go b/ethlog/loggers_test.go index 89f416681..9fff471c1 100644 --- a/ethlog/loggers_test.go +++ b/ethlog/loggers_test.go @@ -28,10 +28,6 @@ func (t *TestLogSystem) GetLogLevel() LogLevel { return t.level } -func quote(s string) string { - return fmt.Sprintf("'%s'", s) -} - func TestLoggerPrintln(t *testing.T) { logger := NewLogger("TEST") testLogSystem := &TestLogSystem{level: WarnLevel} @@ -41,10 +37,10 @@ func TestLoggerPrintln(t *testing.T) { logger.Infoln("info") logger.Debugln("debug") Flush() + Reset() output := testLogSystem.Output - fmt.Println(quote(output)) if output != "[TEST] error\n[TEST] warn\n" { - t.Error("Expected logger output '[TEST] error\\n[TEST] warn\\n', got ", quote(testLogSystem.Output)) + t.Error("Expected logger output '[TEST] error\\n[TEST] warn\\n', got ", testLogSystem.Output) } } @@ -57,10 +53,10 @@ func TestLoggerPrintf(t *testing.T) { logger.Infof("info") logger.Debugf("debug") Flush() + Reset() output := testLogSystem.Output - fmt.Println(quote(output)) if output != "[TEST] error to { 2}\n[TEST] warn" { - t.Error("Expected logger output '[TEST] error to { 2}\\n[TEST] warn', got ", quote(testLogSystem.Output)) + t.Error("Expected logger output '[TEST] error to { 2}\\n[TEST] warn', got ", testLogSystem.Output) } } @@ -73,13 +69,14 @@ func TestMultipleLogSystems(t *testing.T) { logger.Errorln("error") logger.Warnln("warn") Flush() + Reset() output0 := testLogSystem0.Output output1 := testLogSystem1.Output if output0 != "[TEST] error\n" { - t.Error("Expected logger 0 output '[TEST] error\\n', got ", quote(testLogSystem0.Output)) + t.Error("Expected logger 0 output '[TEST] error\\n', got ", testLogSystem0.Output) } if output1 != "[TEST] error\n[TEST] warn\n" { - t.Error("Expected logger 1 output '[TEST] error\\n[TEST] warn\\n', got ", quote(testLogSystem1.Output)) + t.Error("Expected logger 1 output '[TEST] error\\n[TEST] warn\\n', got ", testLogSystem1.Output) } } @@ -92,11 +89,11 @@ func TestFileLogSystem(t *testing.T) { logger.Errorf("error to %s\n", filename) logger.Warnln("warn") Flush() + Reset() contents, _ := ioutil.ReadFile(filename) output := string(contents) - fmt.Println(quote(output)) if output != "[TEST] error to test.log\n[TEST] warn\n" { - t.Error("Expected contents of file 'test.log': '[TEST] error to test.log\\n[TEST] warn\\n', got ", quote(output)) + t.Error("Expected contents of file 'test.log': '[TEST] error to test.log\\n[TEST] warn\\n', got ", output) } else { os.Remove(filename) } @@ -105,5 +102,7 @@ func TestFileLogSystem(t *testing.T) { func TestNoLogSystem(t *testing.T) { logger := NewLogger("TEST") logger.Warnln("warn") + fmt.Println("1") Flush() + Reset() } |