Disable trace logging when running tests

This commit is contained in:
Gunnsteinn Hall 2018-08-01 13:19:05 +00:00
parent 527b1f057b
commit 7fe68915cc
3 changed files with 9 additions and 13 deletions

View File

@ -2,12 +2,11 @@ package core
import (
"testing"
"github.com/unidoc/unidoc/common"
)
func init() {
common.SetLogger(common.NewConsoleLogger(common.LogLevelTrace))
// Uncomment when debugging to get trace logging output - to follow flow.
// common.SetLogger(common.NewConsoleLogger(common.LogLevelTrace))
}
// Fuzz tests based on findings with go-fuzz.
@ -74,7 +73,7 @@ endstream
// Slightly more complex case where the reference number is incorrect, but still points to the same object.
func TestFuzzSelfReference2(t *testing.T) {
common.SetLogger(common.NewConsoleLogger(common.LogLevelTrace))
// common.SetLogger(common.NewConsoleLogger(common.LogLevelTrace))
rawText := `13 0 obj
<< /Length 12 0 R >>

View File

@ -7,13 +7,12 @@ package cmap
import (
"testing"
"github.com/unidoc/unidoc/common"
)
func init() {
// Uncomment when debugging to get debug or trace logging output.
//common.SetLogger(common.NewConsoleLogger(common.LogLevelDebug))
common.SetLogger(common.NewConsoleLogger(common.LogLevelTrace))
//common.SetLogger(common.NewConsoleLogger(common.LogLevelTrace))
}
// cmap1Data represents a basic CMap.
@ -58,8 +57,6 @@ end
// TestCMapParser tests basic loading of a simple CMap.
func TestCMapParser1(t *testing.T) {
common.SetLogger(common.NewConsoleLogger(common.LogLevelTrace))
cmap, err := LoadCmapFromData([]byte(cmap1Data))
if err != nil {
t.Error("Failed: ", err)
@ -152,7 +149,7 @@ end
// TestCMapParser2 tests a bug that came up when 2-byte character codes had the higher byte set to 0,
// e.g. 0x0080, and the character map was not taking the number of bytes of the input codemap into account.
func TestCMapParser2(t *testing.T) {
common.SetLogger(common.NewConsoleLogger(common.LogLevelTrace))
//common.SetLogger(common.NewConsoleLogger(common.LogLevelTrace))
cmap, err := LoadCmapFromData([]byte(cmap2Data))
if err != nil {
@ -244,7 +241,7 @@ endcmap
// TestCMapParser3 test case of a CMap with mixed number of 1 and 2 bytes in the codespace range.
func TestCMapParser3(t *testing.T) {
common.SetLogger(common.NewConsoleLogger(common.LogLevelTrace))
//common.SetLogger(common.NewConsoleLogger(common.LogLevelTrace))
cmap, err := LoadCmapFromData([]byte(cmapData3))
if err != nil {

View File

@ -3,12 +3,12 @@ package model
import (
"testing"
"github.com/unidoc/unidoc/common"
"github.com/unidoc/unidoc/pdf/core"
)
func init() {
common.SetLogger(common.NewConsoleLogger(common.LogLevelTrace))
// Uncomment when debugging to get trace logging output - to follow flow.
// common.SetLogger(common.NewConsoleLogger(common.LogLevelTrace))
}
// Test for an endless recursive loop in