1package fqname23import (4 "testing"56 "gno.land/p/nt/uassert/v0"7)89func TestParse(t *testing.T) {10 tests := []struct {11 input string12 expectedPkgPath string13 expectedName string14 }{15 {"gno.land/p/nt/avl/v0.Tree", "gno.land/p/nt/avl/v0", "Tree"},16 {"gno.land/p/nt/avl/v0", "gno.land/p/nt/avl/v0", ""},17 {"gno.land/p/nt/avl/v0.Tree.Node", "gno.land/p/nt/avl/v0", "Tree.Node"},18 {"gno.land/p/nt/avl/v0/nested.Package.Func", "gno.land/p/nt/avl/v0/nested", "Package.Func"},19 {"path/filepath.Split", "path/filepath", "Split"},20 {"path.Split", "path", "Split"},21 {"path/filepath", "path/filepath", ""},22 {"path", "path", ""},23 {"", "", ""},24 }2526 for _, tt := range tests {27 pkgpath, name := Parse(tt.input)28 uassert.Equal(t, tt.expectedPkgPath, pkgpath, "Package path did not match")29 uassert.Equal(t, tt.expectedName, name, "Name did not match")30 }31}3233func TestConstruct(t *testing.T) {34 tests := []struct {35 pkgpath string36 name string37 expected string38 }{39 {"gno.land/r/demo/foo20", "Token", "gno.land/r/demo/foo20.Token"},40 {"gno.land/r/demo/foo20", "", "gno.land/r/demo/foo20"},41 {"path", "", "path"},42 {"path", "Split", "path.Split"},43 {"path/filepath", "", "path/filepath"},44 {"path/filepath", "Split", "path/filepath.Split"},45 {"", "JustName", ".JustName"},46 {"", "", ""},47 }4849 for _, tt := range tests {50 result := Construct(tt.pkgpath, tt.name)51 uassert.Equal(t, tt.expected, result, "Constructed FQName did not match expected")52 }53}5455func TestRenderLink(t *testing.T) {56 tests := []struct {57 pkgPath string58 slug string59 expected string60 }{61 {"gno.land/p/nt/avl/v0", "Tree", "[gno.land/p/nt/avl/v0](/p/nt/avl/v0).Tree"},62 {"gno.land/p/nt/avl/v0", "", "[gno.land/p/nt/avl/v0](/p/nt/avl/v0)"},63 {"github.com/a/b", "C", "github.com/a/b.C"},64 {"example.com/pkg", "Func", "example.com/pkg.Func"},65 {"gno.land/r/demo/foo20", "Token", "[gno.land/r/demo/foo20](/r/demo/foo20).Token"},66 {"gno.land/r/demo/foo20", "", "[gno.land/r/demo/foo20](/r/demo/foo20)"},67 {"", "", ""},68 }6970 for _, tt := range tests {71 result := RenderLink(tt.pkgPath, tt.slug)72 uassert.Equal(t, tt.expected, result, "Rendered link did not match expected")73 }74}75Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.