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.
Merge change request 01M70WES5ZZDJ6RP226WB11BBZ: Let people rename and remove their own passkeys
keenan · 1h ago
4b8c9e1d
| 1 | package web |
| 2 | |
| 3 | import ( |
| 4 | "io/fs" |
| 5 | "regexp" |
| 6 | "strings" |
| 7 | "testing" |
| 8 | ) |
| 9 | |
| 10 | func TestIconRendersInlineSVG(t *testing.T) { |
| 11 | got := string(icon("plus")) |
| 12 | if !strings.Contains(got, "<svg") || !strings.Contains(got, `aria-hidden="true"`) { |
| 13 | t.Fatalf("icon(plus) = %q", got) |
| 14 | } |
| 15 | if icon("no-such-icon") != "" { |
| 16 | t.Fatal("an unknown icon should render nothing") |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | // TestTemplatesOnlyUseKnownIcons catches a typo at test time instead of |
| 21 | // discovering an empty glyph on a page. |
| 22 | func TestTemplatesOnlyUseKnownIcons(t *testing.T) { |
| 23 | re := regexp.MustCompile(`\{\{icon "([^"]+)"\}\}`) |
| 24 | files, err := fs.Glob(templateFS, "templates/*.html") |
| 25 | if err != nil { |
| 26 | t.Fatal(err) |
| 27 | } |
| 28 | for _, name := range files { |
| 29 | body, err := fs.ReadFile(templateFS, name) |
| 30 | if err != nil { |
| 31 | t.Fatal(err) |
| 32 | } |
| 33 | for _, m := range re.FindAllStringSubmatch(string(body), -1) { |
| 34 | if _, ok := iconPaths[m[1]]; !ok { |
| 35 | t.Fatalf("%s uses unknown icon %q", name, m[1]) |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 |