Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for injectEvents (0.55 sec)

  1. pkg/filewatcher/fakefilewatcher_test.go

    		}
    		select {
    		case <-removedChan:
    			t.Fatal("Add() failed: callback invoked with added=false")
    		default:
    		}
    
    		wantEvent := fsnotify.Event{Name: file, Op: fsnotify.Write}
    		fakeWatcher.InjectEvent(file, wantEvent)
    		gotEvent := <-watcher.Events(file)
    		if gotEvent != wantEvent {
    			t.Fatalf("Events() failed: got %v want %v", gotEvent, wantEvent)
    		}
    
    		wantError := fmt.Errorf("error=%v", file)
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed May 24 14:06:41 UTC 2023
    - 3.8K bytes
    - Viewed (0)
  2. pkg/filewatcher/fakefilewatcher.go

    type FakeWatcher struct {
    	sync.Mutex
    
    	events      map[string]chan fsnotify.Event
    	errors      map[string]chan error
    	changedFunc func(path string, added bool)
    }
    
    // InjectEvent injects an event into the fake file watcher.
    func (w *FakeWatcher) InjectEvent(path string, event fsnotify.Event) {
    	w.Lock()
    	ch, ok := w.events[path]
    	w.Unlock()
    
    	if ok {
    		ch <- event
    	}
    }
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed May 24 14:06:41 UTC 2023
    - 3.6K bytes
    - Viewed (0)
Back to top