示例#1
0
文件: say_test.go 项目: go-say/say
func TestInvalidData(t *testing.T) {
	expect(t, func() {
		log := NewLogger(SkipStackFrames(-1))
		log.Info("foo", "a")
		log.Event("")
		log.Event("f\noo:")
		log.Event("foo:")
		log.Events("foo=", 2)
		log.Gauge("\tfoo", 2)
		log.Value("=foo", 2)
		log.NewTiming().Say(":foo")
		log.Info("foo", "a")
		log.Info("foo", true, "foo")
		log.Info("foo", "foo\t", "bar")
	}, []string{
		"ERROR " + errOddNumArgs.Error(),
		"INFO  foo",
		"ERROR " + errKeyEmpty.Error(),
		"ERROR " + errKeyInvalid.Error(),
		"ERROR " + errKeyInvalid.Error(),
		"ERROR " + errKeyInvalid.Error(),
		"ERROR " + errKeyInvalid.Error(),
		"ERROR " + errKeyInvalid.Error(),
		"ERROR " + errKeyInvalid.Error(),
		"ERROR " + errOddNumArgs.Error(),
		"INFO  foo",
		"ERROR " + errKeyNotString.Error(),
		"INFO  foo",
		"ERROR " + errKeyInvalid.Error(),
		"INFO  foo",
	})
}
示例#2
0
文件: say_test.go 项目: go-say/say
func TestInvalidKeys(t *testing.T) {
	expect(t, func() {
		log := NewLogger(SkipStackFrames(-1))
		log.Event("")
		log.Event("\n")
		log.Event("foo\t")
		log.Event("foo:bar")
		log.Event("=bar")
	}, []string{
		"ERROR " + errKeyEmpty.Error(),
		"ERROR " + errKeyInvalid.Error(),
		"ERROR " + errKeyInvalid.Error(),
		"ERROR " + errKeyInvalid.Error(),
		"ERROR " + errKeyInvalid.Error(),
	})
}