MCPcopy Index your code
hub / github.com/dunglas/httpsfv / TestParseKey

Function TestParseKey

key_test.go:41–69  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

39}
40
41func TestParseKey(t *testing.T) {
42 t.Parallel()
43
44 data := []struct {
45 in string
46 expected string
47 err bool
48 }{
49 {"t", "t", false},
50 {"tok", "tok", false},
51 {"*k-.*", "*k-.*", false},
52 {"k=", "k", false},
53 {"", "", true},
54 {"é", "", true},
55 }
56
57 for _, d := range data {
58 s := &scanner{data: d.in}
59
60 i, err := parseKey(s)
61 if d.err && err == nil {
62 t.Errorf("parseKey(%s): error expected", d.in)
63 }
64
65 if !d.err && d.expected != i {
66 t.Errorf("parseKey(%s) = %v, %v; %v, <nil> expected", d.in, i, err, d.expected)
67 }
68 }
69}

Callers

nothing calls this directly

Calls 1

parseKeyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…