github.com/jbendotnet/noms@v0.0.0-20190904222105-c43e4293ea92/go/util/functions/all_test.go (about) 1 // Copyright 2016 Attic Labs, Inc. All rights reserved. 2 // Licensed under the Apache License, version 2.0: 3 // http://www.apache.org/licenses/LICENSE-2.0 4 5 package functions 6 7 import ( 8 "testing" 9 10 "github.com/stretchr/testify/assert" 11 ) 12 13 func TestAll(t *testing.T) { 14 assert := assert.New(t) 15 16 // Set |res| via |ch| to test it's running in parallel - if not, they'll deadlock. 17 var res int 18 ch := make(chan int) 19 All(func() { ch <- 42 }, func() { res = <-ch }) 20 21 assert.Equal(42, res) 22 }