func TestRefIsValid(t *testing.T) {
	tbl := []struct {
		RID   string
		Valid bool
	}{
		{"test", true},
		{"test.model", true},
		{"test.model._hej_", true},
		{"test.model.<strange", true},
		{"test.model.23", true},
		{"test.model.23?", true},
		{"test.model.23?foo=bar", true},
		{"test.model.23?foo=test.bar", true},
		{"test.model.23?foo=*&?", true},
		{"", false},
		{".test", false},
		{"test.", false},
		{".test.model", false},
		{"test..model", false},
		{"test.model.", false},
		{"test\tmodel", false},
		{"test\nmodel", false},
		{"test\rmodel", false},
		{"test model", false},
		{"test\ufffdmodel", false},
		{"täst.model", false},
		{"test.*.model", false},
		{"test.>.model", false},
		{"test.model.>", false},
		{"?foo=test.bar", false},
		{".test.model?foo=test.bar", false},
		{"test..model?foo=test.bar", false},
		{"test.model.?foo=test.bar", false},
		{"test\tmodel?foo=test.bar", false},
		{"test\nmodel?foo=test.bar", false},
		{"test\rmodel?foo=test.bar", false},
		{"test model?foo=test.bar", false},
		{"test\ufffdmodel?foo=test.bar", false},
		{"täst.model?foo=test.bar", false},
		{"test.*.model?foo=test.bar", false},
		{"test.>.model?foo=test.bar", false},
		{"test.model.>?foo=test.bar", false},
	}
	for _, l := range tbl {
		v := res.Ref(l.RID).IsValid()
		if v != l.Valid {
			if l.Valid {
				t.Errorf("expected Ref %#v to be valid, but it wasn't", l.RID)
			} else {
				t.Errorf("expected Ref %#v not to be valid, but it was", l.RID)
			}
		}
		v = res.SoftRef(l.RID).IsValid()
		if v != l.Valid {
			if l.Valid {
				t.Errorf("expected SoftRef %#v to be valid, but it wasn't", l.RID)
			} else {
				t.Errorf("expected SoftRef %#v not to be valid, but it was", l.RID)
			}
		}
	}
}
Test Ref IsValid method
package test
import (
	"encoding/json"
	"fmt"
	"testing"
	res "github.com/jirenius/go-res"
	"github.com/jirenius/go-res/restest"
)