From a04cf014a47fc07bff8045faeef8e418c7d8734c Mon Sep 17 00:00:00 2001 From: Serkan Kaba Date: Tue, 15 Mar 2011 19:53:05 +0000 Subject: Add ejunit4() function to run Junit4 tests. --- eclass/java-utils-2.eclass | 64 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 12 deletions(-) (limited to 'eclass/java-utils-2.eclass') diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass index da5961016384..d02746aafc79 100644 --- a/eclass/java-utils-2.eclass +++ b/eclass/java-utils-2.eclass @@ -6,7 +6,7 @@ # # Licensed under the GNU General Public License, v2 # -# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.135 2010/04/28 19:40:40 caster Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.136 2011/03/15 19:53:05 serkan Exp $ # ----------------------------------------------------------------------------- # @eclass-begin @@ -1754,21 +1754,18 @@ java-pkg_ant-tasks-depend() { fi } + # ------------------------------------------------------------------------------ -# @ebuild-function ejunit +# @internal-function ejunit_ # -# Junit wrapper function. Makes it easier to run the tests and checks for +# Internal Junit wrapper function. Makes it easier to run the tests and checks for # dev-java/junit in DEPEND. Launches the tests using junit.textui.TestRunner. # -# Examples: -# ejunit -cp build/classes org.blinkenlights.jid3.test.AllTests -# ejunit org.blinkenlights.jid3.test.AllTests -# -# @param $1 - -cp or -classpath -# @param $2 - classpath; junit and recorded dependencies get appended +# @param $1 - junit package (junit or junit-4) +# @param $2 - -cp or -classpath +# @param $3 - classpath; junit and recorded dependencies get appended # @param $@ - the rest of the parameters are passed to java -# ------------------------------------------------------------------------------ -ejunit() { +ejunit_() { debug-print-function ${FUNCNAME} $* local pkgs @@ -1778,7 +1775,10 @@ ejunit() { done fi - local cp=$(java-pkg_getjars --with-dependencies junit${pkgs}) + local junit=${1} + shift 1 + + local cp=$(java-pkg_getjars --with-dependencies ${junit}${pkgs}) if [[ ${1} = -cp || ${1} = -classpath ]]; then cp="${2}:${cp}" shift 2 @@ -1791,6 +1791,46 @@ ejunit() { java -cp "${cp}" -Djava.awt.headless=true ${runner} "${@}" || die "Running junit failed" } +# ------------------------------------------------------------------------------ +# @ebuild-function ejunit +# +# Junit wrapper function. Makes it easier to run the tests and checks for +# dev-java/junit in DEPEND. Launches the tests using junit.textui.TestRunner. +# +# Examples: +# ejunit -cp build/classes org.blinkenlights.jid3.test.AllTests +# ejunit org.blinkenlights.jid3.test.AllTests +# +# @param $1 - -cp or -classpath +# @param $2 - classpath; junit and recorded dependencies get appended +# @param $@ - the rest of the parameters are passed to java +# ------------------------------------------------------------------------------ +ejunit() { + debug-print-function ${FUNCNAME} $* + + ejunit_ "junit" "${@}" +} + +# ------------------------------------------------------------------------------ +# @ebuild-function ejunit4 +# +# Junit4 wrapper function. Makes it easier to run the tests and checks for +# dev-java/junit:4 in DEPEND. Launches the tests using junit.textui.TestRunner. +# +# Examples: +# ejunit -cp build/classes org.blinkenlights.jid3.test.AllTests +# ejunit org.blinkenlights.jid3.test.AllTests +# +# @param $1 - -cp or -classpath +# @param $2 - classpath; junit and recorded dependencies get appended +# @param $@ - the rest of the parameters are passed to java +# ------------------------------------------------------------------------------ +ejunit4() { + debug-print-function ${FUNCNAME} $* + + ejunit_ "junit-4" "${@}" +} + # ------------------------------------------------------------------------------ # @section-end helper # ------------------------------------------------------------------------------ -- cgit v1.2.3-65-gdbad