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

Function TestParseToken

token_test.go:63–91  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

61}
62
63func TestParseToken(t *testing.T) {
64 t.Parallel()
65
66 data := []struct {
67 in string
68 out Token
69 err bool
70 }{
71 {"t", Token("t"), false},
72 {"tok", Token("tok"), false},
73 {"*t!o&k", Token("*t!o&k"), false},
74 {"t=", Token("t"), false},
75 {"", Token(""), true},
76 {"é", Token(""), true},
77 }
78
79 for _, d := range data {
80 s := &scanner{data: d.in}
81
82 i, err := parseToken(s)
83 if d.err && err == nil {
84 t.Errorf("parseToken(%s): error expected", d.in)
85 }
86
87 if !d.err && d.out != i {
88 t.Errorf("parseToken(%s) = %v, %v; %v, <nil> expected", d.in, i, err, d.out)
89 }
90 }
91}

Callers

nothing calls this directly

Calls 2

TokenTypeAlias · 0.85
parseTokenFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…