Commit e5b0b8a6 authored by Eric Myhre's avatar Eric Myhre

Additional basic tests around strings.

parent 37dd2d99
package impls
import (
"testing"
"github.com/ipld/go-ipld-prime/_rsrch/nodesolution/impls/tests"
)
func TestString(t *testing.T) {
tests.SpecTestString(t, Style__String{})
}
package tests
import (
"testing"
. "github.com/warpfork/go-wish"
ipld "github.com/ipld/go-ipld-prime/_rsrch/nodesolution"
)
func SpecTestString(t *testing.T, ns ipld.NodeStyle) {
t.Run("string node", func(t *testing.T) {
nb := ns.NewBuilder()
err := nb.AssignString("asdf")
Wish(t, err, ShouldEqual, nil)
n := nb.Build()
Wish(t, n.ReprKind(), ShouldEqual, ipld.ReprKind_String)
Wish(t, n.IsNull(), ShouldEqual, false)
x, err := n.AsString()
Wish(t, err, ShouldEqual, nil)
Wish(t, x, ShouldEqual, "asdf")
})
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment