MCPcopy
hub / github.com/caddyserver/caddy / TestNotMatcher

Function TestNotMatcher

modules/caddyhttp/matchers_test.go:1105–1219  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1103}
1104
1105func TestNotMatcher(t *testing.T) {
1106 for i, tc := range []struct {
1107 host, path string
1108 match MatchNot
1109 expect bool
1110 }{
1111 {
1112 host: "example.com", path: "/",
1113 match: MatchNot{},
1114 expect: true,
1115 },
1116 {
1117 host: "example.com", path: "/foo",
1118 match: MatchNot{
1119 MatcherSets: []MatcherSet{
1120 {
1121 MatchPath{"/foo"},
1122 },
1123 },
1124 },
1125 expect: false,
1126 },
1127 {
1128 host: "example.com", path: "/bar",
1129 match: MatchNot{
1130 MatcherSets: []MatcherSet{
1131 {
1132 MatchPath{"/foo"},
1133 },
1134 },
1135 },
1136 expect: true,
1137 },
1138 {
1139 host: "example.com", path: "/bar",
1140 match: MatchNot{
1141 MatcherSets: []MatcherSet{
1142 {
1143 MatchPath{"/foo"},
1144 },
1145 {
1146 MatchHost{"example.com"},
1147 },
1148 },
1149 },
1150 expect: false,
1151 },
1152 {
1153 host: "example.com", path: "/bar",
1154 match: MatchNot{
1155 MatcherSets: []MatcherSet{
1156 {
1157 MatchPath{"/bar"},
1158 },
1159 {
1160 MatchHost{"example.com"},
1161 },
1162 },

Callers

nothing calls this directly

Calls 2

WithValueMethod · 0.80
MatchWithErrorMethod · 0.65

Tested by

no test coverage detected