ejunit
Petteri Räty <[email protected]>
| Newsgroups | gmane.linux.gentoo.java |
|---|---|
| Message-ID | <[email protected]> |
Please comment on the attached patch. Regards, Petteri
ejunit.patch
(text/x-patch, 1.7 KB)
Index: java-utils-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v
retrieving revision 1.82
diff -u -r1.82 java-utils-2.eclass
--- java-utils-2.eclass 29 Apr 2007 13:13:03 -0000 1.82
+++ java-utils-2.eclass 5 May 2007 11:31:30 -0000
@ -1653,6 +1685,42 @@
}
# ------------------------------------------------------------------------------
+# @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 gets appended
+# @param $@ - the rest of the parameters are passed to java
+# ------------------------------------------------------------------------------
+ejunit() {
+ debug-print-function ${FUNCNAME} $*
+
+ local cp
+ if [[ ${1} = -cp || ${1} = -classpath ]]; then
+ cp=${2}:$(java-pkg_getjars --build-only junit)
+ shift 2
+ else
+ cp=$(java-pkg_getjars --build-only junit):.
+ fi
+
+ if [[ ${DEPEND} != *dev-java/junit* ]]; then
+ local msg="You need to have dev-java/junit in DEPEND when using ${FUNCNAME}"
+ eerror ${msg}
+ die ${msg}
+ fi
+
+ local runner=junit.textui.TestRunner
+ debug-print "Calling: java -cp \"${cp}\" -Djava.awt.headless=true ${runner} ${@}"
+ java -cp "${cp}" -Djava.awt.headless=true ${runner} "${@}" || die "Running junit failed"
+}
+
+# ------------------------------------------------------------------------------
# @section-end helper
# ------------------------------------------------------------------------------
signature.asc
(application/pgp-signature, 252 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.3 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGPGt7cxLzpIGCsLQRAuvFAJ4o1we8qns9RUWNu/XexZHacV2bBgCePuOv stZd8YE/XkSQrfxSqd/+6og= =Z3T5 -----END PGP SIGNATURE-----