use Context to send cancelation signals to groutines
This commit is contained in:
parent
bf3225765d
commit
5048018d48
5 changed files with 42 additions and 8 deletions
|
|
@ -1,12 +1,13 @@
|
|||
package twitterscraper
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGetTweets(t *testing.T) {
|
||||
count := 0
|
||||
for tweet := range GetTweets("nomadic_ua", 2) {
|
||||
for tweet := range GetTweets(context.Background(), "nomadic_ua", 2) {
|
||||
if tweet.Error != nil {
|
||||
t.Error(tweet.Error)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue