github.com/kaydxh/golang@v0.0.131/pkg/fsnotify/fsnotify_test.go (about) 1 package fsnotify_test 2 3 import ( 4 "context" 5 "testing" 6 7 fsnotify_ "github.com/kaydxh/golang/pkg/fsnotify" 8 viper_ "github.com/kaydxh/golang/pkg/viper" 9 ) 10 11 func TestFsnotify(t *testing.T) { 12 13 cfgFile := "./fsnotify.yaml" 14 config := fsnotify_.NewConfig(fsnotify_.WithViper(viper_.GetViper(cfgFile, "fsnotify"))) 15 16 fn, err := config.Complete().New(context.Background()) 17 if err != nil { 18 t.Fatalf("failed to new config err: %v", err) 19 } 20 fn.ApplyOptions(fsnotify_.WithWriteCallbackFunc(func(ctx context.Context, path string) { 21 t.Logf("%s write call back", path) 22 })) 23 24 select {} 25 }