Ejemplo n.º 1
0
func asserChannelContainsEntries(a *assert.Assertions, entryC chan [2]string, expectedEntries ...[2]string) {
	allEntries := make([][2]string, 0)

loop:
	for {
		select {
		case entry, ok := <-entryC:
			if !ok {
				break loop
			}
			allEntries = append(allEntries, entry)
		case <-time.After(time.Second):
			a.Fail("timeout")
		}
	}

	a.Equal(len(expectedEntries), len(allEntries))
	for _, expected := range expectedEntries {
		a.Contains(allEntries, expected)
	}
}
Ejemplo n.º 2
0
func assertChannelContains(a *assert.Assertions, entryC chan string, expectedEntries ...string) {
	var allEntries []string

WAITLOOP:
	for {
		select {
		case entry, ok := <-entryC:
			if !ok {
				break WAITLOOP
			}
			allEntries = append(allEntries, entry)
		case <-time.After(time.Second):
			a.Fail("timeout")
		}
	}

	a.Equal(len(expectedEntries), len(allEntries))
	for _, expected := range expectedEntries {
		a.Contains(allEntries, expected)
	}
}
func assertListContainsAll(assert *assert.Assertions, list interface{}, items ...interface{}) {
	assert.Len(list, len(items))
	for _, item := range items {
		assert.Contains(list, item)
	}
}
func assertSubsidiaries(assert *assert.Assertions, actual []Subsidiary, items ...Subsidiary) {
	assert.Len(actual, len(items))
	for _, item := range items {
		assert.Contains(actual, item)
	}
}