mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-25 08:21:07 -06:00
c12d64f340
Go 1.9 adds this new function which, when called, marks the caller as being a "helper function". Helper function stack frames are then skipped when trying to find a line of test code to blame for a test failure, so that the code in the main test function appears in the test failure output rather than a line within the helper function itself. This covers many -- but probaly not all -- of our test helpers across various packages.
18 lines
275 B
Go
18 lines
275 B
Go
package config
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
// TestRawConfig is used to create a RawConfig for testing.
|
|
func TestRawConfig(t *testing.T, c map[string]interface{}) *RawConfig {
|
|
t.Helper()
|
|
|
|
cfg, err := NewRawConfig(c)
|
|
if err != nil {
|
|
t.Fatalf("err: %s", err)
|
|
}
|
|
|
|
return cfg
|
|
}
|