# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8
NEED_EMACS="27.1"

inherit elisp git-r3

DESCRIPTION="Convert string regexp to rx notation"

HOMEPAGE="https://elpa.gnu.org/packages/xr.html"

# EGIT_REPO_URI="https://github.com/mattiase/xr.git"
# EGIT_BRANCH="master"
EGIT_REPO_URI="https://git.savannah.gnu.org/git/emacs/elpa.git"
EGIT_CLONE_TYPE="single"
EGIT_BRANCH="externals/xr"
KEYWORDS="~amd64 ~x86"

LICENSE="GPL-3"
SLOT="0"
IUSE="test"

src_prepare() {
	if ! use test ; then
		rm ${PN}-test.el
	fi
	elisp_src_prepare
}

src_test() {
	${EMACS} -batch -Q -L . \
			 -l ${PN}-test.elc                  \
			 -f ert-run-tests-batch-and-exit || die "ERT test(s) failed."
}