-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding tests for TestStepConfigFunc.Exec() method (#150)
- Loading branch information
1 parent
4aa11b7
commit 136e47e
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package config_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-testing/config" | ||
) | ||
|
||
func TestTestStepConfigFunc_Exec(t *testing.T) { | ||
t.Parallel() | ||
|
||
testCases := map[string]struct { | ||
testStepConfigFunc config.TestStepConfigFunc | ||
testStepConfigRequest config.TestStepConfigRequest | ||
expected string | ||
}{ | ||
"static_directory": { | ||
testStepConfigFunc: config.StaticDirectory("name_of_directory"), | ||
expected: "name_of_directory", | ||
}, | ||
"test_name_directory": { | ||
testStepConfigFunc: config.TestNameDirectory(t), | ||
expected: "TestTestStepConfigFunc_Exec", | ||
}, | ||
"test_step_directory": { | ||
testStepConfigFunc: config.TestStepDirectory(t), | ||
testStepConfigRequest: config.TestStepConfigRequest{ | ||
StepNumber: 1, | ||
}, | ||
expected: "TestTestStepConfigFunc_Exec/1", | ||
}, | ||
} | ||
|
||
for name, testCase := range testCases { | ||
name, testCase := name, testCase | ||
|
||
t.Run(name, func(t *testing.T) { | ||
t.Parallel() | ||
|
||
got := testCase.testStepConfigFunc.Exec(testCase.testStepConfigRequest) | ||
|
||
if testCase.expected != got { | ||
t.Errorf("expected %s, got %s", testCase.expected, got) | ||
} | ||
}) | ||
} | ||
} |