Skip to main content

main_test.go

main_test.go - Overview

This file contains the main test function for the eval package. It sets up and tears down the test environment, including initializing and resetting the data store.

Detailed Documentation

func TestMain(m *testing.M)

func TestMain(m *testing.M) {
store := dstore.NewStore(nil, nil)
store.ResetStore()

exitCode := m.Run()

os.Exit(exitCode)
}
  • Purpose: This is the main test function that is executed before all tests in the package.
    • Parameters:
      • m: A pointer to testing.M, which provides the Run method to execute the tests.
    • Functionality:
      • Creates a new data store (dstore.NewStore).
      • Resets the data store (store.ResetStore).
      • Executes the tests using m.Run() and captures the exit code.
      • Exits the test run with the captured exit code using os.Exit(exitCode).

Getting Started Relevance: NO