@@ -106,13 +106,28 @@ func TestSafeRemove(t *testing.T) {
106106}
107107
108108func TestCheckDuplicateAndRename (t * testing.T ) {
109+ // Test with extension
109110 doCheckDuplicateAndRename (t , []string {}, "a.txt" , "a.txt" )
110111 doCheckDuplicateAndRename (t , []string {"a.txt" }, "a.txt" , "a (1).txt" )
111112 doCheckDuplicateAndRename (t , []string {"a.txt" , "a (1).txt" }, "a.txt" , "a (2).txt" )
112113
114+ // Test without extension
113115 doCheckDuplicateAndRename (t , []string {}, "a" , "a" )
114116 doCheckDuplicateAndRename (t , []string {"a" }, "a" , "a (1)" )
115117 doCheckDuplicateAndRename (t , []string {"a" , "a (1)" }, "a" , "a (2)" )
118+
119+ // Test hidden files (starting with dot)
120+ doCheckDuplicateAndRename (t , []string {}, ".gitignore" , ".gitignore" )
121+ doCheckDuplicateAndRename (t , []string {".gitignore" }, ".gitignore" , ".gitignore (1)" )
122+ doCheckDuplicateAndRename (t , []string {".gitignore" , ".gitignore (1)" }, ".gitignore" , ".gitignore (2)" )
123+
124+ // Test hidden files with extension
125+ doCheckDuplicateAndRename (t , []string {}, ".config.json" , ".config.json" )
126+ doCheckDuplicateAndRename (t , []string {".config.json" }, ".config.json" , ".config (1).json" )
127+
128+ // Test multiple dots
129+ doCheckDuplicateAndRename (t , []string {}, "test.tar.gz" , "test.tar.gz" )
130+ doCheckDuplicateAndRename (t , []string {"test.tar.gz" }, "test.tar.gz" , "test.tar (1).gz" )
116131}
117132
118133func doCheckDuplicateAndRename (t * testing.T , exitsPaths []string , path string , except string ) {
0 commit comments