flabk/pkg/ld/internal/parse/chunk/chunk_test.go

38 lines
654 B
Go
Raw Normal View History

2022-08-03 15:20:03 +01:00
package chunk_test
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
"sectorinf.com/emilis/flabk/pkg/ld/internal/parse/chunk"
)
func TestSpace(t *testing.T) {
that := require.New(t)
ch := chunk.New([]byte(" hello world"))
that.True(ch.AtSpace())
}
func TestParseMap(t *testing.T) {
type Hello struct {
Hello string
}
ch := chunk.New([]byte(`"Hello": "world"`))
h, err := chunk.ParseMap[Hello](ch)(Hello{})
if err != nil {
panic(err)
}
fmt.Println(h)
}
func TestChild(t *testing.T) {
type Hello struct {
Hello string
}
ch := chunk.New([]byte(`"Hello": "world"`))
child := ch.Child(5, 10)
fmt.Println(child)
}