package ii

import (
	"strings"
	"testing"

	"golib/v1/features/mlib/mo"
)

func TestReadItemInfo(t *testing.T) {
	into, err := readItemInfoFromXml("test.xml")
	if err != nil {
		t.Error(err)
		return
	}
	t.Log(into)
}

func TestLoadItemInfo(t *testing.T) {
	LoadItemInfo("./")
}

func TestName(t *testing.T) {
	s := `{"name":"hello"}`
	var j mo.Regex
	if err := mo.UnmarshalExtJSON([]byte(s), true, &j); err != nil {
		t.Error(err)
		return
	}
	t.Log(j)
}

func TestGetDbName(t *testing.T) {
	// s := "main.user"
	// if i := strings.Index(s, "."); i != -1 {
	// 	t.Log(s[i+1:])
	// 	return
	// }
	v := "curname"
	if strings.HasPrefix(v, "cur") {
		t.Log(v[3:])
	}
}
