func TestNew(t *testing.T) {
	config.SetHome(filepath.Join("..", "..", "cmd", "roy", "data"))
	config.SetMIMEInfo("tika-mimetypes.xml")()
	mi, err := newMIMEInfo(config.MIMEInfo())
	if err != nil {
		t.Error(err)
	}
	sigs, ids, err := mi.Signatures()
	if err != nil {
		t.Error(err)
	}
	for i, v := range sigs {
		if len(v) == 0 {
			t.Errorf("Empty signature: %s", ids[i])
		}
	}
	id, _ := New()
	str := id.String()
	saver := persist.NewLoadSaver(nil)
	id.Save(saver)
	loader := persist.NewLoadSaver(saver.Bytes())
	_ = loader.LoadByte()
	id2 := Load(loader)
	if str != id2.String() {
		t.Errorf("Load identifier fail: got %s, expect %s", str, id2.String())
	}
}
func New(opts ...config.Option) (core.Identifier, error) {
	for _, v := range opts {
		v()
	}
	mi, err := newMIMEInfo(config.MIMEInfo())
	if err != nil {
		return nil, err
	}
	// add extensions
	for _, v := range config.Extend() {
		e, err := newMIMEInfo(v)
		if err != nil {
			return nil, fmt.Errorf("MIMEinfo: error loading extension file %s; got %s", v, err)
		}
		mi = identifier.Join(mi, e)
	}
	// apply config
	mi = identifier.ApplyConfig(mi)
	// return identifier
	return &Identifier{
		infos: infos(mi.Infos()),
		Base:  identifier.New(mi, config.ZipMIME()),
	}, nil
}