From 20770ff5e6d4af0c16552ee8a04c02041e356b37 Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Wed, 23 Mar 2022 07:13:55 -0600 Subject: [PATCH] update tests for mst --- pttodo/action.go | 6 +++++- pttodo/root_test.go | 13 ++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/pttodo/action.go b/pttodo/action.go index 8a43336..b1e5573 100644 --- a/pttodo/action.go +++ b/pttodo/action.go @@ -1,5 +1,9 @@ package pttodo +/* + action is something like 'send an email on trigger' but is not impl or use +*/ + import ( "errors" "local/sandbox/contact/contact" @@ -21,7 +25,7 @@ func (action Action) CB() (func() error, error) { u, _ := url.Parse(action.String()) switch u.Scheme { case "email": - return action.email + return action.email, nil } if actionEmailPattern.MatchString(action.String()) { return action.email, nil diff --git a/pttodo/root_test.go b/pttodo/root_test.go index cad3efb..29453be 100644 --- a/pttodo/root_test.go +++ b/pttodo/root_test.go @@ -1,6 +1,7 @@ package pttodo import ( + "bytes" "encoding/json" "fmt" "strconv" @@ -163,17 +164,19 @@ func TestRootMarshalYAMLWriteTS(t *testing.T) { if err != nil { t.Fatal(err) } - if strings.TrimSpace(string(got)) != strings.TrimSpace(` + got = bytes.TrimSpace(got) + want := strings.TrimSpace(` todo: - todo scheduled: - todo: sched schedule: "2099-01-01" - ts: Wed Dec 31 19:00:02 EST 1969 + ts: Wed Dec 31 17:00:02 MST 1969 done: - todo: done - ts: Wed Dec 31 19:00:03 EST 1969 - `) { - t.Fatal(string(got)) + ts: Wed Dec 31 17:00:03 MST 1969 + `) + if string(got) != want { + t.Fatalf("want\n\t%q, got\n\t%q", want, string(got)) } }