@@ -509,15 +509,52 @@ func TestBindParamsToExplodedObject(t *testing.T) {
509509}
510510
511511func TestBindStyledParameterWithLocation (t * testing.T ) {
512- expectedBig := big .NewInt (12345678910 )
512+ t .Run ("bigNumber" , func (t * testing.T ) {
513+ expectedBig := big .NewInt (12345678910 )
514+ var dstBigNumber big.Int
515+
516+ err := BindStyledParameterWithOptions ("simple" , "id" , "12345678910" , & dstBigNumber , BindStyledParameterOptions {
517+ ParamLocation : ParamLocationUndefined ,
518+ Explode : false ,
519+ Required : false ,
520+ })
521+ assert .NoError (t , err )
522+ assert .Equal (t , * expectedBig , dstBigNumber )
523+ })
513524
514- var dstBigNumber big.Int
525+ t .Run ("object" , func (t * testing.T ) {
526+ type Object struct {
527+ Key1 string `json:"key1"`
528+ Key2 string `json:"key2"`
529+ }
530+ expectedObject := Object {
531+ Key1 : "value1" ,
532+ Key2 : "42" ,
533+ }
534+ var dstObject Object
515535
516- err := BindStyledParameterWithOptions ("simple" , "id" , "12345678910" , & dstBigNumber , BindStyledParameterOptions {
517- ParamLocation : ParamLocationUndefined ,
518- Explode : false ,
519- Required : false ,
536+ err := BindStyledParameterWithOptions ("simple" , "map" , "key1,value1,key2,42" , & dstObject , BindStyledParameterOptions {
537+ ParamLocation : ParamLocationUndefined ,
538+ Explode : false ,
539+ Required : false ,
540+ })
541+ assert .NoError (t , err )
542+ assert .Equal (t , * & expectedObject , dstObject )
543+ })
544+
545+ t .Run ("map" , func (t * testing.T ) {
546+ expectedMap := map [string ]any {
547+ "key1" : "value1" ,
548+ "key2" : "42" ,
549+ }
550+ var dstMap map [string ]any
551+
552+ err := BindStyledParameterWithOptions ("simple" , "map" , "key1,value1,key2,42" , & dstMap , BindStyledParameterOptions {
553+ ParamLocation : ParamLocationUndefined ,
554+ Explode : false ,
555+ Required : false ,
556+ })
557+ assert .NoError (t , err )
558+ assert .Equal (t , * & expectedMap , dstMap )
520559 })
521- assert .NoError (t , err )
522- assert .Equal (t , * expectedBig , dstBigNumber )
523560}
0 commit comments