From 5f1d46c7b2e46a857ac0c2ccb6eb290ea4fb589e Mon Sep 17 00:00:00 2001 From: Adhityaa Chandrasekar Date: Sun, 10 Mar 2019 09:23:34 -0400 Subject: [PATCH] comment_count_test.go: use array of strings --- api/comment_count_test.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/api/comment_count_test.go b/api/comment_count_test.go index dac31ac..89cc004 100644 --- a/api/comment_count_test.go +++ b/api/comment_count_test.go @@ -14,14 +14,14 @@ func TestCommentCountBasics(t *testing.T) { commentNew(commenterHex, "example.com", "/path.html", "root", "**bar**", "approved", time.Now().UTC()) commentNew(commenterHex, "example.com", "/path.html", "root", "**baz**", "unapproved", time.Now().UTC()) - count, err := commentCount("example.com", "/path.html") + counts, err := commentCount("example.com", []string{"/path.html"}) if err != nil { t.Errorf("unexpected error counting comments: %v", err) return } - if count != 2 { - t.Errorf("expected count=2 got count=%d", count) + if counts["/path.html"] != 2 { + t.Errorf("expected count=2 got count=%d", counts["/path.html"]) return } } @@ -29,25 +29,25 @@ func TestCommentCountBasics(t *testing.T) { func TestCommentCountNewPage(t *testing.T) { failTestOnError(t, setupTestEnv()) - count, err := commentCount("example.com", "/path.html") + counts, err := commentCount("example.com", []string{"/path.html"}) if err != nil { t.Errorf("unexpected error counting comments: %v", err) return } - if count != 0 { - t.Errorf("expected count=0 got count=%d", count) + if counts["/path.html"] != 0 { + t.Errorf("expected count=0 got count=%d", counts["/path.html"]) return } } func TestCommentCountEmpty(t *testing.T) { - if _, err := commentCount("example.com", ""); err != nil { + if _, err := commentCount("example.com", []string{""}); err != nil { t.Errorf("unexpected error counting comments on empty path: %v", err) return } - if _, err := commentCount("", ""); err == nil { + if _, err := commentCount("", []string{""}); err == nil { t.Errorf("expected error not found counting comments with empty everything") return }