github.com/v2pro/plz@v0.0.0-20221028024117-e5f9aec5b631/msgfmt/jsonfmt/level_1/array_test.go (about)

     1  package test
     2  
     3  import (
     4  	"testing"
     5  	"github.com/stretchr/testify/require"
     6  	"github.com/v2pro/plz/msgfmt/jsonfmt"
     7  	"github.com/v2pro/plz/reflect2"
     8  )
     9  
    10  func Test_array(t *testing.T) {
    11  	should := require.New(t)
    12  	encoder := jsonfmt.EncoderOf(reflect2.TypeOf([3]int{}))
    13  	should.Equal("[1,2,3]", string(encoder.Encode(nil, nil, reflect2.PtrOf([3]int{
    14  		1, 2, 3,
    15  	}))))
    16  }