...

Source file src/github.com/aws/smithy-go/encoding/json/array_test.go

Documentation: github.com/aws/smithy-go/encoding/json

     1  package json
     2  
     3  import (
     4  	"bytes"
     5  	"testing"
     6  )
     7  
     8  func TestArray(t *testing.T) {
     9  	buffer := bytes.NewBuffer(nil)
    10  	scratch := make([]byte, 64)
    11  
    12  	array := newArray(buffer, &scratch)
    13  	array.Value().String("bar")
    14  	array.Value().String("baz")
    15  	array.Close()
    16  
    17  	e := []byte(`["bar","baz"]`)
    18  	if a := buffer.Bytes(); bytes.Compare(e, a) != 0 {
    19  		t.Errorf("expected %+q, but got %+q", e, a)
    20  	}
    21  }
    22  

View as plain text