cbor_test.go — fiber Source File
Architecture documentation for cbor_test.go, a go file in the fiber codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR c3eb4349_8638_9743_621e_0c894e704e9b["cbor_test.go"] d412afc8_b482_999e_79ca_16b6ad9c2e7c["testing"] c3eb4349_8638_9743_621e_0c894e704e9b --> d412afc8_b482_999e_79ca_16b6ad9c2e7c style c3eb4349_8638_9743_621e_0c894e704e9b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
package binder
import (
"testing"
"github.com/fxamacker/cbor/v2"
"github.com/stretchr/testify/require"
)
func Test_CBORBinder_Bind(t *testing.T) {
t.Parallel()
b := &CBORBinding{
CBORDecoder: cbor.Unmarshal,
}
require.Equal(t, "cbor", b.Name())
type Post struct {
Title string `cbor:"title"`
}
type User struct {
Name string `cbor:"name"`
Posts []Post `cbor:"posts"`
Names []string `cbor:"names"`
Age int `cbor:"age"`
}
var user User
wantedUser := User{
Name: "john",
Names: []string{
"john",
"doe",
},
Age: 42,
Posts: []Post{
{Title: "post1"},
{Title: "post2"},
{Title: "post3"},
},
}
body, err := cbor.Marshal(wantedUser)
require.NoError(t, err)
err = b.Bind(body, &user)
require.NoError(t, err)
require.Equal(t, "john", user.Name)
require.Equal(t, 42, user.Age)
require.Len(t, user.Posts, 3)
require.Equal(t, "post1", user.Posts[0].Title)
require.Equal(t, "post2", user.Posts[1].Title)
require.Equal(t, "post3", user.Posts[2].Title)
require.Contains(t, user.Names, "john")
require.Contains(t, user.Names, "doe")
b.Reset()
require.Nil(t, b.CBORDecoder)
// ... (72 more lines)
Domain
Subdomains
Functions
Dependencies
- testing
Source
Frequently Asked Questions
What does cbor_test.go do?
cbor_test.go is a source file in the fiber codebase, written in go. It belongs to the DataBinding domain, PayloadParsers subdomain.
What functions are defined in cbor_test.go?
cbor_test.go defines 6 function(s): Benchmark_CBORBinder_Bind, Test_CBORBinder_Bind, Test_UnimplementedCborMarshal_PanicMessage, Test_UnimplementedCborMarshal_Panics, Test_UnimplementedCborUnmarshal_PanicMessage, Test_UnimplementedCborUnmarshal_Panics.
What does cbor_test.go depend on?
cbor_test.go imports 1 module(s): testing.
Where is cbor_test.go in the architecture?
cbor_test.go is located at binder/cbor_test.go (domain: DataBinding, subdomain: PayloadParsers, directory: binder).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free