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

38 lines
654 B
Go
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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)
}