MCPcopy Create free account
hub / github.com/diillson/chatcli / TestPrefixRouteMatches

Function TestPrefixRouteMatches

cli/command_handler_routing_test.go:51–67  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func TestPrefixRouteMatches(t *testing.T) {
52 word := prefixRoute{prefix: "/export", word: true}
53 if !word.matches("/export") || !word.matches("/export f") {
54 t.Error("word route should match exact and prefix+space")
55 }
56 if word.matches("/exporting") || word.matches("/exportx") {
57 t.Error("word route must not match a longer token")
58 }
59
60 raw := prefixRoute{prefix: "/session", word: false}
61 if !raw.matches("/session") || !raw.matches("/session list") || !raw.matches("/sessionx") {
62 t.Error("raw route should match by bare prefix")
63 }
64 if raw.matches("/sess") {
65 t.Error("raw route must not match a shorter string")
66 }
67}

Callers

nothing calls this directly

Calls 2

matchesMethod · 0.95
ErrorMethod · 0.65

Tested by

no test coverage detected