@@ -32,13 +32,48 @@ def test_convert_bmignore_to_rclone_filters_creates_and_converts(config_home):
3232 # Comments/empties preserved
3333 assert "# comment" in content
3434 assert "" in content
35- # Directory pattern becomes recursive exclude
35+ # Plain and wildcard patterns exclude direct matches and recursive contents.
36+ assert "- node_modules" in content
3637 assert "- node_modules/**" in content
37- # Wildcard pattern becomes simple exclude
3838 assert "- *.pyc" in content
39+ assert "- *.pyc/**" in content
40+ assert "- .git" in content
3941 assert "- .git/**" in content
4042
4143
44+ def test_convert_bmignore_to_rclone_filters_excludes_files_and_hidden_directory_contents (
45+ config_home ,
46+ ):
47+ bmignore = get_bmignore_path ()
48+ bmignore .parent .mkdir (parents = True , exist_ok = True )
49+ bmignore .write_text ("config.json\n .*\n node_modules/**\n " , encoding = "utf-8" )
50+
51+ rclone_filter = convert_bmignore_to_rclone_filters ()
52+ content = rclone_filter .read_text (encoding = "utf-8" ).splitlines ()
53+
54+ assert "- config.json" in content
55+ assert "- config.json/**" in content
56+ assert "- .*" in content
57+ assert "- .*/**" in content
58+ assert "- node_modules" in content
59+ assert "- node_modules/**" in content
60+
61+
62+ def test_convert_bmignore_to_rclone_filters_preserves_directory_only_patterns (config_home ):
63+ bmignore = get_bmignore_path ()
64+ bmignore .parent .mkdir (parents = True , exist_ok = True )
65+ bmignore .write_text ("cache/\n config.json/**\n " , encoding = "utf-8" )
66+
67+ rclone_filter = convert_bmignore_to_rclone_filters ()
68+ content = rclone_filter .read_text (encoding = "utf-8" ).splitlines ()
69+
70+ assert "- cache/" in content
71+ assert "- cache/**" in content
72+ assert "- cache" not in content
73+ assert "- config.json" in content
74+ assert "- config.json/**" in content
75+
76+
4277def test_convert_bmignore_to_rclone_filters_is_cached_when_up_to_date (config_home ):
4378 bmignore = get_bmignore_path ()
4479 bmignore .parent .mkdir (parents = True , exist_ok = True )
0 commit comments