func init() { var err error writer, err = syslog.New(syslog.LOG_INFO|syslog.LOG_USER, os.Args[0]) if err != nil { log.Errorf("can't connect to syslog") writer = nil } event.AddListener(listener) }
func TestUpdateDispatch(t *testing.T) { triggered := false event.AddListener(func(ev *testEvent) { triggered = true }) want := "status" ev := &testEvent{} event.DispatchUpdate(ev, "status") if ev.Status != want { t.Errorf("ev.Status = %#v, want %#v", ev.Status, want) } if !triggered { t.Errorf("listener wasn't triggered on Dispatch()") } }