Debian Codegraph @

internal/sender/flist_test.go

raw symbols SCIP
1 package sender
2
3 import "testing"
4
5 func TestPath(t *testing.T) {
6 for _, tt := range []struct {
7 requested string
8 wantRoot string
9 wantStrip string
10 }{
11 {
12 requested: "/", // sent by client
13 wantStrip: "",
14 },
15
16 {
17 requested: "tr/man5", // sent by client
18 wantStrip: "",
19 },
20
21 {
22 requested: "tr/", // sent by client
23 wantStrip: "tr/",
24 },
25
26 { // client started with src=/usr/share/man
27 requested: "", // sent by client
28 wantStrip: "",
29 },
30 } {
31 t.Run("requested="+tt.requested, func(t *testing.T) {
32 gotStrip := getStrip(tt.requested)
33 if gotStrip != tt.wantStrip {
34 t.Errorf("unexpected strip: got %q, want %q", gotStrip, tt.wantStrip)
35 }
36 })
37 }
38 }