diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-11 21:11:17 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-11 21:11:17 +0200 |
| commit | c5ecbb89cf4035923fab6c3bd20ebe6cbcd06d49 (patch) | |
| tree | 77103dcfde5f72145b34006f93317ccf9e33edf5 | |
| parent | 414d18f158df079d6526d88ae7c689c8212d4d65 (diff) | |
fix(showcase): compact rank history displayv0.15.2
| -rw-r--r-- | internal/showcase/rank_history.go | 8 | ||||
| -rw-r--r-- | internal/showcase/rank_history_test.go | 11 | ||||
| -rw-r--r-- | internal/showcase/showcase_test.go | 4 | ||||
| -rw-r--r-- | internal/version/version.go | 2 |
4 files changed, 14 insertions, 11 deletions
diff --git a/internal/showcase/rank_history.go b/internal/showcase/rank_history.go index 434332f..7f62453 100644 --- a/internal/showcase/rank_history.go +++ b/internal/showcase/rank_history.go @@ -163,7 +163,7 @@ func movementArrow(currentSpot, olderSpot int) string { return "·" } if currentSpot == olderSpot { - return "→" + return "=" } if currentSpot < olderSpot { return "↑" @@ -184,17 +184,17 @@ func formatRankHistoryForHeader(history []RepoRankHistory) string { spot := fmt.Sprintf("#%d", point.Spot) if i == 0 { - tokens = append(tokens, fmt.Sprintf("%s(%s)", spot, point.Anchor)) + tokens = append(tokens, spot) continue } - tokens = append(tokens, fmt.Sprintf("%s%s(%s)", point.Arrow, spot, point.Anchor)) + tokens = append(tokens, point.Arrow+spot) } if len(tokens) == 0 { return "" } - return " [" + strings.Join(tokens, " ") + "]" + return " · " + strings.Join(tokens, "") } func anchorLabel(i int) string { diff --git a/internal/showcase/rank_history_test.go b/internal/showcase/rank_history_test.go index f14d23a..6e010a7 100644 --- a/internal/showcase/rank_history_test.go +++ b/internal/showcase/rank_history_test.go @@ -16,7 +16,7 @@ func TestMovementArrow(t *testing.T) { older int want string }{ - {name: "same spot", current: 3, older: 3, want: "→"}, + {name: "same spot", current: 3, older: 3, want: "="}, {name: "improved", current: 2, older: 5, want: "↑"}, {name: "worse", current: 6, older: 4, want: "↓"}, {name: "missing older", current: 2, older: 0, want: "·"}, @@ -137,16 +137,19 @@ func TestFormatRankHistoryForHeader(t *testing.T) { header := formatRankHistoryForHeader([]RepoRankHistory{ {Spot: 3, Anchor: "now"}, {Spot: 2, Anchor: "1w", Arrow: "↓"}, - {Spot: 2, Anchor: "2w", Arrow: "→"}, + {Spot: 2, Anchor: "2w", Arrow: "="}, {Spot: 0, Anchor: "3w", Arrow: "·"}, }) - if !strings.Contains(header, "#3(now)") { + if !strings.Contains(header, "· #3") { t.Fatalf("header missing current spot: %s", header) } - if !strings.Contains(header, "↓#2(1w)") { + if !strings.Contains(header, "↓#2") { t.Fatalf("header missing down movement: %s", header) } + if !strings.Contains(header, "=#2") { + t.Fatalf("header missing unchanged movement marker: %s", header) + } if strings.Contains(header, "n/a") { t.Fatalf("header should omit missing history points: %s", header) } diff --git a/internal/showcase/showcase_test.go b/internal/showcase/showcase_test.go index 125de63..7d095c0 100644 --- a/internal/showcase/showcase_test.go +++ b/internal/showcase/showcase_test.go @@ -113,14 +113,14 @@ func TestFormatGemtext_IncludesRankHistoryInHeader(t *testing.T) { RankHistory: []RepoRankHistory{ {Spot: 1, Anchor: "now"}, {Spot: 2, Anchor: "1w", Arrow: "↑"}, - {Spot: 2, Anchor: "2w", Arrow: "→"}, + {Spot: 2, Anchor: "2w", Arrow: "="}, {Spot: 0, Anchor: "3w", Arrow: "·"}, {Spot: 4, Anchor: "4w", Arrow: "↓"}, }, }, }) - if !strings.Contains(content, "### 1. alpha [#1(now) ↑#2(1w) →#2(2w) ↓#4(4w)]") { + if !strings.Contains(content, "### 1. alpha · #1↑#2=#2↓#4") { t.Fatalf("rank history was not rendered in header: %s", content) } } diff --git a/internal/version/version.go b/internal/version/version.go index 8a7c099..8928856 100644 --- a/internal/version/version.go +++ b/internal/version/version.go @@ -7,7 +7,7 @@ import ( var ( // Version is the current version of gitsyncer - Version = "0.15.1" + Version = "0.15.2" // GitCommit is the git commit hash at build time GitCommit = "unknown" |
