Created
September 25, 2019 13:58
-
-
Save zaltoprofen/801a0e45c7c3010bebc9cd02991b79fe to your computer and use it in GitHub Desktop.
JUNGO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module github.com/zaltoprofen/jungo | |
go 1.13 | |
require github.com/stretchr/testify v1.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jungo | |
func MakeSetList() <-chan string { | |
c := make(chan string) | |
go func(){ | |
for { | |
c <- "Welcome!!" | |
} | |
}() | |
return c | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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