vole
Clone
Read only, no credentials:
https://rodent.software/git/vole.git
Write over SSH with a registered key:
git clone ssh://git@0.0.0.0:2222/vole.git
A free and open-source forge that lives in your Git repo.
|
de84c32b
Keenan Nemetz
5d ago
|
1 | package web |
| 2 | ||
| 3 | import "testing" | |
| 4 | ||
| 5 | // TestNumberedTitle pins the order a document title reads in: the numbered item | |
| 6 | // the reader asked for first, then the tab it belongs to, then the repository. | |
|
6ce635a8
Keenan Nemetz
1d ago
|
7 | // The chrome appends the site name, so the least specific part always comes |
|
de84c32b
Keenan Nemetz
5d ago
|
8 | // last. A repository that did not number the entity keeps the `#?` label rather |
| 9 | // than silently dropping the number. | |
| 10 | func TestNumberedTitle(t *testing.T) { | |
| 11 | cases := []struct { | |
| 12 | name string | |
| 13 | number int | |
| 14 | title, section string | |
| 15 | repo string | |
| 16 | want string | |
| 17 | }{ | |
| 18 | {name: "issue", number: 42, title: "Crash on start", repo: "vole", want: "#42 Crash on start · vole"}, | |
| 19 | {name: "change tab", number: 7, title: "Tidy the parser", section: "changes", repo: "vole", | |
| 20 | want: "#7 Tidy the parser · changes · vole"}, | |
| 21 | {name: "unnumbered", number: 0, title: "No number", repo: "vole", want: "#? No number · vole"}, | |
| 22 | } | |
| 23 | for _, c := range cases { | |
| 24 | t.Run(c.name, func(t *testing.T) { | |
| 25 | if got := numberedTitle(c.number, c.title, c.section, c.repo); got != c.want { | |
| 26 | t.Fatalf("numberedTitle(%d, %q, %q, %q) = %q, want %q", | |
| 27 | c.number, c.title, c.section, c.repo, got, c.want) | |
| 28 | } | |
| 29 | }) | |
| 30 | } | |
| 31 | } |