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 theRun
method to execute the tests.
- m: A pointer to
- 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)
.
- Creates a new data store (
- Parameters: