MCPcopy
hub / github.com/syncthing/syncthing / TestEmptyIgnores

Function TestEmptyIgnores

lib/model/model_test.go:1625–1652  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1623}
1624
1625func TestEmptyIgnores(t *testing.T) {
1626 w, cancel := newConfigWrapper(defaultCfg)
1627 defer cancel()
1628 ffs := w.FolderList()[0].Filesystem()
1629 m := setupModel(t, w)
1630 defer cleanupModel(m)
1631
1632 if err := m.SetIgnores("default", []string{}); err != nil {
1633 t.Error(err)
1634 }
1635 if _, err := ffs.Stat(".stignore"); err == nil {
1636 t.Error(".stignore was created despite being empty")
1637 }
1638
1639 if err := m.SetIgnores("default", []string{".*", "quux"}); err != nil {
1640 t.Error(err)
1641 }
1642 if _, err := ffs.Stat(".stignore"); os.IsNotExist(err) {
1643 t.Error(".stignore does not exist")
1644 }
1645
1646 if err := m.SetIgnores("default", []string{}); err != nil {
1647 t.Error(err)
1648 }
1649 if _, err := ffs.Stat(".stignore"); err == nil {
1650 t.Error(".stignore should have been deleted because it is empty")
1651 }
1652}
1653
1654func waitForState(t *testing.T, sub events.Subscription, folder, expected string) {
1655 t.Helper()

Callers

nothing calls this directly

Calls 8

newConfigWrapperFunction · 0.85
setupModelFunction · 0.85
cleanupModelFunction · 0.85
FilesystemMethod · 0.80
FolderListMethod · 0.65
SetIgnoresMethod · 0.65
ErrorMethod · 0.65
StatMethod · 0.65

Tested by

no test coverage detected