MCPcopy Create free account
hub / github.com/google/git-appraise / TestCommentSorting

Function TestCommentSorting

review/review_test.go:27–58  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25)
26
27func TestCommentSorting(t *testing.T) {
28 sampleComments := []*comment.Comment{
29 &comment.Comment{
30 Timestamp: "012400",
31 Description: "Fourth",
32 },
33 &comment.Comment{
34 Timestamp: "012400",
35 Description: "Fifth",
36 },
37 &comment.Comment{
38 Timestamp: "012346",
39 Description: "Second",
40 },
41 &comment.Comment{
42 Timestamp: "012345",
43 Description: "First",
44 },
45 &comment.Comment{
46 Timestamp: "012347",
47 Description: "Third",
48 },
49 }
50 sort.Stable(commentsByTimestamp(sampleComments))
51 descriptions := []string{}
52 for _, comment := range sampleComments {
53 descriptions = append(descriptions, comment.Description)
54 }
55 if !(descriptions[0] == "First" && descriptions[1] == "Second" && descriptions[2] == "Third" && descriptions[3] == "Fourth" && descriptions[4] == "Fifth") {
56 t.Fatalf("Comment ordering failed. Got %v", sampleComments)
57 }
58}
59
60func TestThreadSorting(t *testing.T) {
61 sampleThreads := []CommentThread{

Callers

nothing calls this directly

Calls 1

commentsByTimestampTypeAlias · 0.85

Tested by

no test coverage detected