MCPcopy
hub / github.com/docker/compose / TestFseventNotifyCloseIdempotent

Function TestFseventNotifyCloseIdempotent

pkg/watch/watcher_darwin_test.go:27–48  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25)
26
27func TestFseventNotifyCloseIdempotent(t *testing.T) {
28 // Create a watcher with a temporary directory
29 tmpDir := t.TempDir()
30 watcher, err := newWatcher([]string{tmpDir})
31 assert.NilError(t, err)
32
33 // Start the watcher
34 err = watcher.Start()
35 assert.NilError(t, err)
36
37 // Close should work the first time
38 err = watcher.Close()
39 assert.NilError(t, err)
40
41 // Close should be idempotent - calling it again should not panic
42 err = watcher.Close()
43 assert.NilError(t, err)
44
45 // Even a third time should be safe
46 err = watcher.Close()
47 assert.NilError(t, err)
48}

Callers

nothing calls this directly

Calls 4

TempDirMethod · 0.80
newWatcherFunction · 0.70
StartMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected