Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

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.

Blame · server/web/file_icons_test.go

Line attribution on main · 34 line(s)

09b15120
Keenan Nemetz
15d ago
1 package web
2
8dc56e4e
Keenan Nemetz
9d ago
3 import (
4 "testing"
5
d37d301f
Keenan Nemetz
17h ago
6 "rodent.software/vole/internal/lang"
8dc56e4e
Keenan Nemetz
9d ago
7 )
09b15120
Keenan Nemetz
15d ago
8
9 func TestFileIconsChooseByExtension(t *testing.T) {
10 t.Parallel()
11 for _, c := range []struct {
12 name, icon, class string
13 }{
14 {"main.go", "file-code", "lang-go"},
15 {"src/lib.rs", "file-code", "lang-rust"},
16 {"docs/readme.md", "book-open", "lang-text"},
17 {"config.yml", "sliders-horizontal", "lang-config"},
18 {"run.sh", "terminal", "lang-sh"},
19 {"logo.svg", "image", "lang-image"},
20 {"go.sum", "file-code", "lang-go"},
21 {"Dockerfile", "server", "lang-build"},
22 {"LICENSE", "file", ""},
23 } {
24 if got := fileIcon(c.name); got != c.icon {
25 t.Errorf("%s icon = %q, want %q", c.name, got, c.icon)
26 }
8dc56e4e
Keenan Nemetz
9d ago
27 if got := lang.Class(c.name); got != c.class {
09b15120
Keenan Nemetz
15d ago
28 t.Errorf("%s class = %q, want %q", c.name, got, c.class)
29 }
30 if _, ok := iconPaths[c.icon]; !ok {
31 t.Errorf("%s uses unknown icon %q", c.name, c.icon)
32 }
33 }
34 }