github.com/trim21/go-phpserialize@v0.0.22-0.20240301204449-2fca0319b3f0/internal/test/int_test.go (about) 1 package test_test 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/require" 7 "github.com/trim21/go-phpserialize" 8 "github.com/trim21/go-phpserialize/internal/test" 9 "github.com/volatiletech/null/v9" 10 ) 11 12 func TestMarshal_int_ptr_string(t *testing.T) { 13 t.Run("ptr direct", func(t *testing.T) { 14 data := struct { 15 I *int `php:"i,string"` 16 }{ 17 I: null.IntFrom(0).Ptr(), 18 } 19 20 actual, err := phpserialize.Marshal(&data) 21 require.NoError(t, err) 22 expected := `a:1:{s:1:"i";s:1:"0";}` 23 test.StringEqual(t, expected, string(actual)) 24 }) 25 }