MCPcopy Index your code
hub / github.com/syncthing/syncthing / TestPrefixMatch

Function TestPrefixMatch

lib/api/api_test.go:1632–1652  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1630}
1631
1632func TestPrefixMatch(t *testing.T) {
1633 t.Parallel()
1634
1635 cases := []struct {
1636 s string
1637 prefix string
1638 expected int
1639 }{
1640 {"aaaA", "aaa", matchExact},
1641 {"AAAX", "BBB", noMatch},
1642 {"AAAX", "aAa", matchCaseIns},
1643 {"äÜX", "äü", matchCaseIns},
1644 }
1645
1646 for _, tc := range cases {
1647 ret := checkPrefixMatch(tc.s, tc.prefix)
1648 if ret != tc.expected {
1649 t.Errorf("checkPrefixMatch(%q, %q) => %v, expected %v", tc.s, tc.prefix, ret, tc.expected)
1650 }
1651 }
1652}
1653
1654func TestShouldRegenerateCertificate(t *testing.T) {
1655 // Self signed certificates expiring in less than a month are errored so we

Callers

nothing calls this directly

Calls 1

checkPrefixMatchFunction · 0.85

Tested by

no test coverage detected