Skip to Content
Hands-On Software Engineering with Golang
book

Hands-On Software Engineering with Golang

by Achilleas Anagnostopoulos
January 2020
Intermediate to advanced
640 pages
16h 56m
English
Packt Publishing
Content preview from Hands-On Software Engineering with Golang

Setting up a test suite for the in-memory indexer

The test suite for the in-memory indexer implementation embeds the shared test suite we outlined in the Verifying indexer implementations using a shared test suite section. Since the suite depends on the gocheck framework, we need to add some extra code to register the suite with the go test framework:

var _ = gc.Suite(new(InMemoryBleveTestSuite))

type InMemoryBleveTestSuite struct {
    indextest.SuiteBase
    idx *InMemoryBleveIndexer
}

// Register our test-suite with go test.
func Test(t *testing.T) { gc.TestingT(t) }

To ensure that each test uses a clean index instance, the suite provides a per-test setup method that recreates the index before running each test:

func (s *InMemoryBleveTestSuite) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Software Architecture with Golang

Hands-On Software Architecture with Golang

Jyotiswarup Raiturkar

Publisher Resources

ISBN: 9781838554491Supplemental Content