func (st *CreateReportComment) Run() (string, error) { err := data.NewComment(st.reportID, data.CustomTime{time.Now()}, st.Comment) if err != nil { return response.StatusMsg(fmt.Sprintf("CreateReportComment failed: %q", err), st.start), nil } return response.StatusMsg("Comment created.", st.start), nil }
func TestAddComment1(t *testing.T) { fmt.Println("\n\n>>>>>>>>>>>>>>>>>>> TestAddComment1 <<<<<<<<<<<<<<<<<<<<<<<<<<") if e := data.NewComment(102, data.NewCustomTime("2015-11-08T08:08:08"), "Comment created by test case"); e != nil { t.Errorf("NewComment() failed - error: %q", e) } fmt.Printf("------ After add:\n%s\n", data.DisplayCommentData()) }