Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pass testing.T explicitly to the anonymous func #414

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions inotify_poller_test.go
Expand Up @@ -174,19 +174,19 @@ func TestPollerConcurrent(t *testing.T) {
oks := make(chan bool)
live := make(chan bool)
defer close(live)
go func() {
go func(tb testing.TB) {
defer close(oks)
for {
ok, err := poller.wait()
if err != nil {
t.Fatalf("poller failed: %v", err)
tb.Fatalf("poller failed: %v", err)
}
oks <- ok
if !<-live {
return
}
}
}()
}(t)

// Try a write
select {
Expand Down
6 changes: 3 additions & 3 deletions inotify_test.go
Expand Up @@ -336,11 +336,11 @@ func TestInotifyInnerMapLength(t *testing.T) {
if err != nil {
t.Fatalf("Failed to add testFile: %v", err)
}
go func() {
go func(tb testing.TB) {
for err := range w.Errors {
t.Fatalf("error received: %s", err)
tb.Fatalf("error received: %s", err)
}
}()
}(t)

err = os.Remove(testFile)
if err != nil {
Expand Down
14 changes: 7 additions & 7 deletions integration_test.go
Expand Up @@ -75,11 +75,11 @@ func TestFsnotifyMultipleOperations(t *testing.T) {
watcher := newWatcher(t)

// Receive errors on the error channel on a separate goroutine
go func() {
go func(tb testing.TB) {
for err := range watcher.Errors {
t.Fatalf("error received: %s", err)
tb.Fatalf("error received: %s", err)
}
}()
}(t)

// Create directory to watch
testDir := tempMkdir(t)
Expand Down Expand Up @@ -837,14 +837,14 @@ func TestRemovalOfWatch(t *testing.T) {
t.Fatalf("Could not remove the watch: %v\n", err)
}

go func() {
go func(tb testing.TB) {
select {
case ev := <-watcher.Events:
t.Fatalf("We received event: %v\n", ev)
tb.Fatalf("We received event: %v\n", ev)
case <-time.After(500 * time.Millisecond):
t.Log("No event received, as expected.")
tb.Log("No event received, as expected.")
}
}()
}(t)

time.Sleep(200 * time.Millisecond)
// Modify the file outside of the watched dir
Expand Down