123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- package provider
- import (
- "regexp"
- "testing"
- "github.com/hashicorp/terraform-plugin-testing/helper/resource"
- "github.com/hashicorp/terraform-plugin-testing/tfversion"
- )
- func TestComputeTaxFunction_Known(t *testing.T) {
-
- resource.UnitTest(t, resource.TestCase{
- TerraformVersionChecks: []tfversion.TerraformVersionCheck{
- tfversion.SkipBelow(tfversion.Version1_8_0),
- },
- ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
- Steps: []resource.TestStep{
- {
- Config: `output "test" {
- value = provider::hashicups::compute_tax(5.00, 0.085)
- }`,
- Check: resource.ComposeAggregateTestCheckFunc(
- resource.TestCheckOutput("test", "5.43")),
- },
- },
- })
- }
- func TestComputeTaxFunction_Null(t *testing.T) {
- resource.UnitTest(t, resource.TestCase{
- TerraformVersionChecks: []tfversion.TerraformVersionCheck{
- tfversion.SkipBelow(tfversion.Version1_8_0),
- },
- ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
- Steps: []resource.TestStep{
- {
- Config: `output "test" {
- value = provider::hashicups::compute_tax(null, 0.085)
- }`,
- ExpectError: regexp.MustCompile(`argument must not be null`),
- },
- },
- })
- }
|