@@ -1130,3 +1130,58 @@ def test_convert_schema_to_rules_text() -> None:
11301130 )
11311131 == "path:*.js #frontend m@robenolt.com\n url:http://google.com/* #backend\n path:src/sentry/* david@sentry.io\n tags.foo:bar tagperson@sentry.io\n tags.foo:bar baz tagperson@sentry.io\n module:foo.bar #workflow\n module:foo bar meow@sentry.io\n "
11321132 )
1133+
1134+
1135+ @pytest .mark .parametrize (
1136+ "pattern, path_details, expected" ,
1137+ [
1138+ # Pattern WITHOUT leading slash
1139+ # Path WITH leading slash
1140+ # Does not match
1141+ (
1142+ "libs/web/views/index/**" ,
1143+ [
1144+ {"filename" : "/libs/web/views/index/src/widget-table.component.tsx" },
1145+ {"abs_path" : "/libs/web/views/index/src/widget-table.component.tsx" },
1146+ ],
1147+ False ,
1148+ ),
1149+ # Pattern WITH leading slash
1150+ # Path WITH leading slash
1151+ # Matches
1152+ (
1153+ "/libs/web/views/index/**" ,
1154+ [
1155+ {"filename" : "/libs/web/views/index/src/widget-table.component.tsx" },
1156+ {"abs_path" : "/libs/web/views/index/src/widget-table.component.tsx" },
1157+ ],
1158+ True ,
1159+ ),
1160+ # Pattern WITHOUT leading slash
1161+ # Path WITHOUT leading slash
1162+ # Matches
1163+ (
1164+ "libs/web/views/index/**" ,
1165+ [
1166+ {"filename" : "libs/web/views/index/src/widget-table.component.tsx" },
1167+ {"abs_path" : "libs/web/views/index/src/widget-table.component.tsx" },
1168+ ],
1169+ True ,
1170+ ),
1171+ # Pattern WITH leading slash
1172+ # Path WITHOUT leading slash
1173+ # Matches
1174+ (
1175+ "/libs/web/views/index/**" ,
1176+ [
1177+ {"filename" : "libs/web/views/index/home.tsx" },
1178+ {"abs_path" : "libs/web/views/index/home.tsx" },
1179+ ],
1180+ True ,
1181+ ),
1182+ ],
1183+ )
1184+ def test_codeowners_leading_slash_matching (
1185+ pattern : str , path_details : Sequence [Mapping [str , str ]], expected : bool
1186+ ) -> None :
1187+ _assert_matcher (Matcher ("codeowners" , pattern ), path_details , expected )
0 commit comments