Пример #1
0
func TestDebug(t *testing.T) {
	c := testutil.NewStdoutCapturer()
	initForTest()

	c.Start()
	Debug("testmessage")
	output := c.Stop()

	expected := "2015-04-01 12:34:56.789 [DBG] testmessage\n"
	if output != expected {
		t.Errorf("Unexpected output message")
		t.Logf("Expected: %s", expected)
		t.Logf("Actual: %s", output)
	}
}
Пример #2
0
func TestDebug_Invalid(t *testing.T) {
	c := testutil.NewStdoutCapturer()
	initForTest()
	isValid = false

	c.Start()
	Debug("testmessage")
	output := c.Stop()

	expected := ""
	if output != expected {
		t.Errorf("Unexpected output message")
		t.Logf("Expected: %s", expected)
		t.Logf("Actual: %s", output)
	}
}