github.com/moreal/bencodex-go@v0.0.0-20231021172012-18277a477d15/example_test.go (about)

     1  package bencode_test
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  )
     7  
     8  func TestExample(t *testing.T) {
     9  	var dict interface{} = map[string]interface{}{
    10  		"int":    123,
    11  		"string": "Hello, World",
    12  		"list":   []interface{}{"foo", "bar"},
    13  	}
    14  	data, err := bencodex.Marshal(dict)
    15  	if err != nil {
    16  		panic(err)
    17  	}
    18  	fmt.Println(string(data))
    19  }