@@ -2,6 +2,7 @@ package util_test
22
33import (
44 "context"
5+ "math"
56 "testing"
67
78 "github.com/cysp/terraform-provider-contentful/internal/provider/util"
@@ -47,7 +48,8 @@ func TestPrivateDataGetIntNotSet(t *testing.T) {
4748
4849 privateData := newProviderPrivateData ()
4950
50- value , diags := util .PrivateDataGetInt (ctx , privateData , "key" )
51+ var value int
52+ diags := util .PrivateDataGetValue (ctx , privateData , "key" , & value )
5153
5254 assert .EqualValues (t , 0 , value )
5355 assert .NotEmpty (t , diags )
@@ -60,12 +62,13 @@ func TestPrivateDataGetSetInt(t *testing.T) {
6062
6163 privateData := newProviderPrivateData ()
6264
63- diags := util .PrivateDataSetInt (ctx , privateData , "key" , 42 )
65+ diags := util .PrivateDataSetValue (ctx , privateData , "key" , 42 )
6466
6567 assert .EqualValues (t , []byte {'4' , '2' }, privateData .data ["key" ])
6668 assert .Empty (t , diags )
6769
68- value , diags := util .PrivateDataGetInt (ctx , privateData , "key" )
70+ var value int
71+ diags = util .PrivateDataGetValue (ctx , privateData , "key" , & value )
6972
7073 assert .EqualValues (t , 42 , value )
7174 assert .Empty (t , diags )
@@ -79,8 +82,21 @@ func TestPrivateDataGetIntInvalid(t *testing.T) {
7982 privateData := newProviderPrivateData ()
8083 privateData .data ["key" ] = []byte ("invalid" )
8184
82- value , diags := util .PrivateDataGetInt (ctx , privateData , "key" )
85+ var value int
86+ diags := util .PrivateDataGetValue (ctx , privateData , "key" , & value )
8387
8488 assert .EqualValues (t , 0 , value )
8589 assert .NotEmpty (t , diags )
8690}
91+
92+ func TestPrivateDataSetInf (t * testing.T ) {
93+ t .Parallel ()
94+
95+ ctx := context .Background ()
96+
97+ privateData := newProviderPrivateData ()
98+
99+ diags := util .PrivateDataSetValue (ctx , privateData , "key" , math .Inf (1 ))
100+
101+ assert .NotEmpty (t , diags )
102+ }
0 commit comments