github.com/xhghs/rclone@v1.51.1-0.20200430155106-e186a28cced8/fs/rc/rc_test.go (about)

     1  package rc
     2  
     3  import (
     4  	"bytes"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  	"github.com/stretchr/testify/require"
     9  )
    10  
    11  func TestWriteJSON(t *testing.T) {
    12  	var buf bytes.Buffer
    13  	err := WriteJSON(&buf, Params{
    14  		"String": "hello",
    15  		"Int":    42,
    16  	})
    17  	require.NoError(t, err)
    18  	assert.Equal(t, `{
    19  	"Int": 42,
    20  	"String": "hello"
    21  }
    22  `, buf.String())
    23  }