Skip to content

Instantly share code, notes, and snippets.

@zaltoprofen
Created September 25, 2019 13:58
Show Gist options
  • Save zaltoprofen/801a0e45c7c3010bebc9cd02991b79fe to your computer and use it in GitHub Desktop.
Save zaltoprofen/801a0e45c7c3010bebc9cd02991b79fe to your computer and use it in GitHub Desktop.
JUNGO
module github.com/zaltoprofen/jungo
go 1.13
require github.com/stretchr/testify v1.4.0
package jungo
func MakeSetList() <-chan string {
c := make(chan string)
go func(){
for {
c <- "Welcome!!"
}
}()
return c
}
package jungo
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestMakeSetList(t *testing.T) {
c := MakeSetList()
for k := 0; k < 100; k+=1 {
v, ok := <-c
assert.True(t, ok)
assert.Equal(t, v, "Welcome!!")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment