(t *testing.T)
| 2092 | } |
| 2093 | |
| 2094 | func TestIssue3028(t *testing.T) { |
| 2095 | w, cancel := newConfigWrapper(defaultCfg) |
| 2096 | defer cancel() |
| 2097 | ffs := w.FolderList()[0].Filesystem() |
| 2098 | m := setupModel(t, w) |
| 2099 | defer cleanupModel(m) |
| 2100 | |
| 2101 | // Create two files that we'll delete, one with a name that is a prefix of the other. |
| 2102 | |
| 2103 | writeFile(t, ffs, "testrm", []byte("Hello")) |
| 2104 | writeFile(t, ffs, "testrm2", []byte("Hello")) |
| 2105 | |
| 2106 | // Scan, and get a count of how many files are there now |
| 2107 | |
| 2108 | m.ScanFolderSubdirs("default", []string{"testrm", "testrm2"}) |
| 2109 | locorigfiles := mustV(m.LocalSize("default", protocol.LocalDeviceID)).Files |
| 2110 | globorigfiles := mustV(m.GlobalSize("default")).Files |
| 2111 | |
| 2112 | // Delete |
| 2113 | |
| 2114 | must(t, ffs.Remove("testrm")) |
| 2115 | must(t, ffs.Remove("testrm2")) |
| 2116 | |
| 2117 | // Verify that the number of files decreased by two and the number of |
| 2118 | // deleted files increases by two |
| 2119 | |
| 2120 | m.ScanFolderSubdirs("default", []string{"testrm", "testrm2"}) |
| 2121 | loc := mustV(m.LocalSize("default", protocol.LocalDeviceID)) |
| 2122 | glob := mustV(m.GlobalSize("default")) |
| 2123 | |
| 2124 | if loc.Files != locorigfiles-2 { |
| 2125 | t.Errorf("Incorrect local accounting; got %d current files, expected %d", loc.Files, locorigfiles-2) |
| 2126 | } |
| 2127 | if glob.Files != globorigfiles-2 { |
| 2128 | t.Errorf("Incorrect global accounting; got %d current files, expected %d", glob.Files, globorigfiles-2) |
| 2129 | } |
| 2130 | if loc.Deleted != 2 { |
| 2131 | t.Errorf("Incorrect local accounting; got %d deleted files, expected 2", loc.Deleted) |
| 2132 | } |
| 2133 | if glob.Deleted != 2 { |
| 2134 | t.Errorf("Incorrect global accounting; got %d deleted files, expected 2", glob.Deleted) |
| 2135 | } |
| 2136 | } |
| 2137 | |
| 2138 | func TestIssue4357(t *testing.T) { |
| 2139 | cfg := defaultCfgWrapper.RawCopy() |
nothing calls this directly
no test coverage detected